Commit 50005e4c35572350342072d4d1e971ed3df7eed2

Thomas de Grivel 2024-07-22T13:21:56

test: move sym_inspect and tag_inspect to inspect_*

diff --git a/test/inspect_test.c b/test/inspect_test.c
index eb059f6..fb8f78b 100644
--- a/test/inspect_test.c
+++ b/test/inspect_test.c
@@ -11,7 +11,10 @@
  * THIS SOFTWARE.
  */
 #include <assert.h>
+#include <string.h>
 #include "../libkc3/inspect.h"
+#include "../libkc3/str.h"
+#include "../libkc3/sym.h"
 #include "test.h"
 
 #define INSPECT_TEST_SYM(test, result)                                 \
diff --git a/test/libkc3_test.c b/test/libkc3_test.c
index 7055cd6..3d2bcca 100644
--- a/test/libkc3_test.c
+++ b/test/libkc3_test.c
@@ -29,6 +29,7 @@ void facts_cursor_test (void);
 void facts_with_test (void);
 void fn_test (void);
 void ident_test (void);
+void inspect_test (void);
 void list_test (void);
 void set__fact_test (void);
 void set__tag_test (void);
@@ -108,6 +109,10 @@ int main (int argc, char **argv)
     fprintf(stderr, "\ntag\n");
     tag_test();
   }
+  if (test_target("inspect")) {
+    fprintf(stderr, "\ninspect\n");
+    inspect_test();
+  }
   if (test_target("fact")) {
     fprintf(stderr, "\nfact\n");
     fact_test();
diff --git a/test/sym_test.c b/test/sym_test.c
index ac0559a..d98a431 100644
--- a/test/sym_test.c
+++ b/test/sym_test.c
@@ -25,20 +25,6 @@
     TEST_EQ(sym_1(test), sym_1(test));                                 \
   } while (0)
 
-#define INSPECT_TEST_SYM(test, result)                                 \
-  do {                                                                 \
-    const s_sym *sym;                                                  \
-    s_str str;                                                         \
-    assert(test);                                                      \
-    assert(result);                                                    \
-    test_context("inspect_sym(" # test ") -> " # result);              \
-    sym = sym_1(test);                                                 \
-    TEST_EQ(inspect_sym(sym, &str), &str);                             \
-    TEST_STRNCMP(str.ptr.p, (result), str.size);                       \
-    str_clean(&str);                                                   \
-    test_context(NULL);                                                \
-  } while (0)
-
 TEST_CASE_PROTOTYPE(sym_1);
 const s_sym * sym_test_1_test (const s8 *p);