OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-cog commits / 656627d

Stengthen unit test
656627d48c8016c5ea4a6c8d0a38170d651dc147
by Linas Vepštas <linasvepstas@gmail.com> · 2025-12-06T20:46:42.000Z

Changed files (1) +34 -4

tests/persist/cog-simple/SimpleMultiDeleteUTest.cxxtest +34 -4
……@@ -181,12 +181,42 @@ void SimpleMultiDeleteUTest::test_add_delete(void)
181181 for (std::thread& t : thread_pool) t.join();
182182 printf("Done joining threads\n");
183183
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();
184210 printf("Final AtomSpace size=%lu\n", as->get_size());
185 printf("AtomSpace contents = %s\n", as->to_string().c_str());
186211
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);
190220
191221 store->erase();
192222 store->close();