|
6 | 6 | local e1, e2, e3 = evo.id(3) |
7 | 7 |
|
8 | 8 | do |
9 | | - assert(evo.lookup('hello') == nil) |
10 | | - assert(evo.lookup('world') == nil) |
| 9 | + assert(evo.lookup('lookup_hello') == nil) |
| 10 | + assert(evo.lookup('lookup_world') == nil) |
11 | 11 |
|
12 | 12 | do |
13 | | - local entity_list, entity_count = evo.multi_lookup('hello') |
| 13 | + local entity_list, entity_count = evo.multi_lookup('lookup_hello') |
14 | 14 | assert(entity_list and #entity_list == 0 and entity_count == 0) |
15 | 15 | end |
16 | 16 |
|
17 | 17 | do |
18 | | - local entity_list, entity_count = evo.multi_lookup('world') |
| 18 | + local entity_list, entity_count = evo.multi_lookup('lookup_world') |
19 | 19 | assert(entity_list and #entity_list == 0 and entity_count == 0) |
20 | 20 | end |
21 | 21 | end |
22 | 22 |
|
23 | | - evo.set(e1, evo.NAME, 'hello') |
| 23 | + evo.set(e1, evo.NAME, 'lookup_hello') |
24 | 24 |
|
25 | 25 | do |
26 | | - assert(evo.lookup('hello') == e1) |
27 | | - assert(evo.lookup('world') == nil) |
| 26 | + assert(evo.lookup('lookup_hello') == e1) |
| 27 | + assert(evo.lookup('lookup_world') == nil) |
28 | 28 |
|
29 | 29 | do |
30 | | - local entity_list, entity_count = evo.multi_lookup('hello') |
| 30 | + local entity_list, entity_count = evo.multi_lookup('lookup_hello') |
31 | 31 | assert(entity_list and #entity_list == 1 and entity_count == 1) |
32 | 32 | assert(entity_list[1] == e1) |
33 | 33 | end |
34 | 34 |
|
35 | 35 | do |
36 | | - local entity_list, entity_count = evo.multi_lookup('world') |
| 36 | + local entity_list, entity_count = evo.multi_lookup('lookup_world') |
37 | 37 | assert(entity_list and #entity_list == 0 and entity_count == 0) |
38 | 38 | end |
39 | 39 | end |
40 | 40 |
|
41 | | - evo.set(e2, evo.NAME, 'hello') |
42 | | - evo.set(e3, evo.NAME, 'hello') |
| 41 | + evo.set(e2, evo.NAME, 'lookup_hello') |
| 42 | + evo.set(e3, evo.NAME, 'lookup_hello') |
43 | 43 |
|
44 | 44 | do |
45 | | - assert(evo.lookup('hello') == e3) |
46 | | - assert(evo.lookup('world') == nil) |
| 45 | + assert(evo.lookup('lookup_hello') == e1) |
| 46 | + assert(evo.lookup('lookup_world') == nil) |
47 | 47 |
|
48 | 48 | do |
49 | | - local entity_list, entity_count = evo.multi_lookup('hello') |
| 49 | + local entity_list, entity_count = evo.multi_lookup('lookup_hello') |
50 | 50 | assert(entity_list and #entity_list == 3 and entity_count == 3) |
51 | 51 | assert(entity_list[1] == e1 and entity_list[2] == e2 and entity_list[3] == e3) |
52 | 52 | end |
53 | 53 | end |
54 | 54 |
|
55 | | - evo.set(e2, evo.NAME, 'world') |
| 55 | + evo.set(e2, evo.NAME, 'lookup_world') |
56 | 56 |
|
57 | 57 | do |
58 | | - assert(evo.lookup('hello') == e3) |
59 | | - assert(evo.lookup('world') == e2) |
| 58 | + assert(evo.lookup('lookup_hello') == e1) |
| 59 | + assert(evo.lookup('lookup_world') == e2) |
60 | 60 |
|
61 | 61 | do |
62 | | - local entity_list, entity_count = evo.multi_lookup('hello') |
| 62 | + local entity_list, entity_count = evo.multi_lookup('lookup_hello') |
63 | 63 | assert(entity_list and #entity_list == 2 and entity_count == 2) |
64 | 64 | assert(entity_list[1] == e1 and entity_list[2] == e3) |
65 | 65 | end |
66 | 66 |
|
67 | 67 | do |
68 | | - local entity_list, entity_count = evo.multi_lookup('world') |
| 68 | + local entity_list, entity_count = evo.multi_lookup('lookup_world') |
69 | 69 | assert(entity_list and #entity_list == 1 and entity_count == 1) |
70 | 70 | assert(entity_list[1] == e2) |
71 | 71 | end |
72 | 72 | end |
73 | 73 |
|
74 | | - evo.set(e3, evo.NAME, 'world') |
| 74 | + evo.set(e3, evo.NAME, 'lookup_world') |
75 | 75 |
|
76 | 76 | do |
77 | | - assert(evo.lookup('hello') == e1) |
78 | | - assert(evo.lookup('world') == e3) |
| 77 | + assert(evo.lookup('lookup_hello') == e1) |
| 78 | + assert(evo.lookup('lookup_world') == e2) |
79 | 79 |
|
80 | 80 | do |
81 | | - local entity_list, entity_count = evo.multi_lookup('hello') |
| 81 | + local entity_list, entity_count = evo.multi_lookup('lookup_hello') |
82 | 82 | assert(entity_list and #entity_list == 1 and entity_count == 1) |
83 | 83 | assert(entity_list[1] == e1) |
84 | 84 | end |
85 | 85 |
|
86 | 86 | do |
87 | | - local entity_list, entity_count = evo.multi_lookup('world') |
| 87 | + local entity_list, entity_count = evo.multi_lookup('lookup_world') |
88 | 88 | assert(entity_list and #entity_list == 2 and entity_count == 2) |
89 | 89 | assert(entity_list[1] == e2 or entity_list[1] == e3) |
90 | 90 | end |
|
93 | 93 | evo.remove(e1, evo.NAME) |
94 | 94 |
|
95 | 95 | do |
96 | | - assert(evo.lookup('hello') == nil) |
97 | | - assert(evo.lookup('world') == e3) |
| 96 | + assert(evo.lookup('lookup_hello') == nil) |
| 97 | + assert(evo.lookup('lookup_world') == e2) |
98 | 98 |
|
99 | 99 | do |
100 | | - local entity_list, entity_count = evo.multi_lookup('hello') |
| 100 | + local entity_list, entity_count = evo.multi_lookup('lookup_hello') |
101 | 101 | assert(entity_list and #entity_list == 0 and entity_count == 0) |
102 | 102 | end |
103 | 103 |
|
104 | 104 | do |
105 | | - local entity_list, entity_count = evo.multi_lookup('world') |
| 105 | + local entity_list, entity_count = evo.multi_lookup('lookup_world') |
106 | 106 | assert(entity_list and #entity_list == 2 and entity_count == 2) |
107 | 107 | assert(entity_list[1] == e2 or entity_list[1] == e3) |
108 | 108 | end |
109 | 109 | end |
110 | 110 | end |
| 111 | + |
| 112 | +do |
| 113 | + local e1, e2, e3 = evo.id(3) |
| 114 | + |
| 115 | + evo.set(e1, evo.NAME, 'lookup_e') |
| 116 | + |
| 117 | + do |
| 118 | + local entity_list, entity_count = evo.multi_lookup('lookup_e') |
| 119 | + assert(entity_list and #entity_list == 1 and entity_count == 1) |
| 120 | + assert(entity_list[1] == e1) |
| 121 | + end |
| 122 | + |
| 123 | + evo.set(e2, evo.NAME, 'lookup_e') |
| 124 | + |
| 125 | + do |
| 126 | + local entity_list, entity_count = evo.multi_lookup('lookup_e') |
| 127 | + assert(entity_list and #entity_list == 2 and entity_count == 2) |
| 128 | + assert(entity_list[1] == e1 and entity_list[2] == e2) |
| 129 | + end |
| 130 | + |
| 131 | + evo.set(e3, evo.NAME, 'lookup_e') |
| 132 | + |
| 133 | + do |
| 134 | + local entity_list, entity_count = evo.multi_lookup('lookup_e') |
| 135 | + assert(entity_list and #entity_list == 3 and entity_count == 3) |
| 136 | + assert(entity_list[1] == e1 and entity_list[2] == e2 and entity_list[3] == e3) |
| 137 | + end |
| 138 | + |
| 139 | + evo.clear(e1, e2, e3) |
| 140 | + |
| 141 | + do |
| 142 | + local entity_list, entity_count = evo.multi_lookup('lookup_e') |
| 143 | + assert(entity_list and #entity_list == 0 and entity_count == 0) |
| 144 | + end |
| 145 | + |
| 146 | + evo.set(e3, evo.NAME, 'lookup_e') |
| 147 | + |
| 148 | + do |
| 149 | + local entity_list, entity_count = evo.multi_lookup('lookup_e') |
| 150 | + assert(entity_list and #entity_list == 1 and entity_count == 1) |
| 151 | + assert(entity_list[1] == e3) |
| 152 | + end |
| 153 | + |
| 154 | + evo.set(e2, evo.NAME, 'lookup_e') |
| 155 | + |
| 156 | + do |
| 157 | + local entity_list, entity_count = evo.multi_lookup('lookup_e') |
| 158 | + assert(entity_list and #entity_list == 2 and entity_count == 2) |
| 159 | + assert(entity_list[1] == e3 and entity_list[2] == e2) |
| 160 | + end |
| 161 | + |
| 162 | + evo.set(e1, evo.NAME, 'lookup_e') |
| 163 | + |
| 164 | + do |
| 165 | + local entity_list, entity_count = evo.multi_lookup('lookup_e') |
| 166 | + assert(entity_list and #entity_list == 3 and entity_count == 3) |
| 167 | + assert(entity_list[1] == e3 and entity_list[2] == e2 and entity_list[3] == e1) |
| 168 | + end |
| 169 | + |
| 170 | + evo.destroy(e3, e2, e1) |
| 171 | + |
| 172 | + do |
| 173 | + local entity_list, entity_count = evo.multi_lookup('lookup_e') |
| 174 | + assert(entity_list and #entity_list == 0 and entity_count == 0) |
| 175 | + end |
| 176 | +end |
0 commit comments