summaryrefslogtreecommitdiff
path: root/test/test-short-keyword.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test-short-keyword.c')
-rw-r--r--test/test-short-keyword.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/test-short-keyword.c b/test/test-short-keyword.c
new file mode 100644
index 0000000..50d44d3
--- /dev/null
+++ b/test/test-short-keyword.c
@@ -0,0 +1,52 @@
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "gate.h"
+#include "parser.h"
+
+char *failures[] = {
+ "input\n",
+ "input \n",
+};
+
+char *passes[] = {
+ "input a\n",
+ "input aaaaaaaa\n",
+ "\n",
+ "\n\n",
+ "\r",
+ "\r\r",
+ "\r\n",
+ "\n\r",
+ "\n\n\r",
+ "\r\n\r",
+};
+
+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;
+}