summaryrefslogtreecommitdiff
path: root/test/test-short-keyword.c
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-08-01 21:55:36 +1200
committerDavid Phillips <david@sighup.nz>2018-08-01 21:55:40 +1200
commite22abc4eaf4f1446c6ac31e4b709cb5206d4fe3b (patch)
tree60c923bcf3b259f5480c820689d34ad3ff175abf /test/test-short-keyword.c
parenteff2535b82ff36dda815ef57c385d7767692c3a5 (diff)
downloadhence-e22abc4eaf4f1446c6ac31e4b709cb5206d4fe3b.tar.xz
Add simple language test cases, fix empty line bug
Diffstat (limited to 'test/test-short-keyword.c')
-rw-r--r--test/test-short-keyword.c76
1 files changed, 0 insertions, 76 deletions
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 <assert.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#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;
-}