summaryrefslogtreecommitdiff
path: root/test/old/test-short-keyword.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/old/test-short-keyword.c')
-rw-r--r--test/old/test-short-keyword.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/test/old/test-short-keyword.c b/test/old/test-short-keyword.c
new file mode 100644
index 0000000..b3baa2c
--- /dev/null
+++ b/test/old/test-short-keyword.c
@@ -0,0 +1,76 @@
+#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;
+}