| … | … | @@ -179,9 +179,42 @@ void MultiDeleteUTest::test_add_delete(void) |
| 179 | 179 | for (std::thread& t : thread_pool) t.join(); |
| 180 | 180 | printf("Done joining threads\n"); |
| 181 | 181 | |
| 182 | | printf("Final atomspace size=%lu\n", as->get_size()); |
| 183 | | // Verify the atomspace size |
| 184 | | // TS_ASSERT_EQUALS(as->get_size(), 2); |
| 182 | printf("Post-update AtomSpace size=%lu\n", as->get_size()); |
| 183 | // printf("AtomSpace contents =\n%s\n", as->to_string().c_str()); |
| 184 | |
| 185 | // Verify the local AtomSpace size. Should be 18: |
| 186 | // The CogStrageNode itself, the (Concept "aaaa") and |
| 187 | // 16 from thread-id modulo 17 |
| 188 | TS_ASSERT_EQUALS(as->get_size(), 8 + n_threads); |
| 189 | |
| 190 | // Verify the remote AtomSpace: pull everything from the |
| 191 | // cogserver, back to here. Do this "independently", by |
| 192 | // closing the socket; this forces the cogserver through |
| 193 | // its socket-close code, potentially exposing bugs. |
| 194 | store->close(); |
| 195 | |
| 196 | HandleSeq hs; |
| 197 | as->get_handles_by_type(hs, CONCEPT_NODE); |
| 198 | for (const Handle& h : hs) |
| 199 | as->extract_atom(h); |
| 200 | hs.clear(); |
| 201 | printf("AtomSpace contents =\n%s\n", as->to_string().c_str()); |
| 202 | TS_ASSERT_EQUALS(as->get_size(), 1); |
| 203 | |
| 204 | store->open(); |
| 205 | TS_ASSERT(store->connected()) |
| 206 | |
| 207 | store->load_atomspace(); |
| 208 | printf("Final AtomSpace size=%lu\n", as->get_size()); |
| 209 | |
| 210 | // Size should be 19: the 18 from before plus that annoying |
| 211 | // (Predicate "*-TruthValueKey-*") |
| 212 | size_t expected_size = 9 + n_threads; |
| 213 | if (as->get_size() != expected_size) |
| 214 | printf("Error: Bad size! AtomSpace contents =\n%s\n", |
| 215 | as->to_string().c_str()); |
| 216 | |
| 217 | TS_ASSERT_EQUALS(as->get_size(), expected_size); |
| 185 | 218 | |
| 186 | 219 | store->erase(); |
| 187 | 220 | store->close(); |