From e22abc4eaf4f1446c6ac31e4b709cb5206d4fe3b Mon Sep 17 00:00:00 2001 From: David Phillips Date: Wed, 1 Aug 2018 21:55:36 +1200 Subject: Add simple language test cases, fix empty line bug --- test/test-short-keyword.c | 76 ----------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 test/test-short-keyword.c (limited to 'test/test-short-keyword.c') diff --git a/test/test-short-keyword.c b/test/test-short-keyword.c deleted file mode 100644 index b3baa2c..0000000 --- a/test/test-short-keyword.c +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include -#include -#include - -#include "gate.h" -#include "parser.h" - -char *failures[] = { - "input" - "input\n", - "input \n", - "input aa aa\n", - "module", - " module ", - "\tmodule ", - " moudle \t\n ", - "expr ", - " expr ", - "expr", - "expr asdf xor a b", - "expr asdf: xor b", - "expr asdf: foo b", - "expr asdf: foo a b", -}; - -char *passes[] = { - "input aa", - "input a\n", - "input aaaaaaaa\n", - "module test", - "module test", - "module test ", - "module test ", - " \tmodule \ttest \t", - "expr asdf: xor aa a", - "expr asdf: not aa", - " expr asdf: not aa ", - "\n", - "\n\n", - "\r", - "\r\r", - "\r\n", - "\n\r", - "\n\n\r", - "\r\n\r", - "", - "\t" -}; - -int main(void) { - size_t i = 0; - char *string = NULL; - - for (i = 0; i < sizeof(failures)/sizeof(failures[0]); i++) { - string = strdup(failures[i]); - if (string == NULL) { - perror("strdup"); - return 1; - } - fprintf(stderr, "Testing xfail '%s'\n", string); - assert(0 != parse_line(string)); - free(string); - } - for (i = 0; i < sizeof(passes)/sizeof(passes[0]); i++) { - string = strdup(passes[i]); - if (string == NULL) { - perror("strdup"); - return 1; - } - fprintf(stderr, "Testing xpass '%s'\n", string); - assert(0 == parse_line(string)); - free(string); - } - return 0; -} -- cgit v1.1