From e85ce717a46051d8127ed7b58122305297d4769f Mon Sep 17 00:00:00 2001 From: j8takagi Date: Sat, 16 Feb 2019 12:01:18 +0900 Subject: [PATCH] =?utf8?q?strip=5Fcasl2=5Fcomment=E3=81=AE=E3=83=A6?= =?utf8?q?=E3=83=8B=E3=83=83=E3=83=88=E3=83=86=E3=82=B9=E3=83=88=E3=82=92?= =?utf8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- test/unit/strip_casl2_comment/0.txt | 6 ++++++ test/unit/strip_casl2_comment/Makefile | 20 ++++++++++++++++++++ test/unit/strip_casl2_comment/cmd.c | 18 ++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 test/unit/strip_casl2_comment/0.txt create mode 100644 test/unit/strip_casl2_comment/Makefile create mode 100644 test/unit/strip_casl2_comment/cmd.c diff --git a/test/unit/strip_casl2_comment/0.txt b/test/unit/strip_casl2_comment/0.txt new file mode 100644 index 0000000..c92a5cd --- /dev/null +++ b/test/unit/strip_casl2_comment/0.txt @@ -0,0 +1,6 @@ + LD GR1,GR2:: + LD GR1,GR2 :: + LD GR1,='#' :: + LD GR1,=';':: + LD GR1,=''';':: + LD GR1,=''';' :: diff --git a/test/unit/strip_casl2_comment/Makefile b/test/unit/strip_casl2_comment/Makefile new file mode 100644 index 0000000..3961b08 --- /dev/null +++ b/test/unit/strip_casl2_comment/Makefile @@ -0,0 +1,20 @@ +include ../Define.mk +include ../Test.mk + +CC := gcc +CFLAGS := -Wall -Wextra + +.INTERMEDIATE: $(CMD_FILE) + +CMDSRC_FILE := cmd.c +TARGETDIR := ../../../src +INCLUDEDIR := ../../../include +TESTTARGET_FILES := $(TARGETDIR)/token.c $(TARGETDIR)/cmem.c $(TARGETDIR)/cerr.c # Set test target files + +$(CMD_FILE): $(CMDSRC_FILE) $(TESTTARGET_FILES) + $(CC) $(CFLAGS) -I $(INCLUDEDIR) -o $@ $^ + +clean_cmd: + @rm -rf cmd.dSYM cmd + +clean: clean_cmd diff --git a/test/unit/strip_casl2_comment/cmd.c b/test/unit/strip_casl2_comment/cmd.c new file mode 100644 index 0000000..bd6fdc5 --- /dev/null +++ b/test/unit/strip_casl2_comment/cmd.c @@ -0,0 +1,18 @@ +#include +#include "token.h" + +int main(){ + char s[][50] = { + " LD GR1,GR2", + " LD GR1,GR2 ; CASL II comment", + " LD GR1,='#' ; CASL II comment", + " LD GR1,=';'", + " LD GR1,=''';'", + " LD GR1,=''';' ; CASL II comment", + }; + + for(size_t i = 0; i < sizeof(s) / sizeof(s[0]); i++) { + printf("%s::\n", strip_casl2_comment(s[i])); + } + return 0; +} -- 2.18.0