Commit 491fda11a89617a2b7425458111eecf0903c2fdb

Thomas de Grivel 2023-02-02T20:23:00

test

diff --git a/test/sym_test.c b/test/sym_test.c
index 8531034..b966e2e 100644
--- a/test/sym_test.c
+++ b/test/sym_test.c
@@ -18,18 +18,30 @@
 #include "../libc3/sym.h"
 #include "test.h"
 
-const s_sym * sym_test_1_test (const s8 *p)
+#define SYM_TEST_INSPECT(test, result)                                 \
+  do {                                                                 \
+    const s_sym *sym;                                                  \
+    s_str str;                                                         \
+    assert(test);                                                      \
+    assert(result);                                                    \
+    test_context("sym_inspect(" # test ") -> " # result);              \
+    sym = sym_1(test);                                                 \
+    TEST_EQ(sym_inspect(sym, &str), &str);                             \
+    TEST_STRNCMP(str.ptr.p, (result), str.size);                       \
+    str_clean(&str);                                                   \
+    test_context(NULL);                                                \
+  } while (0)
+
+void          sym_test_1 ();
+const s_sym * sym_test_1_test (const s8 *p);
+void          sym_test_inspect ();
+
+
+void sym_test ()
 {
-  uw len;
-  const s_sym *sym;
-  len = strlen(p);
-  TEST_ASSERT((sym = sym_1(p)));
-  TEST_EQ(sym->str.size, len);
-  TEST_EQ(strncmp(p, sym->str.ptr.p, len), 0);
-  TEST_EQ(sym_1(p), sym_1(p));
-  return sym;
+  sym_test_1();
+  sym_test_inspect();
 }
-
 void sym_test_1 ()
 {
   const s_sym *mod;
@@ -81,26 +93,18 @@ void sym_test_1 ()
   sym_test_1_test("éoà \n\r\t\v\"");
 }
 
-void sym_test_delete_all ()
+const s_sym * sym_test_1_test (const s8 *p)
 {
-  sym_delete_all();
-  test_ok();
+  uw len;
+  const s_sym *sym;
+  len = strlen(p);
+  TEST_ASSERT((sym = sym_1(p)));
+  TEST_EQ(sym->str.size, len);
+  TEST_EQ(strncmp(p, sym->str.ptr.p, len), 0);
+  TEST_EQ(sym_1(p), sym_1(p));
+  return sym;
 }
 
-#define SYM_TEST_INSPECT(test, result)                                 \
-  do {                                                                 \
-    const s_sym *sym;                                                  \
-    s_str str;                                                         \
-    assert(test);                                                      \
-    assert(result);                                                    \
-    test_context("sym_inspect(" # test ") -> " # result);              \
-    sym = sym_1(test);                                                 \
-    TEST_EQ(sym_inspect(sym, &str), &str);                             \
-    TEST_STRNCMP(str.ptr.p, (result), str.size);                       \
-    str_clean(&str);                                                   \
-    test_context(NULL);                                                \
-  } while (0)
-
 void sym_test_inspect ()
 {
   SYM_TEST_INSPECT("", ":\"\"");
@@ -138,12 +142,3 @@ void sym_test_inspect ()
   SYM_TEST_INSPECT("éoà \n\r\t\v\"",
                    ":\"éoà \\n\\r\\t\\v\\\"\"");
 }
-
-void sym_test ()
-{
-  sym_test_delete_all();
-  sym_test_1();
-  sym_test_delete_all();
-  sym_test_inspect();
-  sym_test_delete_all();
-}
diff --git a/test/tuple_test.c b/test/tuple_test.c
index 0d8e08e..4e45272 100644
--- a/test/tuple_test.c
+++ b/test/tuple_test.c
@@ -114,32 +114,32 @@ void tuple_test_init_clean ()
 
 void tuple_test_init_1 ()
 {
-  TUPLE_TEST_INIT_1("{a, b}");
-  TUPLE_TEST_INIT_1("{a, b, c}");
-  TUPLE_TEST_INIT_1("{a, b, c, d}");
-  TUPLE_TEST_INIT_1("{{a, b}, {c, d}}");
-  TUPLE_TEST_INIT_1("{{a, b}, {c, d}, {e, f}}");
-  TUPLE_TEST_INIT_1("{{a, b}, {c, d}, {e, f}, {g, h}}");
-  TUPLE_TEST_INIT_1("{{a, b}, {c, d}, {e, f}, {g, h}, {i, j}}");
+  TUPLE_TEST_INIT_1("{:a, :b}");
+  TUPLE_TEST_INIT_1("{:a, :b, :c}");
+  TUPLE_TEST_INIT_1("{:a, :b, :c, :d}");
+  TUPLE_TEST_INIT_1("{:{:a, :b}, :{:c, :d}}");
+  TUPLE_TEST_INIT_1("{:{:a, :b}, :{:c, :d}, :{:e, :f}}");
+  TUPLE_TEST_INIT_1("{:{:a, :b}, :{:c, :d}, :{:e, :f}, :{:g, :h}}");
+  TUPLE_TEST_INIT_1("{:{:a, :b}, :{:c, :d}, :{:e, :f}, :{:g, :h}, :{:i, :j}}");
 }
 
 void tuple_test_inspect ()
 {
-  TUPLE_TEST_INSPECT("{a, b}", "{a, b}");
-  TUPLE_TEST_INSPECT("{{a, b}, {c, d}}", "{{a, b}, {c, d}}");
-  TUPLE_TEST_INSPECT("{{a, b}, {c, d}, {e, f}}",
-                     "{{a, b}, {c, d}, {e, f}}");
+  TUPLE_TEST_INSPECT("{:a, :b}", "{:a, :b}");
+  TUPLE_TEST_INSPECT("{{:a, :b}, {:c, :d}}", "{{:a, :b}, {:c, :d}}");
+  TUPLE_TEST_INSPECT("{{:a, :b}, {:c, :d}, {:e, :f}}",
+                     "{{:a, :b}, {:c, :d}, {:e, :f}}");
 }
 
 void tuple_test_new_1 ()
 {
-  TUPLE_TEST_NEW_1("{a, b}");
-  TUPLE_TEST_NEW_1("{a, b, c}");
-  TUPLE_TEST_NEW_1("{a, b, c, d}");
-  TUPLE_TEST_NEW_1("{{a, b}, {c, d}}");
-  TUPLE_TEST_NEW_1("{{a, b}, {c, d}, {e, f}}");
-  TUPLE_TEST_NEW_1("{{a, b}, {c, d}, {e, f}, {g, h}}");
-  TUPLE_TEST_NEW_1("{{a, b}, {c, d}, {e, f}, {g, h}, {i, j}}");
+  TUPLE_TEST_NEW_1("{:a, :b}");
+  TUPLE_TEST_NEW_1("{:a, :b, :c}");
+  TUPLE_TEST_NEW_1("{:a, :b, :c, :d}");
+  TUPLE_TEST_NEW_1("{:{:a, :b}, :{:c, :d}}");
+  TUPLE_TEST_NEW_1("{:{:a, :b}, :{:c, :d}, :{:e, :f}}");
+  TUPLE_TEST_NEW_1("{:{:a, :b}, :{:c, :d}, :{:e, :f}, :{:g, :h}}");
+  TUPLE_TEST_NEW_1("{:{:a, :b}, :{:c, :d}, :{:e, :f}, :{:g, :h}, :{:i, :j}}");
 }
 
 void tuple_test_new_delete ()