diff --git a/libkc3/buf.c b/libkc3/buf.c
index 5a26cf7..7b41eca 100644
--- a/libkc3/buf.c
+++ b/libkc3/buf.c
@@ -17,6 +17,7 @@
#include "buf_save.h"
#include "character.h"
#include "error.h"
+#include "pretty.h"
#include "ratio.h"
#include "str.h"
#include "sym.h"
@@ -1141,6 +1142,13 @@ sw buf_write_1 (s_buf *buf, const char *p)
return buf_write_str(buf, &str);
}
+sw buf_write_1_size (s_pretty *pretty, const char *p)
+{
+ s_str str;
+ str_init_1(&str, NULL, p);
+ return buf_write_str_size(pretty, &str);
+}
+
sw buf_write_character_utf8 (s_buf *buf, character c)
{
sw size = character_utf8_size(c);
@@ -1294,6 +1302,31 @@ sw buf_write_str_memcpy (s_buf *buf, const s_str *src)
return src->size;
}
+sw buf_write_str_size (s_pretty *pretty, const s_str *src)
+{
+ character c;
+ uw i;
+ sw r;
+ sw result = 0;
+ s_str s;
+ assert(pretty);
+ assert(src);
+ s = *src;
+ while ((r = str_read_character_utf8(&s, &c)) > 0) {
+ if ((r = character_utf8_size(c)) < 0)
+ return r;
+ result += r;
+ if (c == '\n') {
+ i = 0;
+ while (i < pretty->base_column) {
+ result++;
+ i++;
+ }
+ }
+ }
+ return result;
+}
+
sw buf_write_u8 (s_buf *buf, u8 x)
{
const sw size = 1;
diff --git a/libkc3/buf.h b/libkc3/buf.h
index a0a4a58..4fe19f0 100644
--- a/libkc3/buf.h
+++ b/libkc3/buf.h
@@ -110,8 +110,8 @@ sw buf_write_s8 (s_buf *buf, s8 i);
sw buf_write_s16 (s_buf *buf, s16 i);
sw buf_write_s32 (s_buf *buf, s32 i);
sw buf_write_s64 (s_buf *buf, s64 i);
-sw buf_write_str_memcpy (s_buf *buf, const s_str *src);
sw buf_write_str (s_buf *buf, const s_str *src);
+sw buf_write_str_memcpy (s_buf *buf, const s_str *src);
sw buf_write_str_size (s_pretty *pretty, const s_str *src);
sw buf_write_u8 (s_buf *buf, u8 i);
sw buf_write_u16 (s_buf *buf, u16 i);
diff --git a/libkc3/buf_inspect.c b/libkc3/buf_inspect.c
index 03a9c65..adf6e4c 100644
--- a/libkc3/buf_inspect.c
+++ b/libkc3/buf_inspect.c
@@ -341,6 +341,43 @@ sw buf_inspect_block_inner (s_buf *buf, const s_block *block)
return result;
}
+sw buf_inspect_block_inner_size (s_pretty *pretty, const s_block *block)
+{
+ u64 i = 0;
+ sw r;
+ sw result = 0;
+ if (! block->count)
+ return 0;
+ if (block->short_form) {
+ if ((r = buf_write_1_size(pretty, " ")) < 0)
+ return r;
+ }
+ else {
+ if ((r = buf_write_1_size(pretty, "\n")) < 0)
+ return r;
+ }
+ result += r;
+ while (i < block->count - 1) {
+ if ((r = buf_inspect_tag_size(pretty, block->tag + i)) < 0)
+ return r;
+ result += r;
+ if (block->short_form) {
+ if ((r = buf_write_1_size(pretty, "; ")) < 0)
+ return r;
+ }
+ else {
+ if ((r = buf_write_1_size(pretty, "\n")) < 0)
+ return r;
+ }
+ result += r;
+ i++;
+ }
+ if ((r = buf_inspect_tag_size(pretty, block->tag + i)) < 0)
+ return r;
+ result += r;
+ return result;
+}
+
sw buf_inspect_block_size (s_pretty *pretty, const s_block *block)
{
s_pretty pretty_save;
@@ -958,6 +995,24 @@ sw buf_inspect_call_paren (s_buf *buf, const s_call *call)
return result;
}
+sw buf_inspect_call_paren_size (s_pretty *pretty, const s_call *call)
+{
+ sw r;
+ sw result = 0;
+ assert(pretty);
+ assert(call);
+ if ((r = buf_write_1_size(pretty, "(")) < 0)
+ return r;
+ result += r;
+ if ((r = buf_inspect_tag_size(pretty, &call->arguments->tag)) < 0)
+ return r;
+ result += r;
+ if ((r = buf_write_1_size(pretty, ")")) < 0)
+ return r;
+ result += r;
+ return result;
+}
+
sw buf_inspect_call_size (s_pretty *pretty, const s_call *call)
{
bool b;
diff --git a/libkc3/buf_inspect_s16_binary.h b/libkc3/buf_inspect_s16_binary.h
index 3c46785..de09ecc 100644
--- a/libkc3/buf_inspect_s16_binary.h
+++ b/libkc3/buf_inspect_s16_binary.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_s16_binary (s_buf *buf, const s16 *s);
-sw buf_inspect_s16_binary_size (const s16 *s);
+sw buf_inspect_s16_binary_size (s_pretty *pretty, const s16 *s);
#endif /* LIBKC3_BUF_INSPECT_S16_binary_H */
diff --git a/libkc3/buf_inspect_s16_hexadecimal.h b/libkc3/buf_inspect_s16_hexadecimal.h
index 341b34f..2029be0 100644
--- a/libkc3/buf_inspect_s16_hexadecimal.h
+++ b/libkc3/buf_inspect_s16_hexadecimal.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_s16_hexadecimal (s_buf *buf, const s16 *s);
-sw buf_inspect_s16_hexadecimal_size (const s16 *s);
+sw buf_inspect_s16_hexadecimal_size (s_pretty *pretty, const s16 *s);
#endif /* LIBKC3_BUF_INSPECT_S16_hexadecimal_H */
diff --git a/libkc3/buf_inspect_s16_octal.h b/libkc3/buf_inspect_s16_octal.h
index a452466..fcfe988 100644
--- a/libkc3/buf_inspect_s16_octal.h
+++ b/libkc3/buf_inspect_s16_octal.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_s16_octal (s_buf *buf, const s16 *s);
-sw buf_inspect_s16_octal_size (const s16 *s);
+sw buf_inspect_s16_octal_size (s_pretty *pretty, const s16 *s);
#endif /* LIBKC3_BUF_INSPECT_S16_octal_H */
diff --git a/libkc3/buf_inspect_s32_binary.h b/libkc3/buf_inspect_s32_binary.h
index 8739457..035e23b 100644
--- a/libkc3/buf_inspect_s32_binary.h
+++ b/libkc3/buf_inspect_s32_binary.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_s32_binary (s_buf *buf, const s32 *s);
-sw buf_inspect_s32_binary_size (const s32 *s);
+sw buf_inspect_s32_binary_size (s_pretty *pretty, const s32 *s);
#endif /* LIBKC3_BUF_INSPECT_S32_binary_H */
diff --git a/libkc3/buf_inspect_s32_hexadecimal.h b/libkc3/buf_inspect_s32_hexadecimal.h
index 3f7cfde..2f69bea 100644
--- a/libkc3/buf_inspect_s32_hexadecimal.h
+++ b/libkc3/buf_inspect_s32_hexadecimal.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_s32_hexadecimal (s_buf *buf, const s32 *s);
-sw buf_inspect_s32_hexadecimal_size (const s32 *s);
+sw buf_inspect_s32_hexadecimal_size (s_pretty *pretty, const s32 *s);
#endif /* LIBKC3_BUF_INSPECT_S32_hexadecimal_H */
diff --git a/libkc3/buf_inspect_s32_octal.h b/libkc3/buf_inspect_s32_octal.h
index a6cd2f2..9ce4230 100644
--- a/libkc3/buf_inspect_s32_octal.h
+++ b/libkc3/buf_inspect_s32_octal.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_s32_octal (s_buf *buf, const s32 *s);
-sw buf_inspect_s32_octal_size (const s32 *s);
+sw buf_inspect_s32_octal_size (s_pretty *pretty, const s32 *s);
#endif /* LIBKC3_BUF_INSPECT_S32_octal_H */
diff --git a/libkc3/buf_inspect_s64_binary.h b/libkc3/buf_inspect_s64_binary.h
index bc5b87c..2ccb3c9 100644
--- a/libkc3/buf_inspect_s64_binary.h
+++ b/libkc3/buf_inspect_s64_binary.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_s64_binary (s_buf *buf, const s64 *s);
-sw buf_inspect_s64_binary_size (const s64 *s);
+sw buf_inspect_s64_binary_size (s_pretty *pretty, const s64 *s);
#endif /* LIBKC3_BUF_INSPECT_S64_binary_H */
diff --git a/libkc3/buf_inspect_s64_hexadecimal.h b/libkc3/buf_inspect_s64_hexadecimal.h
index c8893b9..60de106 100644
--- a/libkc3/buf_inspect_s64_hexadecimal.h
+++ b/libkc3/buf_inspect_s64_hexadecimal.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_s64_hexadecimal (s_buf *buf, const s64 *s);
-sw buf_inspect_s64_hexadecimal_size (const s64 *s);
+sw buf_inspect_s64_hexadecimal_size (s_pretty *pretty, const s64 *s);
#endif /* LIBKC3_BUF_INSPECT_S64_hexadecimal_H */
diff --git a/libkc3/buf_inspect_s64_octal.h b/libkc3/buf_inspect_s64_octal.h
index d89dc9f..c0389af 100644
--- a/libkc3/buf_inspect_s64_octal.h
+++ b/libkc3/buf_inspect_s64_octal.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_s64_octal (s_buf *buf, const s64 *s);
-sw buf_inspect_s64_octal_size (const s64 *s);
+sw buf_inspect_s64_octal_size (s_pretty *pretty, const s64 *s);
#endif /* LIBKC3_BUF_INSPECT_S64_octal_H */
diff --git a/libkc3/buf_inspect_s8_binary.h b/libkc3/buf_inspect_s8_binary.h
index 7daf68a..19b62b6 100644
--- a/libkc3/buf_inspect_s8_binary.h
+++ b/libkc3/buf_inspect_s8_binary.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_s8_binary (s_buf *buf, const s8 *s);
-sw buf_inspect_s8_binary_size (const s8 *s);
+sw buf_inspect_s8_binary_size (s_pretty *pretty, const s8 *s);
#endif /* LIBKC3_BUF_INSPECT_S8_binary_H */
diff --git a/libkc3/buf_inspect_s8_hexadecimal.h b/libkc3/buf_inspect_s8_hexadecimal.h
index 1106951..9278f30 100644
--- a/libkc3/buf_inspect_s8_hexadecimal.h
+++ b/libkc3/buf_inspect_s8_hexadecimal.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_s8_hexadecimal (s_buf *buf, const s8 *s);
-sw buf_inspect_s8_hexadecimal_size (const s8 *s);
+sw buf_inspect_s8_hexadecimal_size (s_pretty *pretty, const s8 *s);
#endif /* LIBKC3_BUF_INSPECT_S8_hexadecimal_H */
diff --git a/libkc3/buf_inspect_s8_octal.h b/libkc3/buf_inspect_s8_octal.h
index f6b8eb2..9315b34 100644
--- a/libkc3/buf_inspect_s8_octal.h
+++ b/libkc3/buf_inspect_s8_octal.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_s8_octal (s_buf *buf, const s8 *s);
-sw buf_inspect_s8_octal_size (const s8 *s);
+sw buf_inspect_s8_octal_size (s_pretty *pretty, const s8 *s);
#endif /* LIBKC3_BUF_INSPECT_S8_octal_H */
diff --git a/libkc3/buf_inspect_sw_binary.h b/libkc3/buf_inspect_sw_binary.h
index 79b41dd..548079e 100644
--- a/libkc3/buf_inspect_sw_binary.h
+++ b/libkc3/buf_inspect_sw_binary.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_sw_binary (s_buf *buf, const sw *s);
-sw buf_inspect_sw_binary_size (const sw *s);
+sw buf_inspect_sw_binary_size (s_pretty *pretty, const sw *s);
#endif /* LIBKC3_BUF_INSPECT_SW_binary_H */
diff --git a/libkc3/buf_inspect_sw_hexadecimal.h b/libkc3/buf_inspect_sw_hexadecimal.h
index 491913f..6987709 100644
--- a/libkc3/buf_inspect_sw_hexadecimal.h
+++ b/libkc3/buf_inspect_sw_hexadecimal.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_sw_hexadecimal (s_buf *buf, const sw *s);
-sw buf_inspect_sw_hexadecimal_size (const sw *s);
+sw buf_inspect_sw_hexadecimal_size (s_pretty *pretty, const sw *s);
#endif /* LIBKC3_BUF_INSPECT_SW_hexadecimal_H */
diff --git a/libkc3/buf_inspect_sw_octal.h b/libkc3/buf_inspect_sw_octal.h
index 00a1686..5b604b6 100644
--- a/libkc3/buf_inspect_sw_octal.h
+++ b/libkc3/buf_inspect_sw_octal.h
@@ -17,6 +17,6 @@
#include "types.h"
sw buf_inspect_sw_octal (s_buf *buf, const sw *s);
-sw buf_inspect_sw_octal_size (const sw *s);
+sw buf_inspect_sw_octal_size (s_pretty *pretty, const sw *s);
#endif /* LIBKC3_BUF_INSPECT_SW_octal_H */
diff --git a/libkc3/call.h b/libkc3/call.h
index f1730c4..2ecfe15 100644
--- a/libkc3/call.h
+++ b/libkc3/call.h
@@ -29,7 +29,4 @@ s_call * call_init_op_unary (s_call *call);
/* Modifiers */
bool call_get (s_call *call);
-/* Observers */
-s_str * call_inspect (const s_call *call, s_str *dest);
-
#endif /* LIBKC3_CALL_H */
diff --git a/libkc3/fact.h b/libkc3/fact.h
index 90721bc..807296b 100644
--- a/libkc3/fact.h
+++ b/libkc3/fact.h
@@ -26,7 +26,6 @@ void fact_w_clean (s_fact_w *fact);
/* Observers */
uw * fact_hash_uw (const s_fact *fact, uw *dest);
-s_str * fact_inspect (const s_fact *fact, s_str *dest);
void fact_r (const s_fact_w *fact, s_fact *dest);
/* Operators */
diff --git a/libkc3/ident.h b/libkc3/ident.h
index 0abd513..03b03be 100644
--- a/libkc3/ident.h
+++ b/libkc3/ident.h
@@ -34,7 +34,6 @@ s_ident * ident_resolve_module (const s_ident *ident, s_ident *dest);
bool ident_character_is_reserved (character c);
bool ident_first_character_is_reserved (character c);
s_tag * ident_get (const s_ident *ident, s_tag *dest);
-s_str * ident_inspect (const s_ident *ident, s_str *dest);
bool * ident_is_special_operator (const s_ident *ident, bool *dest);
bool ident_to_tag_type (const s_ident *ident, e_tag_type *dest);
diff --git a/libkc3/inspect.h b/libkc3/inspect.h
index 78b54db..6934c43 100644
--- a/libkc3/inspect.h
+++ b/libkc3/inspect.h
@@ -24,7 +24,14 @@
s_str * inspect_array (const s_array *array, s_str *dest);
s_str * inspect_block (const s_block *block, s_str *dest);
s_str * inspect_bool (bool *b, s_str *dest);
+s_str * inspect_call (const s_call *call, s_str *dest);
+s_str * inspect_fact (const s_fact *fact, s_str *dest);
+s_str * inspect_ident (const s_ident *ident, s_str *dest);
+s_str * inspect_list (const s_list *list, s_str *dest);
+s_str * inspect_ratio (const s_ratio *src, s_str *dest);
+s_str * inspect_str (const s_str *str, s_str *dest);
s_str * inspect_sym (const s_sym *sym, s_str *dest);
s_str * inspect_tag (const s_tag *tag, s_str *dest);
+s_str * inspect_tuple (const s_tuple *tuple, s_str *dest);
#endif /* LIBKC3_INSPECT_H */
diff --git a/libkc3/list.h b/libkc3/list.h
index 33693ed..cd66e87 100644
--- a/libkc3/list.h
+++ b/libkc3/list.h
@@ -58,7 +58,6 @@ s_list * list_next (const s_list *list);
s_array * list_to_array (const s_list *list, const s_sym *type,
s_array *dest);
s_tuple * list_to_tuple_reverse (const s_list *list, s_tuple *dest);
-s_str * list_inspect (const s_list *list, s_str *dest);
/* Operators */
s_list ** list_remove_void (s_list **list);
diff --git a/libkc3/ratio.h b/libkc3/ratio.h
index 67471bc..b1fa802 100644
--- a/libkc3/ratio.h
+++ b/libkc3/ratio.h
@@ -46,7 +46,6 @@ s_ratio * ratio_new (void);
s_ratio * ratio_new_copy (const s_ratio *src);
/* Observers. */
-s_str * ratio_inspect (const s_ratio *src, s_str *dest);
bool ratio_is_negative (const s_ratio *r);
bool ratio_is_zero (const s_ratio *r);
f32 ratio_to_f32 (const s_ratio *r);
diff --git a/libkc3/str.h b/libkc3/str.h
index cc95626..067a339 100644
--- a/libkc3/str.h
+++ b/libkc3/str.h
@@ -95,7 +95,6 @@ sw str_character_position (const s_str *str, character c);
bool str_ends_with (const s_str *str, const s_str *end);
bool * str_has_reserved_characters (const s_str *src,
bool *dest);
-s_str * str_inspect (const s_str *str, s_str *dest);
sw str_length_utf8 (const s_str *str);
bool str_parse_eval (const s_str *str, s_tag *dest);
sw str_peek_bool (const s_str *str, bool *dest);
diff --git a/libkc3/tuple.h b/libkc3/tuple.h
index 7b669ec..a372716 100644
--- a/libkc3/tuple.h
+++ b/libkc3/tuple.h
@@ -43,6 +43,5 @@ s_tuple * tuple_1 (s_tuple *tuple, const char *p);
/* Observers */
s_list * tuple_to_list (const s_tuple *tuple, s_list **list);
-s_str * tuple_inspect (const s_tuple *x, s_str *dest);
#endif /* LIBKC3_TUPLE_H */
diff --git a/test/array_test.c b/test/array_test.c
index 372d7d1..0a2d878 100644
--- a/test/array_test.c
+++ b/test/array_test.c
@@ -30,30 +30,16 @@
array_clean(&a); \
} while(0)
-#define ARRAY_TEST_INSPECT(test, expected) \
- do { \
- s_str str; \
- s_array tmp; \
- test_context("array_inspect(" # test ") -> " # expected); \
- TEST_EQ(array_init_1(&tmp, (test)), &tmp); \
- TEST_EQ(array_inspect(&tmp, &str), &str); \
- TEST_STRNCMP(str.ptr.p, (expected), str.size); \
- array_clean(&tmp); \
- str_clean(&str); \
- } while(0)
-
void array_test (void);
TEST_CASE_PROTOTYPE(array_data);
TEST_CASE_PROTOTYPE(array_init_clean);
TEST_CASE_PROTOTYPE(array_init_1_clean);
-TEST_CASE_PROTOTYPE(array_inspect);
void array_test (void)
{
TEST_CASE_RUN(array_init_clean);
TEST_CASE_RUN(array_init_1_clean);
TEST_CASE_RUN(array_data);
- TEST_CASE_RUN(array_inspect);
}
TEST_CASE(array_data)
@@ -97,42 +83,3 @@ TEST_CASE(array_init_1_clean)
ARRAY_TEST_INIT_1_CLEAN("(U8[]) {{{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}}");
}
TEST_CASE_END(array_init_1_clean)
-
-TEST_CASE(array_inspect)
-{
- ARRAY_TEST_INSPECT("(U8[]) {0}",
- "(U8[]) {0}");
- ARRAY_TEST_INSPECT("(U8[]) {0, 0}",
- "(U8[]) {0, 0}");
- ARRAY_TEST_INSPECT("(U8[]) {0, 0, 0}",
- "(U8[]) {0, 0, 0}");
- ARRAY_TEST_INSPECT("(U8[]) {{0}, {0}}",
- "(U8[]) {{0}, {0}}");
- ARRAY_TEST_INSPECT("(U8[]) {{0, 0}, {0, 0}}",
- "(U8[]) {{0, 0}, {0, 0}}");
- ARRAY_TEST_INSPECT("(U8[]) {{0, 0}, {0, 0}, {0, 0}}",
- "(U8[]) {{0, 0}, {0, 0}, {0, 0}}");
- ARRAY_TEST_INSPECT("(U8[]) {{{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}}",
- "(U8[]) {{{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}}");
- ARRAY_TEST_INSPECT("(U8[]) {1, 2, 3}",
- "(U8[]) {1, 2, 3}");
- ARRAY_TEST_INSPECT("(U8[]) {1 + 1, 2 + 2, 3 + 3}",
- "(U8[]) {2, 4, 6}");
- ARRAY_TEST_INSPECT("(U8[]) {255 + 1, 255 + 2, 255 + 3}",
- "(U8[]) {0, 1, 2}");
- ARRAY_TEST_INSPECT("(U16[]) {255 + 1, 255 + 2, 255 + 3}",
- "(U16[]) {256, 257, 258}");
- ARRAY_TEST_INSPECT("(U16[]) {65535 + 1, 65535 + 2, 65535 + 3}",
- "(U16[]) {0, 1, 2}");
- ARRAY_TEST_INSPECT("(U32[]) {65535 + 1, 65535 + 2, 65535 + 3}",
- "(U32[]) {65536, 65537, 65538}");
- ARRAY_TEST_INSPECT("(U32[]) {4294967295 + 1, 4294967295 + 2, 4294967295 + 3}",
- "(U32[]) {0, 1, 2}");
- ARRAY_TEST_INSPECT("(U64[]) {4294967295 + 1, 4294967295 + 2, 4294967295 + 3}",
- "(U64[]) {4294967296, 4294967297, 4294967298}");
- ARRAY_TEST_INSPECT("(U64[]) {18446744073709551615 + 1, 18446744073709551615 + 2, 18446744073709551615 + 3}",
- "(U64[]) {0, 1, 2}");
- ARRAY_TEST_INSPECT("(Integer[]) {18446744073709551615 + 1, 18446744073709551615 + 2, 18446744073709551615 + 3}",
- "(Integer[]) {18446744073709551616, 18446744073709551617, 18446744073709551618}");
-}
-TEST_CASE_END(array_inspect)
diff --git a/test/bool_test.c b/test/bool_test.c
index f80c3c9..ba1a2a4 100644
--- a/test/bool_test.c
+++ b/test/bool_test.c
@@ -15,27 +15,12 @@
#include "../libkc3/str.h"
#include "test.h"
-#define BOOL_TEST_INSPECT(test, expected) \
- do { \
- s_str str; \
- bool tmp; \
- test_context("bool_inspect(" # test ") -> " # expected); \
- tmp = (test); \
- TEST_EQ(bool_inspect(&tmp, &str), &str); \
- TEST_EQ(str.size, strlen(expected)); \
- TEST_STRNCMP(str.ptr.p, (expected), str.size); \
- str_clean(&str); \
- test_context(NULL); \
- } while (0)
-
void bool_test (void);
TEST_CASE_PROTOTYPE(bool_compat);
-TEST_CASE_PROTOTYPE(bool_inspect);
void bool_test (void)
{
TEST_CASE_RUN(bool_compat);
- TEST_CASE_RUN(bool_inspect);
}
TEST_CASE(bool_compat)
@@ -48,10 +33,3 @@ TEST_CASE(bool_compat)
TEST_ASSERT(! (bool) false);
}
TEST_CASE_END(bool_compat)
-
-TEST_CASE(bool_inspect)
-{
- BOOL_TEST_INSPECT(true, "true");
- BOOL_TEST_INSPECT(false, "false");
-}
-TEST_CASE_END(bool_inspect)
diff --git a/test/buf_inspect_test.c b/test/buf_inspect_test.c
index 6bea34f..fdc860d 100644
--- a/test/buf_inspect_test.c
+++ b/test/buf_inspect_test.c
@@ -19,11 +19,12 @@
do { \
char b[1024]; \
s_buf buf_result; \
+ s_pretty pretty = {0}; \
s_array tmp; \
test_context("buf_inspect_array(" # test ") -> " # expected); \
array_init_1(&tmp, (test)); \
buf_init(&buf_result, false, sizeof(b), b); \
- TEST_EQ(buf_inspect_array_size(&tmp), strlen(expected)); \
+ TEST_EQ(buf_inspect_array_size(&pretty, &tmp), strlen(expected)); \
TEST_EQ(buf_inspect_array(&buf_result, &tmp), strlen(expected)); \
TEST_EQ(buf_result.wpos, strlen(expected)); \
TEST_STRNCMP(buf_result.ptr.pchar, (expected), buf_result.wpos); \
@@ -35,11 +36,12 @@
do { \
char b[16]; \
s_buf buf; \
+ s_pretty pretty = {0}; \
bool tmp; \
test_context("buf_inspect_bool(" # test ") -> " # expected); \
buf_init(&buf, false, sizeof(b), b); \
tmp = (test); \
- TEST_EQ(buf_inspect_bool_size(&tmp), strlen(expected)); \
+ TEST_EQ(buf_inspect_bool_size(&pretty, &tmp), strlen(expected)); \
TEST_EQ(buf_inspect_bool(&buf, &tmp), strlen(expected)); \
TEST_STRNCMP(buf.ptr.p, (expected), buf.wpos); \
test_context(NULL); \
@@ -49,11 +51,13 @@
do { \
char b[32]; \
s_buf buf; \
+ s_pretty pretty = {0}; \
character tmp; \
test_context("buf_inspect_character(" # test ") -> " # expected); \
buf_init(&buf, false, sizeof(b), b); \
tmp = (test); \
- TEST_EQ(buf_inspect_character_size(&tmp), strlen(expected)); \
+ TEST_EQ(buf_inspect_character_size(&pretty, &tmp), \
+ strlen(expected)); \
TEST_EQ(buf_inspect_character(&buf, &tmp), strlen(expected)); \
TEST_EQ(buf.wpos, strlen(expected)); \
TEST_STRNCMP(buf.ptr.pchar, (expected), buf.wpos); \
@@ -64,6 +68,7 @@
do { \
char b[32]; \
s_buf buf; \
+ s_pretty pretty = {0}; \
f32 tmp; \
test_context("buf_inspect_f32(" # test ") -> " # expected); \
tmp = (test); \
@@ -71,7 +76,7 @@
buf_inspect_f32(&buf, &tmp); \
TEST_STRNCMP(buf.ptr.pchar, (expected), buf.wpos); \
TEST_EQ(buf.wpos, strlen(expected)); \
- TEST_EQ(buf_inspect_f32_size(&tmp), strlen(expected)); \
+ TEST_EQ(buf_inspect_f32_size(&pretty, &tmp), strlen(expected)); \
buf_init(&buf, false, sizeof(b), b); \
TEST_EQ(buf_inspect_f32(&buf, &tmp), strlen(expected)); \
test_context(NULL); \
@@ -81,6 +86,7 @@
do { \
char b[64]; \
s_buf buf; \
+ s_pretty pretty = {0}; \
f64 tmp; \
test_context("buf_inspect_f64(" # test ") -> " # expected); \
tmp = (test); \
@@ -88,7 +94,7 @@
buf_inspect_f64(&buf, &tmp); \
TEST_STRNCMP(buf.ptr.pchar, (expected), buf.wpos); \
TEST_EQ(buf.wpos, strlen(expected)); \
- TEST_EQ(buf_inspect_f64_size(&tmp), strlen(expected)); \
+ TEST_EQ(buf_inspect_f64_size(&pretty, &tmp), strlen(expected)); \
buf_init(&buf, false, sizeof(b), b); \
TEST_EQ(buf_inspect_f64(&buf, &tmp), strlen(expected)); \
TEST_STRNCMP(buf.ptr.pchar, (expected), buf.wpos); \
@@ -99,11 +105,12 @@
do { \
char b[1024]; \
s_buf buf_result; \
+ s_pretty pretty = {0}; \
s_integer i; \
test_context("buf_inspect_integer(" # test ") -> " # expected); \
integer_init_1(&i, (test)); \
buf_init(&buf_result, false, sizeof(b), b); \
- TEST_EQ(buf_inspect_integer_size(&i), strlen(test)); \
+ TEST_EQ(buf_inspect_integer_size(&pretty, &i), strlen(test)); \
TEST_EQ(buf_inspect_integer(&buf_result, &i), strlen(test)); \
integer_clean(&i); \
TEST_EQ(buf_result.wpos, strlen(test)); \
@@ -115,10 +122,12 @@
do { \
s_buf buf; \
s_list *list_test; \
+ s_pretty pretty = {0}; \
test_context("buf_inspect_list(" # test ") -> " # expected); \
list_test = list_new_1(test); \
buf_init_alloc(&buf, 1024 * 1024); \
- TEST_EQ(buf_inspect_list_size((const s_list **) &list_test), \
+ TEST_EQ(buf_inspect_list_size(&pretty, \
+ (const s_list **) &list_test), \
strlen(expected)); \
TEST_EQ(buf_inspect_list(&buf, (const s_list **) &list_test), \
strlen(expected)); \
@@ -133,12 +142,13 @@
do { \
char b[1024]; \
s_buf buf; \
+ s_pretty pretty = {0}; \
s_str str; \
test_context("buf_inspect_str(" # test ") -> " # expected); \
str_init_1(&str, NULL, (test)); \
buf_init(&buf, false, sizeof(b), b); \
TEST_STRNCMP(buf.ptr.p, (expected), buf.wpos); \
- TEST_EQ(buf_inspect_str_size(&str), strlen(expected)); \
+ TEST_EQ(buf_inspect_str_size(&pretty, &str), strlen(expected)); \
TEST_EQ(buf_inspect_str(&buf, &str), strlen(expected)); \
test_context(NULL); \
} while (0)
@@ -147,12 +157,14 @@
do { \
char b[32]; \
s_buf buf; \
+ s_pretty pretty = {0}; \
character tmp; \
test_context("buf_inspect_str_character(" # test ") -> " \
# expected); \
buf_init(&buf, false, sizeof(b), b); \
tmp = (test); \
- TEST_EQ(buf_inspect_str_character_size(&tmp), strlen(expected)); \
+ TEST_EQ(buf_inspect_str_character_size(&pretty, &tmp), \
+ strlen(expected)); \
TEST_EQ(buf_inspect_str_character(&buf, &tmp), strlen(expected)); \
TEST_STRNCMP(buf.ptr.pchar, (expected), buf.wpos); \
test_context(NULL); \
@@ -161,11 +173,13 @@
#define BUF_INSPECT_TEST_TAG(test, expected) \
do { \
s_buf buf; \
+ s_pretty pretty = {0}; \
s_tag *test_tag; \
test_context("buf_inspect_tag(" # test ") -> " # expected); \
test_tag = (test); \
buf_init_alloc(&buf, strlen(expected)); \
- TEST_EQ(buf_inspect_tag_size(test_tag), strlen(expected)); \
+ TEST_EQ(buf_inspect_tag_size(&pretty, test_tag), \
+ strlen(expected)); \
TEST_EQ(buf_inspect_tag(&buf, test_tag), strlen(expected)); \
TEST_EQ(buf.wpos, strlen(expected)); \
if (g_test_last_ok) \
@@ -307,11 +321,12 @@ TEST_CASE(buf_inspect_str)
{
char b[1024];
s_buf buf;
+ s_pretty pretty = {0};
s_str str;
test_context("buf_inspect_str(\"\\0\") -> \"\\0\"");
str_init(&str, NULL, 1, "\0");
buf_init(&buf, false, sizeof(b), b);
- TEST_EQ(buf_inspect_str_size(&str), strlen("\"\\0\""));
+ TEST_EQ(buf_inspect_str_size(&pretty, &str), strlen("\"\\0\""));
TEST_EQ(buf_inspect_str(&buf, &str), strlen("\"\\0\""));
TEST_STRNCMP(buf.ptr.p, "\"\\0\"", buf.wpos);
test_context(NULL);
diff --git a/test/call_test.c b/test/call_test.c
index 96456a9..ebbd529 100644
--- a/test/call_test.c
+++ b/test/call_test.c
@@ -23,26 +23,12 @@
test_ok(); \
} while (0)
-#define CALL_TEST_INSPECT(test) \
- do { \
- s_call call; \
- s_str result; \
- TEST_EQ(call_init_1(&call, (test)), &call); \
- TEST_EQ(call_inspect(&call, &result), &result); \
- TEST_STRNCMP(result.ptr.p, (test), result.size); \
- TEST_EQ(result.size, strlen(test)); \
- call_clean(&call); \
- str_clean(&result); \
- } while (0)
-
void call_test (void);
TEST_CASE_PROTOTYPE(call_init_1);
-TEST_CASE_PROTOTYPE(call_inspect);
void call_test (void)
{
TEST_CASE_RUN(call_init_1);
- TEST_CASE_RUN(call_inspect);
}
TEST_CASE(call_init_1)
@@ -57,16 +43,3 @@ TEST_CASE(call_init_1)
CALL_TEST_INIT_1("A.b(c, d, e)");
}
TEST_CASE_END(call_init_1)
-
-TEST_CASE(call_inspect)
-{
- CALL_TEST_INSPECT("a()");
- CALL_TEST_INSPECT("a(b)");
- CALL_TEST_INSPECT("a(b, c)");
- CALL_TEST_INSPECT("a(b, c, d)");
- CALL_TEST_INSPECT("A.b()");
- CALL_TEST_INSPECT("A.b(c)");
- CALL_TEST_INSPECT("A.b(c, d)");
- CALL_TEST_INSPECT("A.b(c, d, e)");
-}
-TEST_CASE_END(call_inspect)
diff --git a/test/fact_test.c b/test/fact_test.c
index 44346c5..995f134 100644
--- a/test/fact_test.c
+++ b/test/fact_test.c
@@ -16,24 +16,12 @@
#include "fact_test.h"
#include "test.h"
-#define FACT_TEST_INSPECT(test, expected) \
- do { \
- s_str str; \
- TEST_EQ(fact_inspect(test, &str), &str); \
- TEST_EQ(str.size, strlen(expected)); \
- if (g_test_last_ok) \
- TEST_STRNCMP(str.ptr.p, (expected), str.size); \
- str_clean(&str); \
- } while (0)
-
void fact_test (void);
TEST_CASE_PROTOTYPE(fact_init);
-TEST_CASE_PROTOTYPE(fact_inspect);
void fact_test (void)
{
TEST_CASE_RUN(fact_init);
- TEST_CASE_RUN(fact_inspect);
}
void fact_test_clean_1 (s_fact *fact)
@@ -80,15 +68,3 @@ TEST_CASE(fact_init)
TEST_EQ(fact.object, sym + 2);
}
TEST_CASE_END(fact_init)
-
-TEST_CASE(fact_inspect)
-{
- s_tag tag[3];
- s_fact fact;
- tag_init_1(tag, "A");
- tag_init_1(tag + 1, "B");
- tag_init_1(tag + 2, "C");
- fact_init(&fact, tag, tag + 1, tag + 2);
- FACT_TEST_INSPECT(&fact, "{A, B, C}");
-}
-TEST_CASE_END(fact_inspect)
diff --git a/test/fact_test.h b/test/fact_test.h
index 271f1a4..5f4d398 100644
--- a/test/fact_test.h
+++ b/test/fact_test.h
@@ -17,8 +17,10 @@
#define FACT_TEST_EQ(test, expected) \
do { \
- const s_fact *fact_expected; \
- const s_fact *fact_test; \
+ const s_fact *fact_expected; \
+ const s_fact *fact_test; \
+ s_str str_expected; \
+ s_str str_test; \
fact_expected = (expected); \
fact_test = (test); \
if (compare_fact(fact_test, fact_expected) == 0) { \
@@ -26,10 +28,8 @@
g_test_assert_ok++; \
} \
else { \
- s_str str_expected; \
- s_str str_test; \
- fact_inspect(fact_expected, &str_expected); \
- fact_inspect(fact_test, &str_test); \
+ inspect_fact(fact_expected, &str_expected); \
+ inspect_fact(fact_test, &str_test); \
printf("\n%sAssertion failed in %s:%d %s\n" \
"%s == %s\n" \
"Expected %s got %s.%s\n", \
diff --git a/test/ident_test.c b/test/ident_test.c
index 8042ea7..60e75d2 100644
--- a/test/ident_test.c
+++ b/test/ident_test.c
@@ -28,28 +28,12 @@
TEST_EQ(ident_first_character_is_reserved(test), (expected)); \
} while (0)
-#define IDENT_TEST_INSPECT(test, result) \
- do { \
- s_ident ident; \
- s_str str; \
- assert(test); \
- assert(result); \
- test_context("ident_inspect(" #test ") -> " #result); \
- ident_init_1(&ident, (test)); \
- TEST_EQ(ident_inspect(&ident, &str), &str); \
- TEST_STRNCMP(str.ptr.p, (result), str.size); \
- str_clean(&str); \
- test_context(NULL); \
- } while (0)
-
void ident_test (void);
TEST_CASE_PROTOTYPE(ident_character_is_reserved);
TEST_CASE_PROTOTYPE(ident_first_character_is_reserved);
-TEST_CASE_PROTOTYPE(ident_inspect);
void ident_test (void)
{
- TEST_CASE_RUN(ident_inspect);
TEST_CASE_RUN(ident_first_character_is_reserved);
TEST_CASE_RUN(ident_character_is_reserved);
}
@@ -103,42 +87,3 @@ TEST_CASE(ident_first_character_is_reserved)
IDENT_TEST_FIRST_CHARACTER_IS_RESERVED(character_1("🤩"), false);
}
TEST_CASE_END(ident_first_character_is_reserved)
-
-TEST_CASE(ident_inspect)
-{
- IDENT_TEST_INSPECT("", "_\"\"");
- IDENT_TEST_INSPECT(" ", "_\" \"");
- IDENT_TEST_INSPECT("\n", "_\"\\n\"");
- IDENT_TEST_INSPECT("\r", "_\"\\r\"");
- IDENT_TEST_INSPECT("\t", "_\"\\t\"");
- IDENT_TEST_INSPECT("\v", "_\"\\v\"");
- IDENT_TEST_INSPECT("\"", "_\"\\\"\"");
- IDENT_TEST_INSPECT(".", ".");
- IDENT_TEST_INSPECT("..", "_\"..\"");
- IDENT_TEST_INSPECT("...", "_\"...\"");
- IDENT_TEST_INSPECT(".. .", "_\".. .\"");
- IDENT_TEST_INSPECT("t", "t");
- IDENT_TEST_INSPECT("T", "_\"T\"");
- IDENT_TEST_INSPECT("test", "test");
- IDENT_TEST_INSPECT("Test", "_\"Test\"");
- IDENT_TEST_INSPECT("123", "_\"123\"");
- IDENT_TEST_INSPECT("test123", "test123");
- IDENT_TEST_INSPECT("Test123", "_\"Test123\"");
- IDENT_TEST_INSPECT("test 123", "_\"test 123\"");
- IDENT_TEST_INSPECT("Test 123", "_\"Test 123\"");
- IDENT_TEST_INSPECT("test123.test456", "_\"test123.test456\"");
- IDENT_TEST_INSPECT("Test123.Test456", "_\"Test123.Test456\"");
- IDENT_TEST_INSPECT("test123(test456)", "_\"test123(test456)\"");
- IDENT_TEST_INSPECT("Test123(Test456)", "_\"Test123(Test456)\"");
- IDENT_TEST_INSPECT("test123{test456}", "_\"test123{test456}\"");
- IDENT_TEST_INSPECT("Test123{Test456}", "_\"Test123{Test456}\"");
- IDENT_TEST_INSPECT("É", "_\"É\"");
- IDENT_TEST_INSPECT("Éo", "_\"Éo\"");
- IDENT_TEST_INSPECT("Éoà \n\r\t\v\"",
- "_\"Éoà \\n\\r\\t\\v\\\"\"");
- IDENT_TEST_INSPECT("éoà \n\r\t\v\"",
- "_\"éoà \\n\\r\\t\\v\\\"\"");
- IDENT_TEST_INSPECT("é", "é");
- IDENT_TEST_INSPECT("éoπꝝ꒴", "éoπꝝ꒴");
-}
-TEST_CASE_END(ident_inspect)
diff --git a/test/inspect_test.c b/test/inspect_test.c
index fb8f78b..fbb4578 100644
--- a/test/inspect_test.c
+++ b/test/inspect_test.c
@@ -12,11 +12,132 @@
*/
#include <assert.h>
#include <string.h>
+#include "../libkc3/array.h"
+#include "../libkc3/call.h"
+#include "../libkc3/fact.h"
+#include "../libkc3/ident.h"
#include "../libkc3/inspect.h"
+#include "../libkc3/integer.h"
+#include "../libkc3/list.h"
+#include "../libkc3/ratio.h"
#include "../libkc3/str.h"
#include "../libkc3/sym.h"
+#include "../libkc3/tag.h"
+#include "../libkc3/tuple.h"
#include "test.h"
+#define INSPECT_TEST_ARRAY(test, expected) \
+ do { \
+ s_str str; \
+ s_array tmp; \
+ test_context("inspect_array(" # test ") -> " # expected); \
+ TEST_EQ(array_init_1(&tmp, (test)), &tmp); \
+ TEST_EQ(inspect_array(&tmp, &str), &str); \
+ TEST_STRNCMP(str.ptr.p, (expected), str.size); \
+ array_clean(&tmp); \
+ str_clean(&str); \
+ } while(0)
+
+#define INSPECT_TEST_BOOL(test, expected) \
+ do { \
+ s_str str; \
+ bool tmp; \
+ test_context("inspect_bool(" # test ") -> " # expected); \
+ tmp = (test); \
+ TEST_EQ(inspect_bool(&tmp, &str), &str); \
+ TEST_EQ(str.size, strlen(expected)); \
+ TEST_STRNCMP(str.ptr.p, (expected), str.size); \
+ str_clean(&str); \
+ test_context(NULL); \
+ } while (0)
+
+#define INSPECT_TEST_CALL(test) \
+ do { \
+ s_call call; \
+ s_str result; \
+ TEST_EQ(call_init_1(&call, (test)), &call); \
+ TEST_EQ(inspect_call(&call, &result), &result); \
+ TEST_STRNCMP(result.ptr.p, (test), result.size); \
+ TEST_EQ(result.size, strlen(test)); \
+ call_clean(&call); \
+ str_clean(&result); \
+ } while (0)
+
+#define INSPECT_TEST_FACT(test, expected) \
+ do { \
+ s_str str; \
+ TEST_EQ(inspect_fact(test, &str), &str); \
+ TEST_EQ(str.size, strlen(expected)); \
+ if (g_test_last_ok) \
+ TEST_STRNCMP(str.ptr.p, (expected), str.size); \
+ str_clean(&str); \
+ } while (0)
+
+#define INSPECT_TEST_IDENT(test, result) \
+ do { \
+ s_ident ident; \
+ s_str str; \
+ assert(test); \
+ assert(result); \
+ test_context("inspect_ident(" #test ") -> " #result); \
+ ident_init_1(&ident, (test)); \
+ TEST_EQ(inspect_ident(&ident, &str), &str); \
+ TEST_STRNCMP(str.ptr.p, (result), str.size); \
+ str_clean(&str); \
+ test_context(NULL); \
+ } while (0)
+
+#define INSPECT_TEST_LIST(test, expected) \
+ do { \
+ s_list *list_test; \
+ s_str str_result; \
+ test_context("inspect_list(" # test ") -> " # expected); \
+ list_test = list_new_1(test); \
+ TEST_EQ(inspect_list(list_test, &str_result), &str_result); \
+ TEST_STRNCMP(str_result.ptr.p, (expected), str_result.size); \
+ str_clean(&str_result); \
+ list_delete_all(list_test); \
+ test_context(NULL); \
+ } while (0)
+
+#define INSPECT_TEST_RATIO(test_num, test_den, expected) \
+ do { \
+ s_ratio ratio; \
+ s_str result; \
+ integer_init_u64(&ratio.numerator, test_num); \
+ integer_init_u64(&ratio.denominator, test_den); \
+ test_context("inspect_ratio(" # test_num "/" # test_den \
+ ") -> " # expected); \
+ TEST_EQ(inspect_ratio(&ratio, &result), &result); \
+ TEST_STRNCMP(result.ptr.p, expected, result.size); \
+ ratio_clean(&ratio); \
+ str_clean(&result); \
+ test_context(NULL); \
+} while (0)
+
+#define INSPECT_TEST_STR(test, expected) \
+ do { \
+ s_str result; \
+ assert(test); \
+ test_context("inspect_str(" # test ") -> " # expected); \
+ TEST_EQ(inspect_str((test), &result), &result); \
+ TEST_STRNCMP(result.ptr.p, (expected), result.size); \
+ str_clean(&result); \
+ test_context(NULL); \
+ } while (0)
+
+#define INSPECT_TEST_STR_1(test, expected) \
+ do { \
+ s_str result; \
+ s_str str; \
+ str_init_1(&str, NULL, (test)); \
+ test_context("inspect_str(" # test ") -> " # expected); \
+ TEST_EQ(inspect_str(&str, &result), &result); \
+ TEST_STRNCMP(result.ptr.p, (expected), result.size); \
+ str_clean(&result); \
+ test_context(NULL); \
+ } while (0)
+
#define INSPECT_TEST_SYM(test, result) \
do { \
const s_sym *sym; \
@@ -31,12 +152,248 @@
test_context(NULL); \
} while (0)
+#define INSPECT_TEST_TUPLE(test, expected) \
+ do { \
+ s_tuple tuple_test; \
+ s_str str_result; \
+ test_context("inspect_tuple(" # test ") -> " # expected); \
+ tuple_init_1(&tuple_test, (test)); \
+ TEST_EQ(inspect_tuple(&tuple_test, &str_result), &str_result); \
+ tuple_clean(&tuple_test); \
+ if (g_test_last_ok) { \
+ TEST_EQ(str_result.size, strlen(expected)); \
+ if (g_test_last_ok) \
+ TEST_STRNCMP(str_result.ptr.p, (expected), str_result.size); \
+ str_clean(&str_result); \
+ } \
+ test_context(NULL); \
+ } while (0)
+
+TEST_CASE_PROTOTYPE(inspect_array);
+TEST_CASE_PROTOTYPE(inspect_bool);
+TEST_CASE_PROTOTYPE(inspect_call);
+TEST_CASE_PROTOTYPE(inspect_fact);
+TEST_CASE_PROTOTYPE(inspect_ident);
+TEST_CASE_PROTOTYPE(inspect_list);
+TEST_CASE_PROTOTYPE(inspect_ratio);
+TEST_CASE_PROTOTYPE(inspect_str);
TEST_CASE_PROTOTYPE(inspect_sym);
+TEST_CASE_PROTOTYPE(inspect_tuple);
void inspect_test (void)
{
+ TEST_CASE_RUN(inspect_array);
+ TEST_CASE_RUN(inspect_bool);
+ TEST_CASE_RUN(inspect_call);
+ TEST_CASE_RUN(inspect_fact);
+ TEST_CASE_RUN(inspect_ident);
+ TEST_CASE_RUN(inspect_list);
+ TEST_CASE_RUN(inspect_ratio);
+ TEST_CASE_RUN(inspect_str);
TEST_CASE_RUN(inspect_sym);
+ TEST_CASE_RUN(inspect_tuple);
+}
+
+TEST_CASE(inspect_array)
+{
+ INSPECT_TEST_ARRAY("(U8[]) {0}",
+ "(U8[]) {0}");
+ INSPECT_TEST_ARRAY("(U8[]) {0, 0}",
+ "(U8[]) {0, 0}");
+ INSPECT_TEST_ARRAY("(U8[]) {0, 0, 0}",
+ "(U8[]) {0, 0, 0}");
+ INSPECT_TEST_ARRAY("(U8[]) {{0}, {0}}",
+ "(U8[]) {{0}, {0}}");
+ INSPECT_TEST_ARRAY("(U8[]) {{0, 0}, {0, 0}}",
+ "(U8[]) {{0, 0}, {0, 0}}");
+ INSPECT_TEST_ARRAY("(U8[]) {{0, 0}, {0, 0}, {0, 0}}",
+ "(U8[]) {{0, 0}, {0, 0}, {0, 0}}");
+ INSPECT_TEST_ARRAY("(U8[]) {{{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}}",
+ "(U8[]) {{{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}, {{0, 0}, {0, 0}}}");
+ INSPECT_TEST_ARRAY("(U8[]) {1, 2, 3}",
+ "(U8[]) {1, 2, 3}");
+ INSPECT_TEST_ARRAY("(U8[]) {1 + 1, 2 + 2, 3 + 3}",
+ "(U8[]) {2, 4, 6}");
+ INSPECT_TEST_ARRAY("(U8[]) {255 + 1, 255 + 2, 255 + 3}",
+ "(U8[]) {0, 1, 2}");
+ INSPECT_TEST_ARRAY("(U16[]) {255 + 1, 255 + 2, 255 + 3}",
+ "(U16[]) {256, 257, 258}");
+ INSPECT_TEST_ARRAY("(U16[]) {65535 + 1, 65535 + 2, 65535 + 3}",
+ "(U16[]) {0, 1, 2}");
+ INSPECT_TEST_ARRAY("(U32[]) {65535 + 1, 65535 + 2, 65535 + 3}",
+ "(U32[]) {65536, 65537, 65538}");
+ INSPECT_TEST_ARRAY("(U32[]) {4294967295 + 1, 4294967295 + 2, 4294967295 + 3}",
+ "(U32[]) {0, 1, 2}");
+ INSPECT_TEST_ARRAY("(U64[]) {4294967295 + 1, 4294967295 + 2, 4294967295 + 3}",
+ "(U64[]) {4294967296, 4294967297, 4294967298}");
+ INSPECT_TEST_ARRAY("(U64[]) {18446744073709551615 + 1, 18446744073709551615 + 2, 18446744073709551615 + 3}",
+ "(U64[]) {0, 1, 2}");
+ INSPECT_TEST_ARRAY("(Integer[]) {18446744073709551615 + 1, 18446744073709551615 + 2, 18446744073709551615 + 3}",
+ "(Integer[]) {18446744073709551616, 18446744073709551617, 18446744073709551618}");
+}
+TEST_CASE_END(inspect_array)
+
+TEST_CASE(inspect_bool)
+{
+ INSPECT_TEST_BOOL(true, "true");
+ INSPECT_TEST_BOOL(false, "false");
}
+TEST_CASE_END(inspect_bool)
+
+TEST_CASE(inspect_call)
+{
+ INSPECT_TEST_CALL("a()");
+ INSPECT_TEST_CALL("a(b)");
+ INSPECT_TEST_CALL("a(b, c)");
+ INSPECT_TEST_CALL("a(b, c, d)");
+ INSPECT_TEST_CALL("A.b()");
+ INSPECT_TEST_CALL("A.b(c)");
+ INSPECT_TEST_CALL("A.b(c, d)");
+ INSPECT_TEST_CALL("A.b(c, d, e)");
+}
+TEST_CASE_END(inspect_call)
+
+TEST_CASE(inspect_fact)
+{
+ s_tag tag[3];
+ s_fact fact;
+ tag_init_1(tag, "A");
+ tag_init_1(tag + 1, "B");
+ tag_init_1(tag + 2, "C");
+ fact_init(&fact, tag, tag + 1, tag + 2);
+ INSPECT_TEST_FACT(&fact, "{A, B, C}");
+}
+TEST_CASE_END(inspect_fact)
+
+TEST_CASE(inspect_ident)
+{
+ INSPECT_TEST_IDENT("", "_\"\"");
+ INSPECT_TEST_IDENT(" ", "_\" \"");
+ INSPECT_TEST_IDENT("\n", "_\"\\n\"");
+ INSPECT_TEST_IDENT("\r", "_\"\\r\"");
+ INSPECT_TEST_IDENT("\t", "_\"\\t\"");
+ INSPECT_TEST_IDENT("\v", "_\"\\v\"");
+ INSPECT_TEST_IDENT("\"", "_\"\\\"\"");
+ INSPECT_TEST_IDENT(".", ".");
+ INSPECT_TEST_IDENT("..", "_\"..\"");
+ INSPECT_TEST_IDENT("...", "_\"...\"");
+ INSPECT_TEST_IDENT(".. .", "_\".. .\"");
+ INSPECT_TEST_IDENT("t", "t");
+ INSPECT_TEST_IDENT("T", "_\"T\"");
+ INSPECT_TEST_IDENT("test", "test");
+ INSPECT_TEST_IDENT("Test", "_\"Test\"");
+ INSPECT_TEST_IDENT("123", "_\"123\"");
+ INSPECT_TEST_IDENT("test123", "test123");
+ INSPECT_TEST_IDENT("Test123", "_\"Test123\"");
+ INSPECT_TEST_IDENT("test 123", "_\"test 123\"");
+ INSPECT_TEST_IDENT("Test 123", "_\"Test 123\"");
+ INSPECT_TEST_IDENT("test123.test456", "_\"test123.test456\"");
+ INSPECT_TEST_IDENT("Test123.Test456", "_\"Test123.Test456\"");
+ INSPECT_TEST_IDENT("test123(test456)", "_\"test123(test456)\"");
+ INSPECT_TEST_IDENT("Test123(Test456)", "_\"Test123(Test456)\"");
+ INSPECT_TEST_IDENT("test123{test456}", "_\"test123{test456}\"");
+ INSPECT_TEST_IDENT("Test123{Test456}", "_\"Test123{Test456}\"");
+ INSPECT_TEST_IDENT("É", "_\"É\"");
+ INSPECT_TEST_IDENT("Éo", "_\"Éo\"");
+ INSPECT_TEST_IDENT("Éoà \n\r\t\v\"",
+ "_\"Éoà \\n\\r\\t\\v\\\"\"");
+ INSPECT_TEST_IDENT("éoà \n\r\t\v\"",
+ "_\"éoà \\n\\r\\t\\v\\\"\"");
+ INSPECT_TEST_IDENT("é", "é");
+ INSPECT_TEST_IDENT("éoπꝝ꒴", "éoπꝝ꒴");
+}
+TEST_CASE_END(inspect_ident)
+
+TEST_CASE(inspect_list)
+{
+ INSPECT_TEST_LIST("[]", "[]");
+ INSPECT_TEST_LIST("[[] | []]", "[[]]");
+ INSPECT_TEST_LIST("[[], [] | []]", "[[], []]");
+}
+TEST_CASE_END(inspect_list)
+
+TEST_CASE(inspect_ratio)
+{
+ INSPECT_TEST_RATIO(0, 1, "0/1");
+ INSPECT_TEST_RATIO(1, 1, "1/1");
+ INSPECT_TEST_RATIO(1, 10, "1/10");
+ INSPECT_TEST_RATIO(1, 100, "1/100");
+ INSPECT_TEST_RATIO(1, 1000, "1/1000");
+ INSPECT_TEST_RATIO(10, 1, "10/1");
+ INSPECT_TEST_RATIO(100, 1, "100/1");
+ INSPECT_TEST_RATIO(1000, 1, "1000/1");
+}
+TEST_CASE_END(inspect_ratio)
+
+TEST_CASE(inspect_str)
+{
+ s_str str;
+ char zero[16] = {0};
+ INSPECT_TEST_STR_1("", "\"\"");
+ INSPECT_TEST_STR_1(" ", "\" \"");
+ INSPECT_TEST_STR_1("\n", "\"\\n\"");
+ INSPECT_TEST_STR_1("\r", "\"\\r\"");
+ INSPECT_TEST_STR_1("\t", "\"\\t\"");
+ INSPECT_TEST_STR_1("\v", "\"\\v\"");
+ INSPECT_TEST_STR_1("\"", "\"\\\"\"");
+ INSPECT_TEST_STR_1("\\", "\"\\\\\"");
+ INSPECT_TEST_STR_1(".", "\".\"");
+ INSPECT_TEST_STR_1("..", "\"..\"");
+ INSPECT_TEST_STR_1("...", "\"...\"");
+ INSPECT_TEST_STR_1(".. .", "\".. .\"");
+ INSPECT_TEST_STR_1("t", "\"t\"");
+ INSPECT_TEST_STR_1("T", "\"T\"");
+ INSPECT_TEST_STR_1("test", "\"test\"");
+ INSPECT_TEST_STR_1("Test", "\"Test\"");
+ INSPECT_TEST_STR_1("123", "\"123\"");
+ INSPECT_TEST_STR_1("test123", "\"test123\"");
+ INSPECT_TEST_STR_1("Test123", "\"Test123\"");
+ INSPECT_TEST_STR_1("test 123", "\"test 123\"");
+ INSPECT_TEST_STR_1("Test 123", "\"Test 123\"");
+ INSPECT_TEST_STR_1("test123.test456", "\"test123.test456\"");
+ INSPECT_TEST_STR_1("Test123.Test456", "\"Test123.Test456\"");
+ INSPECT_TEST_STR_1("É", "\"É\"");
+ INSPECT_TEST_STR_1("Éo", "\"Éo\"");
+ INSPECT_TEST_STR_1("Éoà \n\r\t\v\"",
+ "\"Éoà \\n\\r\\t\\v\\\"\"");
+ INSPECT_TEST_STR_1("é", "\"é\"");
+ INSPECT_TEST_STR_1("éo", "\"éo\"");
+ INSPECT_TEST_STR_1("éoà \n\r\t\v\"",
+ "\"éoà \\n\\r\\t\\v\\\"\"");
+ INSPECT_TEST_STR_1("Π", "\"Π\"");
+ INSPECT_TEST_STR_1("꒴", "\"꒴\"");
+ INSPECT_TEST_STR_1("𐅀", "\"𐅀\"");
+ INSPECT_TEST_STR_1("ÉoàΠ꒴𐅀 \n\r\t\v\\\"",
+ "\"ÉoàΠ꒴𐅀 \\n\\r\\t\\v\\\\\\\"\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 1, zero), "\"\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 2, zero), "\"\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 3, zero), "\"\\0\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 4, zero), "\"\\0\\0\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 5, zero), "\"\\0\\0\\0\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 6, zero), "\"\\0\\0\\0\\0\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 7, zero),
+ "\"\\0\\0\\0\\0\\0\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 8, zero),
+ "\"\\0\\0\\0\\0\\0\\0\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 9, zero),
+ "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 10, zero),
+ "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 11, zero),
+ "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 12, zero),
+ "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 13, zero),
+ "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 14, zero),
+ "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 15, zero),
+ "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
+ INSPECT_TEST_STR(str_init(&str, NULL, 16, zero),
+ "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0"
+ "\\0\"");
+}
+TEST_CASE_END(inspect_str)
TEST_CASE(inspect_sym)
{
@@ -76,3 +433,12 @@ TEST_CASE(inspect_sym)
":\"éoà \\n\\r\\t\\v\\\"\"");
}
TEST_CASE_END(inspect_sym)
+
+TEST_CASE(inspect_tuple)
+{
+ INSPECT_TEST_TUPLE("{:a, :b}", "{:a, :b}");
+ INSPECT_TEST_TUPLE("{{:a, :b}, {:c, :d}}", "{{:a, :b}, {:c, :d}}");
+ INSPECT_TEST_TUPLE("{{:a, :b}, {:c, :d}, {:e, :f}}",
+ "{{:a, :b}, {:c, :d}, {:e, :f}}");
+}
+TEST_CASE_END(inspect_tuple)
diff --git a/test/list_test.c b/test/list_test.c
index fe8911e..50c0d6f 100644
--- a/test/list_test.c
+++ b/test/list_test.c
@@ -26,27 +26,12 @@
test_context(NULL); \
} while (0)
-#define LIST_TEST_INSPECT(test, expected) \
- do { \
- s_list *list_test; \
- s_str str_result; \
- test_context("list_inspect(" # test ") -> " # expected); \
- list_test = list_new_1(test); \
- TEST_EQ(list_inspect(list_test, &str_result), &str_result); \
- TEST_STRNCMP(str_result.ptr.p, (expected), str_result.size); \
- str_clean(&str_result); \
- list_delete_all(list_test); \
- test_context(NULL); \
- } while (0)
-
void list_test (void);
TEST_CASE_PROTOTYPE(list_new_1);
-TEST_CASE_PROTOTYPE(list_inspect);
void list_test (void)
{
TEST_CASE_RUN(list_new_1);
- TEST_CASE_RUN(list_inspect);
}
TEST_CASE(list_new_1)
@@ -63,11 +48,3 @@ TEST_CASE(list_new_1)
LIST_TEST_NEW_1("[A, B, C | D]");
}
TEST_CASE_END(list_new_1)
-
-TEST_CASE(list_inspect)
-{
- LIST_TEST_INSPECT("[]", "[]");
- LIST_TEST_INSPECT("[[] | []]", "[[]]");
- LIST_TEST_INSPECT("[[], [] | []]", "[[], []]");
-}
-TEST_CASE_END(list_inspect)
diff --git a/test/ratio_test.c b/test/ratio_test.c
index 8341d05..a1acbf9 100644
--- a/test/ratio_test.c
+++ b/test/ratio_test.c
@@ -21,21 +21,6 @@
#include "../libkc3/ratio.h"
#include "test.h"
-#define RATIO_TEST_INSPECT(test_num, test_den, expected) \
- do { \
- s_ratio ratio; \
- s_str result; \
- integer_init_u64(&ratio.numerator, test_num); \
- integer_init_u64(&ratio.denominator, test_den); \
- test_context("ratio_inspect(" # test_num "/" # test_den \
- ") -> " # expected); \
- TEST_EQ(ratio_inspect(&ratio, &result), &result); \
- TEST_STRNCMP(result.ptr.p, expected, result.size); \
- ratio_clean(&ratio); \
- str_clean(&result); \
- test_context(NULL); \
-} while (0)
-
#define RATIO_TEST_PARSE(test, expected_num, expected_den) \
do { \
sw result_num; \
@@ -57,28 +42,13 @@
test_context(NULL); \
} while (0)
-TEST_CASE_PROTOTYPE(ratio_inspect);
TEST_CASE_PROTOTYPE(ratio_parse);
void ratio_test (void)
{
- TEST_CASE_RUN(ratio_inspect);
TEST_CASE_RUN(ratio_parse);
}
-TEST_CASE(ratio_inspect)
-{
- RATIO_TEST_INSPECT(0, 1, "0/1");
- RATIO_TEST_INSPECT(1, 1, "1/1");
- RATIO_TEST_INSPECT(1, 10, "1/10");
- RATIO_TEST_INSPECT(1, 100, "1/100");
- RATIO_TEST_INSPECT(1, 1000, "1/1000");
- RATIO_TEST_INSPECT(10, 1, "10/1");
- RATIO_TEST_INSPECT(100, 1, "100/1");
- RATIO_TEST_INSPECT(1000, 1, "1000/1");
-}
-TEST_CASE_END(ratio_inspect)
-
TEST_CASE(ratio_parse)
{
RATIO_TEST_PARSE("0/1", 0, 1);
diff --git a/test/str_test.c b/test/str_test.c
index 98999a7..9543bc1 100644
--- a/test/str_test.c
+++ b/test/str_test.c
@@ -17,29 +17,6 @@
#include "../libkc3/str.h"
#include "test.h"
-#define STR_TEST_INSPECT(test, expected) \
- do { \
- s_str result; \
- assert(test); \
- test_context("str_inspect(" # test ") -> " # expected); \
- TEST_EQ(str_inspect((test), &result), &result); \
- TEST_STRNCMP(result.ptr.p, (expected), result.size); \
- str_clean(&result); \
- test_context(NULL); \
- } while (0)
-
-#define STR_TEST_INSPECT_1(test, expected) \
- do { \
- s_str result; \
- s_str str; \
- str_init_1(&str, NULL, (test)); \
- test_context("str_inspect(" # test ") -> " # expected); \
- TEST_EQ(str_inspect(&str, &result), &result); \
- TEST_STRNCMP(result.ptr.p, (expected), result.size); \
- str_clean(&result); \
- test_context(NULL); \
- } while (0)
-
#define STR_TEST_TO_HEX(test, expected) \
do { \
s_str str; \
@@ -69,7 +46,6 @@ TEST_CASE_PROTOTYPE(str_character_is_reserved);
TEST_CASE_PROTOTYPE(str_init_clean);
TEST_CASE_PROTOTYPE(str_init_copy);
TEST_CASE_PROTOTYPE(str_init_copy_1);
-TEST_CASE_PROTOTYPE(str_inspect);
TEST_CASE_PROTOTYPE(str_new_1);
TEST_CASE_PROTOTYPE(str_new_cpy);
TEST_CASE_PROTOTYPE(str_new_delete);
@@ -79,7 +55,6 @@ TEST_CASE_PROTOTYPE(str_to_hex);
TEST_CASE_PROTOTYPE(str_to_ident);
TEST_CASE_PROTOTYPE(str_to_sym);
-
void str_test (void)
{
TEST_CASE_RUN(str_init_clean);
@@ -91,7 +66,6 @@ void str_test (void)
TEST_CASE_RUN(str_new_cpy);
TEST_CASE_RUN(str_new_f);
TEST_CASE_RUN(str_character_is_reserved);
- TEST_CASE_RUN(str_inspect);
TEST_CASE_RUN(str_to_hex);
TEST_CASE_RUN(str_to_sym);
}
@@ -206,76 +180,6 @@ TEST_CASE(str_init_copy_1)
}
TEST_CASE_END(str_init_copy_1)
-TEST_CASE(str_inspect)
-{
- s_str str;
- char zero[16] = {0};
- STR_TEST_INSPECT_1("", "\"\"");
- STR_TEST_INSPECT_1(" ", "\" \"");
- STR_TEST_INSPECT_1("\n", "\"\\n\"");
- STR_TEST_INSPECT_1("\r", "\"\\r\"");
- STR_TEST_INSPECT_1("\t", "\"\\t\"");
- STR_TEST_INSPECT_1("\v", "\"\\v\"");
- STR_TEST_INSPECT_1("\"", "\"\\\"\"");
- STR_TEST_INSPECT_1("\\", "\"\\\\\"");
- STR_TEST_INSPECT_1(".", "\".\"");
- STR_TEST_INSPECT_1("..", "\"..\"");
- STR_TEST_INSPECT_1("...", "\"...\"");
- STR_TEST_INSPECT_1(".. .", "\".. .\"");
- STR_TEST_INSPECT_1("t", "\"t\"");
- STR_TEST_INSPECT_1("T", "\"T\"");
- STR_TEST_INSPECT_1("test", "\"test\"");
- STR_TEST_INSPECT_1("Test", "\"Test\"");
- STR_TEST_INSPECT_1("123", "\"123\"");
- STR_TEST_INSPECT_1("test123", "\"test123\"");
- STR_TEST_INSPECT_1("Test123", "\"Test123\"");
- STR_TEST_INSPECT_1("test 123", "\"test 123\"");
- STR_TEST_INSPECT_1("Test 123", "\"Test 123\"");
- STR_TEST_INSPECT_1("test123.test456", "\"test123.test456\"");
- STR_TEST_INSPECT_1("Test123.Test456", "\"Test123.Test456\"");
- STR_TEST_INSPECT_1("É", "\"É\"");
- STR_TEST_INSPECT_1("Éo", "\"Éo\"");
- STR_TEST_INSPECT_1("Éoà \n\r\t\v\"",
- "\"Éoà \\n\\r\\t\\v\\\"\"");
- STR_TEST_INSPECT_1("é", "\"é\"");
- STR_TEST_INSPECT_1("éo", "\"éo\"");
- STR_TEST_INSPECT_1("éoà \n\r\t\v\"",
- "\"éoà \\n\\r\\t\\v\\\"\"");
- STR_TEST_INSPECT_1("Π", "\"Π\"");
- STR_TEST_INSPECT_1("꒴", "\"꒴\"");
- STR_TEST_INSPECT_1("𐅀", "\"𐅀\"");
- STR_TEST_INSPECT_1("ÉoàΠ꒴𐅀 \n\r\t\v\\\"",
- "\"ÉoàΠ꒴𐅀 \\n\\r\\t\\v\\\\\\\"\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 1, zero), "\"\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 2, zero), "\"\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 3, zero), "\"\\0\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 4, zero), "\"\\0\\0\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 5, zero), "\"\\0\\0\\0\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 6, zero), "\"\\0\\0\\0\\0\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 7, zero),
- "\"\\0\\0\\0\\0\\0\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 8, zero),
- "\"\\0\\0\\0\\0\\0\\0\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 9, zero),
- "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 10, zero),
- "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 11, zero),
- "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 12, zero),
- "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 13, zero),
- "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 14, zero),
- "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 15, zero),
- "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\"");
- STR_TEST_INSPECT(str_init(&str, NULL, 16, zero),
- "\"\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0"
- "\\0\"");
-}
-TEST_CASE_END(str_inspect)
-
TEST_CASE(str_new_1)
{
s_str *str;
diff --git a/test/tuple_test.c b/test/tuple_test.c
index 0e1ea47..3c5af34 100644
--- a/test/tuple_test.c
+++ b/test/tuple_test.c
@@ -35,23 +35,6 @@
test_context(NULL); \
} while (0)
-#define TUPLE_TEST_INSPECT(test, expected) \
- do { \
- s_tuple tuple_test; \
- s_str str_result; \
- test_context("tuple_inspect(" # test ") -> " # expected); \
- tuple_init_1(&tuple_test, (test)); \
- TEST_EQ(tuple_inspect(&tuple_test, &str_result), &str_result); \
- tuple_clean(&tuple_test); \
- if (g_test_last_ok) { \
- TEST_EQ(str_result.size, strlen(expected)); \
- if (g_test_last_ok) \
- TEST_STRNCMP(str_result.ptr.p, (expected), str_result.size); \
- str_clean(&str_result); \
- } \
- test_context(NULL); \
- } while (0)
-
#define TUPLE_TEST_NEW_1(test) \
do { \
s_tuple *tuple_test; \
@@ -73,7 +56,6 @@
void tuple_test (void);
TEST_CASE_PROTOTYPE(tuple_init_1);
TEST_CASE_PROTOTYPE(tuple_init_clean);
-TEST_CASE_PROTOTYPE(tuple_inspect);
TEST_CASE_PROTOTYPE(tuple_new_1);
TEST_CASE_PROTOTYPE(tuple_new_delete);
@@ -83,7 +65,6 @@ void tuple_test (void)
TEST_CASE_RUN(tuple_new_delete);
TEST_CASE_RUN(tuple_init_1);
TEST_CASE_RUN(tuple_new_1);
- TEST_CASE_RUN(tuple_inspect);
}
TEST_CASE(tuple_init_clean)
@@ -122,15 +103,6 @@ TEST_CASE(tuple_init_1)
}
TEST_CASE_END(tuple_init_1)
-TEST_CASE(tuple_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}}");
-}
-TEST_CASE_END(tuple_inspect)
-
TEST_CASE(tuple_new_1)
{
TUPLE_TEST_NEW_1("{:a, :b}");