OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-cog commits / ffe6740

Strengthen unit test
ffe6740f2d7f21abad35140f8332f4f4f614d4ce
by Linas Vepštas <linasvepstas@gmail.com> · 2025-12-06T20:49:46.000Z

Changed files (1) +36 -3

tests/persist/cog-storage/MultiDeleteUTest.cxxtest +36 -3
……@@ -179,9 +179,42 @@ void MultiDeleteUTest::test_add_delete(void)
179179 for (std::thread& t : thread_pool) t.join();
180180 printf("Done joining threads\n");
181181
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);
185218
186219 store->erase();
187220 store->close();