diff --git a/.gitignore b/.gitignore
index 57ef1a3..6f97059 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@ ic3/ic3.debug
.libs/
*.lo
*.o
+test/*.facts
test/ic3/*.diff
test/ic3/*.err
test/ic3/*.out
diff --git a/facts_test_dump.facts b/facts_test_dump.facts
new file mode 100644
index 0000000..bebffb3
--- /dev/null
+++ b/facts_test_dump.facts
@@ -0,0 +1,23 @@
+add {a, a, a}
+add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
+add {18446744073709551616, 18446744073709551616, 18446744073709551616}
+add {-4294967296, -4294967296, -4294967296}
+add {-65536, -65536, -65536}
+add {-256, -256, -256}
+add {-10, -10, -10}
+add {-1, -1, -1}
+add {0, 0, 0}
+add {1, 1, 1}
+add {10, 10, 10}
+add {256, 256, 256}
+add {65536, 65536, 65536}
+add {4294967296, 4294967296, 4294967296}
+add {[], [], []}
+add {[[], []], [[], []], [[], []]}
+add {"a", "a", "a"}
+add {A, A, A}
+add {:a, :a, :a}
+add {{a, b}, {a, b}, {a, b}}
+add {{:a, :b}, {:a, :b}, {:a, :b}}
+add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
+add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
diff --git a/facts_test_log_add.facts b/facts_test_log_add.facts
new file mode 100644
index 0000000..5286f7a
--- /dev/null
+++ b/facts_test_log_add.facts
@@ -0,0 +1,23 @@
+add {"a", "a", "a"}
+add {:a, :a, :a}
+add {A, A, A}
+add {a, a, a}
+add {[], [], []}
+add {[[], []], [[], []], [[], []]}
+add {{:a, :b}, {:a, :b}, {:a, :b}}
+add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
+add {{a, b}, {a, b}, {a, b}}
+add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
+add {0, 0, 0}
+add {1, 1, 1}
+add {10, 10, 10}
+add {256, 256, 256}
+add {65536, 65536, 65536}
+add {4294967296, 4294967296, 4294967296}
+add {18446744073709551616, 18446744073709551616, 18446744073709551616}
+add {-1, -1, -1}
+add {-10, -10, -10}
+add {-256, -256, -256}
+add {-65536, -65536, -65536}
+add {-4294967296, -4294967296, -4294967296}
+add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
diff --git a/facts_test_log_remove.facts b/facts_test_log_remove.facts
new file mode 100644
index 0000000..f96c838
--- /dev/null
+++ b/facts_test_log_remove.facts
@@ -0,0 +1,46 @@
+add {"a", "a", "a"}
+add {:a, :a, :a}
+add {A, A, A}
+add {a, a, a}
+add {[], [], []}
+add {[[], []], [[], []], [[], []]}
+add {{:a, :b}, {:a, :b}, {:a, :b}}
+add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
+add {{a, b}, {a, b}, {a, b}}
+add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
+add {0, 0, 0}
+add {1, 1, 1}
+add {10, 10, 10}
+add {256, 256, 256}
+add {65536, 65536, 65536}
+add {4294967296, 4294967296, 4294967296}
+add {18446744073709551616, 18446744073709551616, 18446744073709551616}
+add {-1, -1, -1}
+add {-10, -10, -10}
+add {-256, -256, -256}
+add {-65536, -65536, -65536}
+add {-4294967296, -4294967296, -4294967296}
+add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
+remove {-18446744073709551616, -18446744073709551616, -18446744073709551616}
+remove {-4294967296, -4294967296, -4294967296}
+remove {-65536, -65536, -65536}
+remove {-256, -256, -256}
+remove {-10, -10, -10}
+remove {-1, -1, -1}
+remove {18446744073709551616, 18446744073709551616, 18446744073709551616}
+remove {4294967296, 4294967296, 4294967296}
+remove {65536, 65536, 65536}
+remove {256, 256, 256}
+remove {10, 10, 10}
+remove {1, 1, 1}
+remove {0, 0, 0}
+remove {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
+remove {{a, b}, {a, b}, {a, b}}
+remove {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
+remove {{:a, :b}, {:a, :b}, {:a, :b}}
+remove {[[], []], [[], []], [[], []]}
+remove {[], [], []}
+remove {a, a, a}
+remove {A, A, A}
+remove {:a, :a, :a}
+remove {"a", "a", "a"}
diff --git a/libc3/buf_inspect.c b/libc3/buf_inspect.c
index 6e49ab0..540475a 100644
--- a/libc3/buf_inspect.c
+++ b/libc3/buf_inspect.c
@@ -812,7 +812,9 @@ sw buf_inspect_tag_size (const s_tag *tag)
case TAG_U16: return buf_inspect_u16_size(tag->data.u16);
case TAG_U32: return buf_inspect_u32_size(tag->data.u32);
case TAG_U64: return buf_inspect_u64_size(tag->data.u64);
- case TAG_VAR: errx(1, "buf_inspect_tag_size: variable");
+ case TAG_VAR:
+ assert(! "variable");
+ errx(1, "buf_inspect_tag_size: variable");
return -1;
}
assert(! "unknown tag type");
diff --git a/libc3/call.c b/libc3/call.c
index 7a0c738..8e6d3e8 100644
--- a/libc3/call.c
+++ b/libc3/call.c
@@ -39,6 +39,15 @@ s8 call_compare (const s_call *a, const s_call *b)
return list_compare(a->args, b->args);
}
+s_call * call_copy (const s_call *src, s_call *dest)
+{
+ assert(src);
+ assert(dest);
+ ident_copy(&src->ident, &dest->ident);
+ list_copy(src->args, &dest->args);
+ return dest;
+}
+
t_hash_context * call_hash_update (t_hash_context *context,
const s_call *x)
{
diff --git a/libc3/call.h b/libc3/call.h
index ca0afe0..ecb852c 100644
--- a/libc3/call.h
+++ b/libc3/call.h
@@ -21,6 +21,7 @@ void call_clean (s_call *call);
s_call * call_init_1 (s_call *call, const s8 *p);
s8 call_compare (const s_call *a, const s_call *b);
+s_call * call_copy (const s_call *src, s_call *dest);
t_hash_context * call_hash_update (t_hash_context *context,
const s_call *call);
s_str * call_inspect (const s_call *call, s_str *dest);
diff --git a/libc3/facts_cursor.c b/libc3/facts_cursor.c
index f48504c..43bd0ad 100644
--- a/libc3/facts_cursor.c
+++ b/libc3/facts_cursor.c
@@ -64,11 +64,11 @@ s_fact * facts_cursor_next (s_facts_cursor *cursor)
if (cursor->node) {
s_fact *fact = cursor->node->fact;
if (cursor->var_subject)
- tag_copy(fact->subject, cursor->var_subject);
+ cursor->var_subject->data.var = fact->subject;
if (cursor->var_predicate)
- tag_copy(fact->predicate, cursor->var_predicate);
+ cursor->var_predicate->data.var = fact->predicate;
if (cursor->var_object)
- tag_copy(fact->object, cursor->var_object);
+ cursor->var_object->data.var = fact->object;
return fact;
}
if (cursor->var_subject)
diff --git a/libc3/facts_spec.c b/libc3/facts_spec.c
index 2d41bf0..ac4ac08 100644
--- a/libc3/facts_spec.c
+++ b/libc3/facts_spec.c
@@ -54,8 +54,8 @@ p_facts_spec facts_spec_new_expand (p_facts_spec spec)
p_facts_spec facts_spec_sort (p_facts_spec spec)
{
- p_var *a;
- p_var *b;
+ s_tag **a;
+ s_tag **b;
uw count;
uw i = 0;
uw j;
@@ -68,7 +68,7 @@ p_facts_spec facts_spec_sort (p_facts_spec spec)
a = spec + j * 4;
b = spec + (j + 1) * 4;
if (fact_compare_var_count((s_fact *) a, (s_fact *) b) > 0) {
- p_var swap[3];
+ s_tag *swap[3];
swap[0] = a[0];
swap[1] = a[1];
swap[2] = a[2];
diff --git a/libc3/facts_with.c b/libc3/facts_with.c
index ef410c4..f384e2b 100644
--- a/libc3/facts_with.c
+++ b/libc3/facts_with.c
@@ -91,9 +91,9 @@ s_facts_cursor * facts_with_tags (const s_facts *facts,
s_tag *predicate,
s_tag *object)
{
- p_var var_subject;
- p_var var_predicate;
- p_var var_object;
+ s_tag *var_subject;
+ s_tag *var_predicate;
+ s_tag *var_object;
assert(facts);
assert(cursor);
assert(subject);
diff --git a/libc3/facts_with_cursor.c b/libc3/facts_with_cursor.c
index 82e0533..31741d0 100644
--- a/libc3/facts_with_cursor.c
+++ b/libc3/facts_with_cursor.c
@@ -49,7 +49,7 @@ s_fact * facts_with_cursor_next (s_facts_with_cursor *cursor)
}
while (cursor->level < cursor->facts_count) {
level = cursor->l + cursor->level;
- if (!level->spec) {
+ if (! level->spec) {
parent_spec = cursor->level ?
cursor->l[cursor->level - 1].spec + 4 :
cursor->spec;
@@ -58,23 +58,17 @@ s_fact * facts_with_cursor_next (s_facts_with_cursor *cursor)
level->spec[1], level->spec[2]);
}
level->fact = fact = facts_cursor_next(&level->cursor);
- if (level->fact)
+ if (fact) {
cursor->level++;
- else {
- free(level->spec);
- level->spec = NULL;
- if (cursor->level > 0) {
- cursor->level--;
- if (!cursor->level) {
- cursor->facts_count = 0;
- return NULL;
- }
- }
- else {
- cursor->facts_count = 0;
- return NULL;
- }
+ continue;
}
+ free(level->spec);
+ level->spec = NULL;
+ if (! cursor->level) {
+ cursor->facts_count = 0;
+ return NULL;
+ }
+ cursor->level--;
}
return fact;
}
diff --git a/libc3/ident.c b/libc3/ident.c
index f6c969a..0e44b1f 100644
--- a/libc3/ident.c
+++ b/libc3/ident.c
@@ -47,6 +47,13 @@ s8 ident_compare (const s_ident *a, const s_ident *b)
return sym_compare(a->sym, b->sym);
}
+s_ident * ident_copy (const s_ident *src, s_ident *dest)
+{
+ dest->module = src->module;
+ dest->sym = src->sym;
+ return dest;
+}
+
e_bool ident_first_character_is_reserved (character c)
{
return (character_is_digit(c) ||
diff --git a/libc3/ident.h b/libc3/ident.h
index 3c5000b..bf41e08 100644
--- a/libc3/ident.h
+++ b/libc3/ident.h
@@ -31,6 +31,8 @@ e_bool ident_character_is_reserved (character c);
/* Compare two idents. Returns -1 if a < b, 0 if a = b, 1 if a > b. */
s8 ident_compare (const s_ident *a, const s_ident *b);
+s_ident * ident_copy (const s_ident *src, s_ident *dest);
+
/* Returns true iff c is an ident reserved character as first. */
e_bool ident_first_character_is_reserved (character c);
diff --git a/libc3/tag.c b/libc3/tag.c
index 01b3667..bdddfc0 100644
--- a/libc3/tag.c
+++ b/libc3/tag.c
@@ -118,6 +118,7 @@ void tag_clean (s_tag *tag)
{
assert(tag);
switch (tag->type.type) {
+ case TAG_CALL: call_clean(&tag->data.call); break;
case TAG_INTEGER: integer_clean(&tag->data.integer); break;
case TAG_LIST: list_delete(tag->data.list); break;
case TAG_QUOTE: quote_clean(tag->data.quote); break;
@@ -168,7 +169,7 @@ s8 tag_compare (const s_tag *a, const s_tag *b) {
case TAG_U16: return u16_compare(a->data.u16, b->data.u16);
case TAG_U32: return u32_compare(a->data.u32, b->data.u32);
case TAG_U64: return u64_compare(a->data.u64, b->data.u64);
- case TAG_VAR: return ptr_compare(a, b);
+ case TAG_VAR: return ptr_compare(a->data.var, b->data.var);
}
assert(! "tag_compare: error");
errx(1, "tag_compare");
@@ -180,6 +181,7 @@ s_tag * tag_copy (const s_tag *src, s_tag *dest)
assert(src);
assert(dest);
switch (src->type.type) {
+ case TAG_CALL: call_copy(&src->data.call, &dest->data.call); break;
case TAG_INTEGER:
integer_init(&dest->data.integer);
integer_copy(&src->data.integer, &dest->data.integer); break;
diff --git a/libc3/types.h b/libc3/types.h
index 8175c43..9e756be 100644
--- a/libc3/types.h
+++ b/libc3/types.h
@@ -129,7 +129,7 @@ typedef struct call {
s_list *args;
} s_call;
-typedef s_tag * p_var;
+typedef const s_tag * p_var;
typedef enum tag_type {
TAG_VOID = 0,
@@ -183,6 +183,7 @@ typedef union tag_data {
u16 u16;
u32 u32;
u64 u64;
+ p_var var;
} u_tag_data;
struct tag {
@@ -283,7 +284,7 @@ typedef s_tag ** p_facts_spec;
typedef struct facts_spec_cursor {
p_facts_spec spec;
- s_tag *subject;
+ const s_tag *subject;
uw pos;
} s_facts_spec_cursor;
diff --git a/test/buf_parse_test.c b/test/buf_parse_test.c
index ff1ed74..8f5bc03 100644
--- a/test/buf_parse_test.c
+++ b/test/buf_parse_test.c
@@ -17,6 +17,7 @@
#include <string.h>
#include "../libc3/buf.h"
#include "../libc3/buf_parse.h"
+#include "../libc3/call.h"
#include "../libc3/list.h"
#include "../libc3/str.h"
#include "../libc3/integer.h"
@@ -42,6 +43,7 @@
test_context("buf_parse_call(" # test ")"); \
buf_init_1(&buf, (test)); \
TEST_EQ(buf_parse_call(&buf, &dest), strlen(test)); \
+ call_clean(&dest); \
buf_clean(&buf); \
test_context(NULL); \
} while (0)
diff --git a/test/call_test.c b/test/call_test.c
index d6fa930..9ed310e 100644
--- a/test/call_test.c
+++ b/test/call_test.c
@@ -13,6 +13,7 @@
*/
#include <string.h>
#include "../libc3/call.h"
+#include "../libc3/str.h"
#include "test.h"
#define CALL_TEST_INIT_1(test) \
@@ -30,7 +31,10 @@
call_init_1(&call, (test)); \
TEST_EQ(call_inspect(&call, &result), &result); \
TEST_EQ(result.size, strlen(test)); \
- TEST_STRNCMP(result.ptr.p, (test), result.size); \
+ if (g_test_last_ok) \
+ TEST_STRNCMP(result.ptr.p, (test), result.size); \
+ call_clean(&call); \
+ str_clean(&result); \
} while (0)
void call_test ();
diff --git a/test/fact_test.c b/test/fact_test.c
index 0321154..de63286 100644
--- a/test/fact_test.c
+++ b/test/fact_test.c
@@ -13,6 +13,7 @@
*/
#include <string.h>
#include "../libc3/fact.h"
+#include "../libc3/str.h"
#include "fact_test.h"
#include "test.h"
@@ -21,7 +22,9 @@
s_str str; \
TEST_EQ(fact_inspect(test, &str), &str); \
TEST_EQ(str.size, strlen(expected)); \
- TEST_STRNCMP(str.ptr.p, (expected), str.size); \
+ if (g_test_last_ok) \
+ TEST_STRNCMP(str.ptr.p, (expected), str.size); \
+ str_clean(&str); \
} while (0)
void fact_test ();
@@ -34,13 +37,18 @@ void fact_test ()
fact_test_inspect();
}
-s_fact * fact_test_clean (s_fact *fact)
+void fact_test_clean_1 (s_fact *fact)
+{
+ assert(fact);
+ tag_delete((s_tag *) fact->subject);
+}
+
+void fact_test_clean_3 (s_fact *fact)
{
assert(fact);
tag_delete((s_tag *) fact->subject);
tag_delete((s_tag *) fact->predicate);
tag_delete((s_tag *) fact->object);
- return fact;
}
void fact_test_init ()
@@ -58,7 +66,9 @@ void fact_test_init ()
s_fact * fact_test_init_1 (s_fact *fact, const s8 *tag)
{
- return fact_test_init_3(fact, tag, tag, tag);
+ assert(fact);
+ fact->subject = fact->predicate = fact->object = tag_new_1(tag);
+ return fact;
}
s_fact * fact_test_init_3 (s_fact *fact, const s8 *subject,
diff --git a/test/fact_test.h b/test/fact_test.h
index 67e437a..14c9054 100644
--- a/test/fact_test.h
+++ b/test/fact_test.h
@@ -44,7 +44,8 @@
} \
} while (0)
-s_fact * fact_test_clean (s_fact *fact);
+void fact_test_clean_1 (s_fact *fact);
+void fact_test_clean_3 (s_fact *fact);
s_fact * fact_test_init_1 (s_fact *fact, const s8 *tag);
s_fact * fact_test_init_3 (s_fact *fact, const s8 *subject,
const s8 *predicate, const s8 *object);
diff --git a/test/facts_cursor_test.c b/test/facts_cursor_test.c
index 0bfec79..e18ec9e 100644
--- a/test/facts_cursor_test.c
+++ b/test/facts_cursor_test.c
@@ -91,7 +91,7 @@ void facts_cursor_test_init ()
fact + 6), &cursor);
i = 0;
while (p[i]) {
- fact_test_clean(fact + i);
+ fact_test_clean_1(fact + i);
i++;
}
facts_clean(&facts);
@@ -203,7 +203,7 @@ void facts_cursor_test_next ()
TEST_EQ(facts_cursor_next(&cursor), NULL);
i = 0;
while (p[i]) {
- fact_test_clean(fact + i);
+ fact_test_clean_1(fact + i);
i++;
}
facts_clean(&facts);
diff --git a/test/facts_test.c b/test/facts_test.c
index 5d46050..02d98f5 100644
--- a/test/facts_test.c
+++ b/test/facts_test.c
@@ -87,7 +87,7 @@ void facts_test_add ()
TEST_EQ(tag_compare(fact[i].subject, pf->subject), 0);
TEST_EQ(tag_compare(fact[i].predicate, pf->predicate), 0);
TEST_EQ(tag_compare(fact[i].object, pf->object), 0);
- fact_test_clean(fact + i);
+ fact_test_clean_1(fact + i);
i++;
}
facts_clean(&facts);
@@ -133,6 +133,11 @@ void facts_test_dump ()
facts_dump(&facts, "facts_test_dump.facts");
test_file_compare("facts_test_dump.facts",
"facts_test_dump.facts.expected");
+ i = 0;
+ while (p[i]) {
+ fact_test_clean_1(fact + i);
+ i++;
+ }
facts_clean(&facts);
}
@@ -184,7 +189,7 @@ void facts_test_find ()
facts_remove_fact(&facts, fact + i);
TEST_EQ(facts_find_fact(&facts, fact + i), NULL);
TEST_EQ(facts_find_fact(&facts, fact + i), NULL);
- fact_test_clean(fact + i);
+ fact_test_clean_1(fact + i);
}
facts_clean(&facts);
}
@@ -252,7 +257,7 @@ void facts_test_log_add ()
while (p[i]) {
fact_test_init_1(fact + i, p[i]);
facts_add_fact(&facts, fact + i);
- fact_test_clean(fact + i);
+ fact_test_clean_1(fact + i);
i++;
}
facts_clean(&facts);
@@ -306,6 +311,11 @@ void facts_test_log_remove ()
while (i--) {
facts_remove_fact(&facts, fact + i);
}
+ i = 0;
+ while (p[i]) {
+ fact_test_clean_1(fact + i);
+ i++;
+ }
facts_clean(&facts);
buf_file_close(&log);
fclose(fp);
@@ -380,7 +390,7 @@ void facts_test_remove ()
TEST_EQ(facts_remove_fact(&facts, fact + i), false);
TEST_EQ(facts.tags.count, i);
TEST_EQ(facts.facts.count, i);
- fact_test_clean(fact + i);
+ fact_test_clean_1(fact + i);
}
facts_clean(&facts);
}
diff --git a/test/facts_test_dump.facts b/test/facts_test_dump.facts
deleted file mode 100644
index bebffb3..0000000
--- a/test/facts_test_dump.facts
+++ /dev/null
@@ -1,23 +0,0 @@
-add {a, a, a}
-add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
-add {18446744073709551616, 18446744073709551616, 18446744073709551616}
-add {-4294967296, -4294967296, -4294967296}
-add {-65536, -65536, -65536}
-add {-256, -256, -256}
-add {-10, -10, -10}
-add {-1, -1, -1}
-add {0, 0, 0}
-add {1, 1, 1}
-add {10, 10, 10}
-add {256, 256, 256}
-add {65536, 65536, 65536}
-add {4294967296, 4294967296, 4294967296}
-add {[], [], []}
-add {[[], []], [[], []], [[], []]}
-add {"a", "a", "a"}
-add {A, A, A}
-add {:a, :a, :a}
-add {{a, b}, {a, b}, {a, b}}
-add {{:a, :b}, {:a, :b}, {:a, :b}}
-add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
-add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
diff --git a/test/facts_test_log_add.facts b/test/facts_test_log_add.facts
deleted file mode 100644
index 5286f7a..0000000
--- a/test/facts_test_log_add.facts
+++ /dev/null
@@ -1,23 +0,0 @@
-add {"a", "a", "a"}
-add {:a, :a, :a}
-add {A, A, A}
-add {a, a, a}
-add {[], [], []}
-add {[[], []], [[], []], [[], []]}
-add {{:a, :b}, {:a, :b}, {:a, :b}}
-add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
-add {{a, b}, {a, b}, {a, b}}
-add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
-add {0, 0, 0}
-add {1, 1, 1}
-add {10, 10, 10}
-add {256, 256, 256}
-add {65536, 65536, 65536}
-add {4294967296, 4294967296, 4294967296}
-add {18446744073709551616, 18446744073709551616, 18446744073709551616}
-add {-1, -1, -1}
-add {-10, -10, -10}
-add {-256, -256, -256}
-add {-65536, -65536, -65536}
-add {-4294967296, -4294967296, -4294967296}
-add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
diff --git a/test/facts_test_log_remove.facts b/test/facts_test_log_remove.facts
deleted file mode 100644
index f96c838..0000000
--- a/test/facts_test_log_remove.facts
+++ /dev/null
@@ -1,46 +0,0 @@
-add {"a", "a", "a"}
-add {:a, :a, :a}
-add {A, A, A}
-add {a, a, a}
-add {[], [], []}
-add {[[], []], [[], []], [[], []]}
-add {{:a, :b}, {:a, :b}, {:a, :b}}
-add {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
-add {{a, b}, {a, b}, {a, b}}
-add {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
-add {0, 0, 0}
-add {1, 1, 1}
-add {10, 10, 10}
-add {256, 256, 256}
-add {65536, 65536, 65536}
-add {4294967296, 4294967296, 4294967296}
-add {18446744073709551616, 18446744073709551616, 18446744073709551616}
-add {-1, -1, -1}
-add {-10, -10, -10}
-add {-256, -256, -256}
-add {-65536, -65536, -65536}
-add {-4294967296, -4294967296, -4294967296}
-add {-18446744073709551616, -18446744073709551616, -18446744073709551616}
-remove {-18446744073709551616, -18446744073709551616, -18446744073709551616}
-remove {-4294967296, -4294967296, -4294967296}
-remove {-65536, -65536, -65536}
-remove {-256, -256, -256}
-remove {-10, -10, -10}
-remove {-1, -1, -1}
-remove {18446744073709551616, 18446744073709551616, 18446744073709551616}
-remove {4294967296, 4294967296, 4294967296}
-remove {65536, 65536, 65536}
-remove {256, 256, 256}
-remove {10, 10, 10}
-remove {1, 1, 1}
-remove {0, 0, 0}
-remove {{{a, b}, {c, d}}, {{a, b}, {c, d}}, {{a, b}, {c, d}}}
-remove {{a, b}, {a, b}, {a, b}}
-remove {{{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}, {{:a, :b}, {:c, :d}}}
-remove {{:a, :b}, {:a, :b}, {:a, :b}}
-remove {[[], []], [[], []], [[], []]}
-remove {[], [], []}
-remove {a, a, a}
-remove {A, A, A}
-remove {:a, :a, :a}
-remove {"a", "a", "a"}
diff --git a/test/facts_with_test.c b/test/facts_with_test.c
index 9638bfb..bded6a7 100644
--- a/test/facts_with_test.c
+++ b/test/facts_with_test.c
@@ -109,21 +109,25 @@ void facts_with_test_ ()
&object,
NULL, NULL });
TEST_ASSERT(facts_with_cursor_next(&cursor));
- TAG_TEST_EQ(&subject, tag);
- TAG_TEST_EQ(&predicate, tag + 1);
- TAG_TEST_EQ(&object, tag + 2);
+ TAG_TEST_EQ(subject.data.var, tag);
+ TAG_TEST_EQ(predicate.data.var, tag + 1);
+ TAG_TEST_EQ(object.data.var, tag + 2);
TEST_ASSERT(facts_with_cursor_next(&cursor));
- TAG_TEST_EQ(&subject, tag + 5);
- TAG_TEST_EQ(&predicate, tag + 1);
- TAG_TEST_EQ(&object, tag + 2);
+ TAG_TEST_EQ(subject.data.var, tag);
+ TAG_TEST_EQ(predicate.data.var, tag + 1);
+ TAG_TEST_EQ(object.data.var, tag + 3);
TEST_ASSERT(facts_with_cursor_next(&cursor));
- TAG_TEST_EQ(&subject, tag);
- TAG_TEST_EQ(&predicate, tag + 1);
- TAG_TEST_EQ(&object, tag + 3);
+ TAG_TEST_EQ(subject.data.var, tag + 5);
+ TAG_TEST_EQ(predicate.data.var, tag + 1);
+ TAG_TEST_EQ(object.data.var, tag + 2);
TEST_ASSERT(facts_with_cursor_next(&cursor));
- TAG_TEST_EQ(&subject, tag);
- TAG_TEST_EQ(&predicate, tag + 4);
- TAG_TEST_EQ(&object, tag + 3);
+ TAG_TEST_EQ(subject.data.var, tag);
+ TAG_TEST_EQ(predicate.data.var, tag + 1);
+ TAG_TEST_EQ(object.data.var, tag + 3);
+ TEST_ASSERT(facts_with_cursor_next(&cursor));
+ TAG_TEST_EQ(subject.data.var, tag);
+ TAG_TEST_EQ(predicate.data.var, tag + 4);
+ TAG_TEST_EQ(object.data.var, tag + 3);
TEST_EQ(facts_with_cursor_next(&cursor), NULL);
TEST_EQ(facts_with_cursor_next(&cursor), NULL);
facts_with_cursor_clean(&cursor);
diff --git a/test/set__fact_test.c b/test/set__fact_test.c
index 4dda7f1..54bd407 100644
--- a/test/set__fact_test.c
+++ b/test/set__fact_test.c
@@ -133,7 +133,7 @@ void set__fact_test_add ()
}
i = 0;
while (p[i]) {
- fact_test_clean(fact + i);
+ fact_test_clean_1(fact + i);
i++;
}
set_clean__fact(&set);
@@ -183,7 +183,7 @@ void set__fact_test_cursor ()
while (i--) {
set_remove__fact(&set, fact + i);
SET__FACT_TEST_CURSOR(i);
- fact_test_clean(fact + i);
+ fact_test_clean_1(fact + i);
}
set_clean__fact(&set);
}
@@ -263,7 +263,7 @@ void set__fact_test_remove ()
i = set.count;
while (i--) {
SET__FACT_TEST_REMOVE(fact + i, i);
- fact_test_clean(fact + i);
+ fact_test_clean_1(fact + i);
}
set_clean__fact(&set);
}
@@ -341,8 +341,10 @@ void set__fact_test_resize ()
SET__FACT_TEST_RESIZE(32768);
SET__FACT_TEST_RESIZE(65536);
SET__FACT_TEST_RESIZE(65536);
- i = set.count;
- while (i--)
- fact_test_clean(fact + i);
+ i = 0;
+ while (p[i]) {
+ fact_test_clean_1(fact + i);
+ i++;
+ }
set_clean__fact(&set);
}
diff --git a/test/skiplist__fact_test.c b/test/skiplist__fact_test.c
index cb846a2..5d34cf1 100644
--- a/test/skiplist__fact_test.c
+++ b/test/skiplist__fact_test.c
@@ -130,7 +130,7 @@ void skiplist__fact_test_find ()
while (i--) {
skiplist_remove__fact(skiplist, fact + i);
TEST_ASSERT(! skiplist_find__fact(skiplist, fact + i));
- fact_test_clean(fact + i);
+ fact_test_clean_1(fact + i);
}
skiplist_clean__fact(skiplist);
}
@@ -190,7 +190,7 @@ void skiplist__fact_test_insert ()
}
i = 0;
while (p[i]) {
- fact_test_clean(fact + i);
+ fact_test_clean_1(fact + i);
i++;
}
}
@@ -268,7 +268,7 @@ void skiplist__fact_test_remove ()
i = skiplist->length;
while (i--) {
SKIPLIST__FACT_TEST_REMOVE(fact + i, i);
- fact_test_clean(fact + i);
+ fact_test_clean_1(fact + i);
}
skiplist_clean__fact(skiplist);
}
diff --git a/test/tag_test.h b/test/tag_test.h
index ebd7d00..2c72d2c 100644
--- a/test/tag_test.h
+++ b/test/tag_test.h
@@ -18,8 +18,8 @@
#define TAG_TEST_EQ(test, expected) \
do { \
- s_tag *tag_expected; \
- s_tag *tag_test; \
+ const s_tag *tag_expected; \
+ const s_tag *tag_test; \
tag_expected = (expected); \
tag_test = (test); \
if (tag_compare(tag_test, tag_expected) == 0) { \