]> git.lizzy.rs Git - nothing.git/blobdiff - test/interpreter_suite.h
Add TODO(#1022)
[nothing.git] / test / interpreter_suite.h
index a97b851e840015f762edf6f446a9bf70257d1fa9..fb57e27dde7a2540e580cb1e4bff4decca296e56 100644 (file)
@@ -57,9 +57,9 @@ TEST(assoc_test)
     struct Expr b = SYMBOL(gc, "b");
     struct Expr c = SYMBOL(gc, "c");
 
-    struct Expr a_pair = CONS(gc, a, NUMBER(gc, 10.0f));
-    struct Expr b_pair = CONS(gc, b, NUMBER(gc, 20.0f));
-    struct Expr c_pair = CONS(gc, c, NUMBER(gc, 30.0f));
+    struct Expr a_pair = CONS(gc, a, NUMBER(gc, 10));
+    struct Expr b_pair = CONS(gc, b, NUMBER(gc, 20));
+    struct Expr c_pair = CONS(gc, c, NUMBER(gc, 30));
 
     struct Expr alist =
         CONS(gc, a_pair,
@@ -88,10 +88,10 @@ TEST(match_list_test)
     Gc *gc = create_gc();
 
     struct Expr input = list(
-        gc, 4,
-        NUMBER(gc, 42),
-        STRING(gc, "hello"),
-        SYMBOL(gc, "world"),
+        gc, "dsqe",
+        42,
+        "hello",
+        "world",
         CONS(gc, NUMBER(gc, 1), NUMBER(gc, 2)));
 
     long int d = 0;
@@ -148,12 +148,7 @@ TEST(match_list_head_tail_test)
 {
     Gc *gc = create_gc();
 
-    struct Expr input = list(
-        gc, 4,
-        NUMBER(gc, 1),
-        NUMBER(gc, 2),
-        NUMBER(gc, 3),
-        NUMBER(gc, 4));
+    struct Expr input = list(gc, "dddd", 1, 2, 3, 4);
 
     long int x = 0;
     struct Expr xs = NIL(gc);
@@ -169,7 +164,7 @@ TEST(match_list_head_tail_test)
             fprintf(stderr, "Expected: 1, Actual: %ld\n", x);
     });
 
-    ASSERT_TRUE(equal(xs, list(gc, 3, NUMBER(gc, 2), NUMBER(gc, 3), NUMBER(gc, 4))), {
+    ASSERT_TRUE(equal(xs, list(gc, "ddd", 2, 3, 4)), {
             fprintf(stderr, "Expected: (2 3 4), Actual: ");
             print_expr_as_sexpr(stderr, xs);
             fprintf(stderr, "\n");
@@ -185,11 +180,7 @@ TEST(match_list_wildcard_test)
     Gc *gc = create_gc();
 
     struct Expr input = list(
-        gc, 4,
-        NUMBER(gc, 1),
-        NUMBER(gc, 2),
-        NUMBER(gc, 3),
-        NUMBER(gc, 4));
+        gc, "dddd", 1, 2, 3, 4);
 
     long int x = 0, y = 0;
     struct EvalResult result = match_list(gc, "dddd", input, &x, NULL, &y, NULL);
@@ -211,7 +202,7 @@ TEST(match_list_singleton_tail_test)
 {
     Gc *gc = create_gc();
 
-    struct Expr input = list(gc, 4, NUMBER(gc, 1));
+    struct Expr input = list(gc, "d", 1);
     long int x;
     struct Expr xs = NIL(gc);
     struct EvalResult res = match_list(gc, "d*", input, &x, &xs);
@@ -242,8 +233,7 @@ TEST_SUITE(interpreter_suite)
     TEST_RUN(match_list_empty_list_test);
     TEST_RUN(match_list_head_tail_test);
     TEST_RUN(match_list_wildcard_test);
-    // TODO(#545): should we support matching the NIL at the end of the list? (match_list_singleton_tail_test)
-    TEST_IGNORE(match_list_singleton_tail_test);
+    TEST_RUN(match_list_singleton_tail_test);
 
     return 0;
 }