|
@@ -11,7 +11,7 @@
|
11
|
11
|
START_TEST(init)
|
12
|
12
|
{
|
13
|
13
|
asmsh_symtable_t st;
|
14
|
|
- ck_assert_int_eq(asmsh_symtable_init(&st,0), 0);
|
|
14
|
+ ck_assert_int_eq(asmsh_symtable_init(&st), 0);
|
15
|
15
|
asmsh_symtable_clean(&st);
|
16
|
16
|
}
|
17
|
17
|
END_TEST
|
|
@@ -19,14 +19,14 @@ END_TEST
|
19
|
19
|
START_TEST(add)
|
20
|
20
|
{
|
21
|
21
|
asmsh_symtable_t st;
|
22
|
|
- ck_assert_int_eq(asmsh_symtable_init(&st,0), 0);
|
23
|
|
- ck_assert_int_eq(asmsh_symtable_add(&st, "b", NULL), 0);
|
|
22
|
+ ck_assert_int_eq(asmsh_symtable_init(&st), 0);
|
|
23
|
+ ck_assert_int_eq(asmsh_symtable_add(&st, "b", 0), 0);
|
24
|
24
|
ck_assert_int_eq(st.syms_sz, 1);
|
25
|
|
- ck_assert_int_eq(asmsh_symtable_add(&st, "a", NULL), 0);
|
|
25
|
+ ck_assert_int_eq(asmsh_symtable_add(&st, "a", 0), 0);
|
26
|
26
|
ck_assert_int_eq(st.syms_sz, 2);
|
27
|
|
- ck_assert_int_eq(asmsh_symtable_add(&st, "a", NULL), 0);
|
|
27
|
+ ck_assert_int_eq(asmsh_symtable_add(&st, "a", 0), 0);
|
28
|
28
|
ck_assert_int_eq(st.syms_sz, 2);
|
29
|
|
- ck_assert_int_eq(asmsh_symtable_add(&st, "ab", NULL), 0);
|
|
29
|
+ ck_assert_int_eq(asmsh_symtable_add(&st, "ab", 0), 0);
|
30
|
30
|
ck_assert_int_eq(st.syms_sz, 3);
|
31
|
31
|
asmsh_symtable_clean(&st);
|
32
|
32
|
}
|
|
@@ -36,18 +36,18 @@ START_TEST(del)
|
36
|
36
|
{
|
37
|
37
|
|
38
|
38
|
asmsh_symtable_t st;
|
39
|
|
- ck_assert_int_eq(asmsh_symtable_init(&st,0), 0);
|
|
39
|
+ ck_assert_int_eq(asmsh_symtable_init(&st), 0);
|
40
|
40
|
ck_assert_int_eq(asmsh_symtable_del(&st, "a"), 0);
|
41
|
|
- ck_assert_int_eq(asmsh_symtable_add(&st, "a", NULL), 0);
|
|
41
|
+ ck_assert_int_eq(asmsh_symtable_add(&st, "a", 0), 0);
|
42
|
42
|
ck_assert_int_eq(asmsh_symtable_del(&st, "a"), 1);
|
43
|
43
|
ck_assert_int_eq(asmsh_symtable_del(&st, "a"), 0);
|
44
|
|
- ck_assert_int_eq(asmsh_symtable_add(&st, "a", NULL), 0);
|
45
|
|
- ck_assert_int_eq(asmsh_symtable_add(&st, "b", NULL), 0);
|
46
|
|
- ck_assert_int_eq(asmsh_symtable_add(&st, "c", NULL), 0);
|
|
44
|
+ ck_assert_int_eq(asmsh_symtable_add(&st, "a", 0), 0);
|
|
45
|
+ ck_assert_int_eq(asmsh_symtable_add(&st, "b", 0), 0);
|
|
46
|
+ ck_assert_int_eq(asmsh_symtable_add(&st, "c", 0), 0);
|
47
|
47
|
ck_assert_int_eq(asmsh_symtable_del(&st, "d"), 0);
|
48
|
48
|
ck_assert_int_eq(asmsh_symtable_del(&st, "b"), 1);
|
49
|
49
|
ck_assert_int_eq(asmsh_symtable_del(&st, "b"), 0);
|
50
|
|
- ck_assert_int_eq(asmsh_symtable_add(&st, "b", NULL), 0);
|
|
50
|
+ ck_assert_int_eq(asmsh_symtable_add(&st, "b", 0), 0);
|
51
|
51
|
ck_assert_int_eq(asmsh_symtable_del(&st, "a"), 1);
|
52
|
52
|
ck_assert_int_eq(asmsh_symtable_del(&st, "a"), 0);
|
53
|
53
|
asmsh_symtable_clean(&st);
|
|
@@ -59,16 +59,16 @@ START_TEST(get)
|
59
|
59
|
{
|
60
|
60
|
asmsh_symtable_t st;
|
61
|
61
|
const asmsh_sym_t *s;
|
62
|
|
- ck_assert_int_eq(asmsh_symtable_init(&st,0), 0);
|
|
62
|
+ ck_assert_int_eq(asmsh_symtable_init(&st), 0);
|
63
|
63
|
ck_assert_ptr_null(asmsh_symtable_get(&st, "a"));
|
64
|
|
- ck_assert_int_eq(asmsh_symtable_add(&st, "a", NULL), 0);
|
|
64
|
+ ck_assert_int_eq(asmsh_symtable_add(&st, "a", 0), 0);
|
65
|
65
|
s = asmsh_symtable_get(&st, "a");
|
66
|
66
|
ck_assert_ptr_nonnull(s);
|
67
|
|
- ck_assert_ptr_null(s->val);
|
68
|
|
- ck_assert_int_eq(asmsh_symtable_add(&st, "a", (void*)42), 0);
|
|
67
|
+ ck_assert_int_eq(s->addr, 0);
|
|
68
|
+ ck_assert_int_eq(asmsh_symtable_add(&st, "a", 42), 0);
|
69
|
69
|
s = asmsh_symtable_get(&st, "a");
|
70
|
70
|
ck_assert_ptr_nonnull(s);
|
71
|
|
- ck_assert_ptr_eq(s->val, (void*)42);
|
|
71
|
+ ck_assert_int_eq(s->addr, 42);
|
72
|
72
|
asmsh_symtable_clean(&st);
|
73
|
73
|
}
|
74
|
74
|
END_TEST
|
|
@@ -76,12 +76,12 @@ END_TEST
|
76
|
76
|
START_TEST(_realloc)
|
77
|
77
|
{
|
78
|
78
|
asmsh_symtable_t st;
|
79
|
|
- ck_assert_int_eq(asmsh_symtable_init(&st,0), 0);
|
|
79
|
+ ck_assert_int_eq(asmsh_symtable_init(&st), 0);
|
80
|
80
|
for(int i=0; i<ASMSH_SYMALLOC*3; i++)
|
81
|
81
|
{
|
82
|
82
|
char buf[16];
|
83
|
83
|
snprintf(buf, 15, "a%d", i);
|
84
|
|
- ck_assert_int_eq(asmsh_symtable_add(&st, buf, NULL), 0);
|
|
84
|
+ ck_assert_int_eq(asmsh_symtable_add(&st, buf, 0), 0);
|
85
|
85
|
}
|
86
|
86
|
for(int i=0; i<ASMSH_SYMALLOC*3; i++)
|
87
|
87
|
{
|