Skip to content

Commit 8046095

Browse files
committed
fixed specs broken by update to symbol struct which affected _t_hash calculation
1 parent c06082e commit 8046095

File tree

5 files changed

+1745
-1686
lines changed

5 files changed

+1745
-1686
lines changed

spec/accumulator_spec.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void testAccToken() {
182182
token1 = _a_gen_token(&i,x,d1);
183183
token2 = _a_gen_token(&i,x,d2);
184184

185-
spec_is_str_equal(t2s(i),"(INSTANCE_STORE (INSTANCES (SYMBOL_INSTANCES:TEST_INT_SYMBOL (TEST_INT_SYMBOL:1))) (INSTANCE_TOKENS (LAST_TOKEN:2) (INSTANCE_TOKEN:1 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:1156909558)) (INSTANCE_TOKEN:2 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:1552538631))))");
185+
spec_is_str_equal(t2s(i),"(INSTANCE_STORE (INSTANCES (SYMBOL_INSTANCES:TEST_INT_SYMBOL (TEST_INT_SYMBOL:1))) (INSTANCE_TOKENS (LAST_TOKEN:2) (INSTANCE_TOKEN:1 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:-1641288256)) (INSTANCE_TOKEN:2 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:1282387645))))");
186186

187187
// test getting back xaddrs from tokens and their dependency
188188
xx = _a_get_token_xaddr(&i,token1,d1);
@@ -201,7 +201,7 @@ void testAccToken() {
201201
xx = _a_get_token_xaddr(&i,token1,d3);
202202
spec_is_true(is_null_xaddr(xx));
203203
_a_add_dependency(&i,token1,d3);
204-
char *with_two_dependencies = "(INSTANCE_STORE (INSTANCES (SYMBOL_INSTANCES:TEST_INT_SYMBOL (TEST_INT_SYMBOL:1))) (INSTANCE_TOKENS (LAST_TOKEN:2) (INSTANCE_TOKEN:1 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:1156909558) (DEPENDENCY_HASH:1973223375)) (INSTANCE_TOKEN:2 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:1552538631))))";
204+
char *with_two_dependencies = "(INSTANCE_STORE (INSTANCES (SYMBOL_INSTANCES:TEST_INT_SYMBOL (TEST_INT_SYMBOL:1))) (INSTANCE_TOKENS (LAST_TOKEN:2) (INSTANCE_TOKEN:1 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:-1641288256) (DEPENDENCY_HASH:-226474859)) (INSTANCE_TOKEN:2 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:1282387645))))";
205205
spec_is_str_equal(t2s(i),with_two_dependencies);
206206
// check that dependency isn't added in twice
207207
_a_add_dependency(&i,token1,d3);
@@ -215,13 +215,13 @@ void testAccToken() {
215215

216216
// test deleting a dependency
217217
_a_delete_dependency(&i,token1,d3);
218-
spec_is_str_equal(t2s(i),"(INSTANCE_STORE (INSTANCES (SYMBOL_INSTANCES:TEST_INT_SYMBOL (TEST_INT_SYMBOL:1))) (INSTANCE_TOKENS (LAST_TOKEN:2) (INSTANCE_TOKEN:1 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:1156909558)) (INSTANCE_TOKEN:2 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:1552538631))))");
218+
spec_is_str_equal(t2s(i),"(INSTANCE_STORE (INSTANCES (SYMBOL_INSTANCES:TEST_INT_SYMBOL (TEST_INT_SYMBOL:1))) (INSTANCE_TOKENS (LAST_TOKEN:2) (INSTANCE_TOKEN:1 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:-1641288256)) (INSTANCE_TOKEN:2 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:1282387645))))");
219219
xx = _a_get_token_xaddr(&i,token1,d3);
220220
spec_is_true(is_null_xaddr(xx));
221221

222222
// test deleting a token
223223
_a_delete_token(&i,token1);
224-
spec_is_str_equal(t2s(i),"(INSTANCE_STORE (INSTANCES (SYMBOL_INSTANCES:TEST_INT_SYMBOL (TEST_INT_SYMBOL:1))) (INSTANCE_TOKENS (LAST_TOKEN:2) (INSTANCE_TOKEN:2 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:1552538631))))");
224+
spec_is_str_equal(t2s(i),"(INSTANCE_STORE (INSTANCES (SYMBOL_INSTANCES:TEST_INT_SYMBOL (TEST_INT_SYMBOL:1))) (INSTANCE_TOKENS (LAST_TOKEN:2) (INSTANCE_TOKEN:2 (TOKEN_XADDR:TEST_INT_SYMBOL.1) (DEPENDENCY_HASH:1282387645))))");
225225

226226
_t_free(token1);
227227
_t_free(token2);

src/tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1724,7 +1724,7 @@ char * _t2rawjson(SemTable *sem,T *t,int level,char *buf) {
17241724
buf+= strlen(buf);
17251725
_add_sem(buf,s);
17261726
buf+= strlen(buf);
1727-
if (is_symbol(s)) {
1727+
if (is_symbol(s) && !semeq(s,NULL_SYMBOL)) {
17281728
Structure st = _sem_get_symbol_structure(sem,s);
17291729

17301730
if (is_sys_structure(st)) {

web/homeloc.json

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,71 @@
1-
{ "symbol":{ "context":3,"id":46 },"type":"latlong","name":"home_location","children":[
2-
{ "symbol":{ "context":3,"id":44 },"type":"float","name":"latitude","children":[
3-
{ "symbol":{ "context":3,"id":42 },"type":"integer","name":"mantissa","children":[
4-
{ "symbol":{ "context":3,"id":26 },"type":"BIT","name":"exp0","surface":0},
5-
{ "symbol":{ "context":3,"id":27 },"type":"BIT","name":"exp1","surface":1},
6-
{ "symbol":{ "context":3,"id":28 },"type":"BIT","name":"exp2","surface":1},
7-
{ "symbol":{ "context":3,"id":29 },"type":"BIT","name":"exp3","surface":0},
8-
{ "symbol":{ "context":3,"id":30 },"type":"BIT","name":"exp4","surface":1},
9-
{ "symbol":{ "context":3,"id":31 },"type":"BIT","name":"exp5","surface":0},
10-
{ "symbol":{ "context":3,"id":32 },"type":"BIT","name":"exp6","surface":0},
11-
{ "symbol":{ "context":3,"id":33 },"type":"BIT","name":"exp7","surface":0},
12-
{ "symbol":{ "context":3,"id":34 },"type":"BIT","name":"exp8","surface":0},
13-
{ "symbol":{ "context":3,"id":35 },"type":"BIT","name":"exp9","surface":0},
14-
{ "symbol":{ "context":3,"id":36 },"type":"BIT","name":"exp10","surface":0},
15-
{ "symbol":{ "context":3,"id":37 },"type":"BIT","name":"exp11","surface":0},
16-
{ "symbol":{ "context":3,"id":38 },"type":"BIT","name":"exp12","surface":0},
17-
{ "symbol":{ "context":3,"id":39 },"type":"BIT","name":"exp13","surface":0},
18-
{ "symbol":{ "context":3,"id":40 },"type":"BIT","name":"exp14","surface":0},
19-
{ "symbol":{ "context":3,"id":41 },"type":"BIT","name":"exp15","surface":0}]},
20-
{ "symbol":{ "context":3,"id":43 },"type":"integer","name":"exponent","children":[
21-
{ "symbol":{ "context":3,"id":26 },"type":"BIT","name":"exp0","surface":1},
22-
{ "symbol":{ "context":3,"id":27 },"type":"BIT","name":"exp1","surface":0},
23-
{ "symbol":{ "context":3,"id":28 },"type":"BIT","name":"exp2","surface":0},
24-
{ "symbol":{ "context":3,"id":29 },"type":"BIT","name":"exp3","surface":0},
25-
{ "symbol":{ "context":3,"id":30 },"type":"BIT","name":"exp4","surface":0},
26-
{ "symbol":{ "context":3,"id":31 },"type":"BIT","name":"exp5","surface":0},
27-
{ "symbol":{ "context":3,"id":32 },"type":"BIT","name":"exp6","surface":0},
28-
{ "symbol":{ "context":3,"id":33 },"type":"BIT","name":"exp7","surface":0},
29-
{ "symbol":{ "context":3,"id":34 },"type":"BIT","name":"exp8","surface":0},
30-
{ "symbol":{ "context":3,"id":35 },"type":"BIT","name":"exp9","surface":0},
31-
{ "symbol":{ "context":3,"id":36 },"type":"BIT","name":"exp10","surface":0},
32-
{ "symbol":{ "context":3,"id":37 },"type":"BIT","name":"exp11","surface":0},
33-
{ "symbol":{ "context":3,"id":38 },"type":"BIT","name":"exp12","surface":0},
34-
{ "symbol":{ "context":3,"id":39 },"type":"BIT","name":"exp13","surface":0},
35-
{ "symbol":{ "context":3,"id":40 },"type":"BIT","name":"exp14","surface":0},
36-
{ "symbol":{ "context":3,"id":41 },"type":"BIT","name":"exp15","surface":0}]}]},
37-
{ "symbol":{ "context":3,"id":45 },"type":"float","name":"longitude","children":[
38-
{ "symbol":{ "context":3,"id":42 },"type":"integer","name":"mantissa","children":[
39-
{ "symbol":{ "context":3,"id":26 },"type":"BIT","name":"exp0","surface":1},
40-
{ "symbol":{ "context":3,"id":27 },"type":"BIT","name":"exp1","surface":0},
41-
{ "symbol":{ "context":3,"id":28 },"type":"BIT","name":"exp2","surface":0},
42-
{ "symbol":{ "context":3,"id":29 },"type":"BIT","name":"exp3","surface":0},
43-
{ "symbol":{ "context":3,"id":30 },"type":"BIT","name":"exp4","surface":0},
44-
{ "symbol":{ "context":3,"id":31 },"type":"BIT","name":"exp5","surface":0},
45-
{ "symbol":{ "context":3,"id":32 },"type":"BIT","name":"exp6","surface":0},
46-
{ "symbol":{ "context":3,"id":33 },"type":"BIT","name":"exp7","surface":0},
47-
{ "symbol":{ "context":3,"id":34 },"type":"BIT","name":"exp8","surface":0},
48-
{ "symbol":{ "context":3,"id":35 },"type":"BIT","name":"exp9","surface":0},
49-
{ "symbol":{ "context":3,"id":36 },"type":"BIT","name":"exp10","surface":0},
50-
{ "symbol":{ "context":3,"id":37 },"type":"BIT","name":"exp11","surface":0},
51-
{ "symbol":{ "context":3,"id":38 },"type":"BIT","name":"exp12","surface":0},
52-
{ "symbol":{ "context":3,"id":39 },"type":"BIT","name":"exp13","surface":0},
53-
{ "symbol":{ "context":3,"id":40 },"type":"BIT","name":"exp14","surface":0},
54-
{ "symbol":{ "context":3,"id":41 },"type":"BIT","name":"exp15","surface":0}]},
55-
{ "symbol":{ "context":3,"id":43 },"type":"integer","name":"exponent","children":[
56-
{ "symbol":{ "context":3,"id":26 },"type":"BIT","name":"exp0","surface":0},
57-
{ "symbol":{ "context":3,"id":27 },"type":"BIT","name":"exp1","surface":1},
58-
{ "symbol":{ "context":3,"id":28 },"type":"BIT","name":"exp2","surface":0},
59-
{ "symbol":{ "context":3,"id":29 },"type":"BIT","name":"exp3","surface":0},
60-
{ "symbol":{ "context":3,"id":30 },"type":"BIT","name":"exp4","surface":0},
61-
{ "symbol":{ "context":3,"id":31 },"type":"BIT","name":"exp5","surface":0},
62-
{ "symbol":{ "context":3,"id":32 },"type":"BIT","name":"exp6","surface":0},
63-
{ "symbol":{ "context":3,"id":33 },"type":"BIT","name":"exp7","surface":0},
64-
{ "symbol":{ "context":3,"id":34 },"type":"BIT","name":"exp8","surface":0},
65-
{ "symbol":{ "context":3,"id":35 },"type":"BIT","name":"exp9","surface":0},
66-
{ "symbol":{ "context":3,"id":36 },"type":"BIT","name":"exp10","surface":0},
67-
{ "symbol":{ "context":3,"id":37 },"type":"BIT","name":"exp11","surface":0},
68-
{ "symbol":{ "context":3,"id":38 },"type":"BIT","name":"exp12","surface":0},
69-
{ "symbol":{ "context":3,"id":39 },"type":"BIT","name":"exp13","surface":0},
70-
{ "symbol":{ "context":3,"id":40 },"type":"BIT","name":"exp14","surface":0},
71-
{ "symbol":{ "context":3,"id":41 },"type":"BIT","name":"exp15","surface":0}]}]}]}
1+
{ "symbol":{ "context":3,"id":79 },"type":"latlong","name":"home_location","children":[
2+
{ "symbol":{ "context":3,"id":77 },"type":"float","name":"latitude","children":[
3+
{ "symbol":{ "context":3,"id":75 },"type":"integer","name":"mantissa","children":[
4+
{ "symbol":{ "context":3,"id":59 },"type":"BIT","name":"exp0","surface":0},
5+
{ "symbol":{ "context":3,"id":60 },"type":"BIT","name":"exp1","surface":1},
6+
{ "symbol":{ "context":3,"id":61 },"type":"BIT","name":"exp2","surface":1},
7+
{ "symbol":{ "context":3,"id":62 },"type":"BIT","name":"exp3","surface":0},
8+
{ "symbol":{ "context":3,"id":63 },"type":"BIT","name":"exp4","surface":1},
9+
{ "symbol":{ "context":3,"id":64 },"type":"BIT","name":"exp5","surface":0},
10+
{ "symbol":{ "context":3,"id":65 },"type":"BIT","name":"exp6","surface":0},
11+
{ "symbol":{ "context":3,"id":66 },"type":"BIT","name":"exp7","surface":0},
12+
{ "symbol":{ "context":3,"id":67 },"type":"BIT","name":"exp8","surface":0},
13+
{ "symbol":{ "context":3,"id":68 },"type":"BIT","name":"exp9","surface":0},
14+
{ "symbol":{ "context":3,"id":69 },"type":"BIT","name":"exp10","surface":0},
15+
{ "symbol":{ "context":3,"id":70 },"type":"BIT","name":"exp11","surface":0},
16+
{ "symbol":{ "context":3,"id":71 },"type":"BIT","name":"exp12","surface":0},
17+
{ "symbol":{ "context":3,"id":72 },"type":"BIT","name":"exp13","surface":0},
18+
{ "symbol":{ "context":3,"id":73 },"type":"BIT","name":"exp14","surface":0},
19+
{ "symbol":{ "context":3,"id":74 },"type":"BIT","name":"exp15","surface":0}]},
20+
{ "symbol":{ "context":3,"id":76 },"type":"integer","name":"exponent","children":[
21+
{ "symbol":{ "context":3,"id":59 },"type":"BIT","name":"exp0","surface":1},
22+
{ "symbol":{ "context":3,"id":60 },"type":"BIT","name":"exp1","surface":0},
23+
{ "symbol":{ "context":3,"id":61 },"type":"BIT","name":"exp2","surface":0},
24+
{ "symbol":{ "context":3,"id":62 },"type":"BIT","name":"exp3","surface":0},
25+
{ "symbol":{ "context":3,"id":63 },"type":"BIT","name":"exp4","surface":0},
26+
{ "symbol":{ "context":3,"id":64 },"type":"BIT","name":"exp5","surface":0},
27+
{ "symbol":{ "context":3,"id":65 },"type":"BIT","name":"exp6","surface":0},
28+
{ "symbol":{ "context":3,"id":66 },"type":"BIT","name":"exp7","surface":0},
29+
{ "symbol":{ "context":3,"id":67 },"type":"BIT","name":"exp8","surface":0},
30+
{ "symbol":{ "context":3,"id":68 },"type":"BIT","name":"exp9","surface":0},
31+
{ "symbol":{ "context":3,"id":69 },"type":"BIT","name":"exp10","surface":0},
32+
{ "symbol":{ "context":3,"id":70 },"type":"BIT","name":"exp11","surface":0},
33+
{ "symbol":{ "context":3,"id":71 },"type":"BIT","name":"exp12","surface":0},
34+
{ "symbol":{ "context":3,"id":72 },"type":"BIT","name":"exp13","surface":0},
35+
{ "symbol":{ "context":3,"id":73 },"type":"BIT","name":"exp14","surface":0},
36+
{ "symbol":{ "context":3,"id":74 },"type":"BIT","name":"exp15","surface":0}]}]},
37+
{ "symbol":{ "context":3,"id":78 },"type":"float","name":"longitude","children":[
38+
{ "symbol":{ "context":3,"id":75 },"type":"integer","name":"mantissa","children":[
39+
{ "symbol":{ "context":3,"id":59 },"type":"BIT","name":"exp0","surface":1},
40+
{ "symbol":{ "context":3,"id":60 },"type":"BIT","name":"exp1","surface":0},
41+
{ "symbol":{ "context":3,"id":61 },"type":"BIT","name":"exp2","surface":0},
42+
{ "symbol":{ "context":3,"id":62 },"type":"BIT","name":"exp3","surface":0},
43+
{ "symbol":{ "context":3,"id":63 },"type":"BIT","name":"exp4","surface":0},
44+
{ "symbol":{ "context":3,"id":64 },"type":"BIT","name":"exp5","surface":0},
45+
{ "symbol":{ "context":3,"id":65 },"type":"BIT","name":"exp6","surface":0},
46+
{ "symbol":{ "context":3,"id":66 },"type":"BIT","name":"exp7","surface":0},
47+
{ "symbol":{ "context":3,"id":67 },"type":"BIT","name":"exp8","surface":0},
48+
{ "symbol":{ "context":3,"id":68 },"type":"BIT","name":"exp9","surface":0},
49+
{ "symbol":{ "context":3,"id":69 },"type":"BIT","name":"exp10","surface":0},
50+
{ "symbol":{ "context":3,"id":70 },"type":"BIT","name":"exp11","surface":0},
51+
{ "symbol":{ "context":3,"id":71 },"type":"BIT","name":"exp12","surface":0},
52+
{ "symbol":{ "context":3,"id":72 },"type":"BIT","name":"exp13","surface":0},
53+
{ "symbol":{ "context":3,"id":73 },"type":"BIT","name":"exp14","surface":0},
54+
{ "symbol":{ "context":3,"id":74 },"type":"BIT","name":"exp15","surface":0}]},
55+
{ "symbol":{ "context":3,"id":76 },"type":"integer","name":"exponent","children":[
56+
{ "symbol":{ "context":3,"id":59 },"type":"BIT","name":"exp0","surface":0},
57+
{ "symbol":{ "context":3,"id":60 },"type":"BIT","name":"exp1","surface":1},
58+
{ "symbol":{ "context":3,"id":61 },"type":"BIT","name":"exp2","surface":0},
59+
{ "symbol":{ "context":3,"id":62 },"type":"BIT","name":"exp3","surface":0},
60+
{ "symbol":{ "context":3,"id":63 },"type":"BIT","name":"exp4","surface":0},
61+
{ "symbol":{ "context":3,"id":64 },"type":"BIT","name":"exp5","surface":0},
62+
{ "symbol":{ "context":3,"id":65 },"type":"BIT","name":"exp6","surface":0},
63+
{ "symbol":{ "context":3,"id":66 },"type":"BIT","name":"exp7","surface":0},
64+
{ "symbol":{ "context":3,"id":67 },"type":"BIT","name":"exp8","surface":0},
65+
{ "symbol":{ "context":3,"id":68 },"type":"BIT","name":"exp9","surface":0},
66+
{ "symbol":{ "context":3,"id":69 },"type":"BIT","name":"exp10","surface":0},
67+
{ "symbol":{ "context":3,"id":70 },"type":"BIT","name":"exp11","surface":0},
68+
{ "symbol":{ "context":3,"id":71 },"type":"BIT","name":"exp12","surface":0},
69+
{ "symbol":{ "context":3,"id":72 },"type":"BIT","name":"exp13","surface":0},
70+
{ "symbol":{ "context":3,"id":73 },"type":"BIT","name":"exp14","surface":0},
71+
{ "symbol":{ "context":3,"id":74 },"type":"BIT","name":"exp15","surface":0}]}]}]}

web/houseloc.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
{ "symbol":{ "context":3,"id":25 },"type":"latlong","name":"house location","children":[
2-
{ "symbol":{ "context":3,"id":23 },"type":"FLOAT","name":"latitude","surface":132.500000},
3-
{ "symbol":{ "context":3,"id":24 },"type":"FLOAT","name":"longitude","surface":92.300003}]}
1+
{ "symbol":{ "context":3,"id":58 },"type":"latlong","name":"house location","children":[
2+
{ "symbol":{ "context":3,"id":56 },"type":"FLOAT","name":"latitude","surface":132.500000},
3+
{ "symbol":{ "context":3,"id":57 },"type":"FLOAT","name":"longitude","surface":92.300003}]}

0 commit comments

Comments
 (0)