From: j8takagi Date: Sat, 16 Feb 2019 03:01:18 +0000 (+0900) Subject: strip_casl2_commentのユニットテストを追加 X-Git-Tag: v0.5p9~18 X-Git-Url: https://j8takagi.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e85ce717a46051d8127ed7b58122305297d4769f;p=YACASL2.git strip_casl2_commentのユニットテストを追加 --- 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; +}