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