OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-cog commits / 7fe5263

Restore two unit tests testing removal
7fe5263e9f51d3cf3b667953b75c5f1fa0f6c956
by Linas Vepstas <linasvepstas@gmail.com> · 2025-12-08T05:53:50.000Z

Changed files (4) +13 -27

tests/persist/cog-simple/CMakeLists.txt +1 -1
……@@ -19,7 +19,7 @@ TARGET_LINK_LIBRARIES(SimpleFetchUTest execution)
1919ADD_CXXTEST(SimpleAlphaEquivUTest)
2020ADD_CXXTEST(SimpleMultiPersistUTest)
2121ADD_CXXTEST(SimpleMultiUserUTest)
22# ADD_CXXTEST(SimpleMultiDeleteUTest)
22ADD_CXXTEST(SimpleMultiDeleteUTest)
2323ADD_CXXTEST(SimpleQueryPersistUTest)
2424#
2525# At this time, the multi-space tests are guaranteed to fail,
tests/persist/cog-simple/SimpleMultiDeleteUTest.cxxtest +6 -14
……@@ -184,10 +184,10 @@ void SimpleMultiDeleteUTest::test_add_delete(void)
184184 printf("Post-update AtomSpace size=%lu\n", as->get_size());
185185 // printf("AtomSpace contents =\n%s\n", as->to_string().c_str());
186186
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);
187 // Verify the local AtomSpace size. Should be 34:
188 // The CogStorageNode itself, the (Concept "aaaa") and
189 // 16 from thread-id modulo 16 plus 16 ListLinks.
190 TS_ASSERT_EQUALS(as->get_size(), 2 + 2*(n_threads+6));
191191
192192 // Verify the remote AtomSpace: pull everything from the
193193 // cogserver, back to here. Do this "independently", by
……@@ -198,7 +198,7 @@ void SimpleMultiDeleteUTest::test_add_delete(void)
198198 HandleSeq hs;
199199 as->get_handles_by_type(hs, CONCEPT_NODE);
200200 for (const Handle& h : hs)
201 as->extract_atom(h);
201 as->extract_atom(h, true);
202202 hs.clear();
203203 printf("AtomSpace contents =\n%s\n", as->to_string().c_str());
204204 TS_ASSERT_EQUALS(as->get_size(), 1);
……@@ -209,22 +209,14 @@ void SimpleMultiDeleteUTest::test_add_delete(void)
209209 store->load_atomspace();
210210 printf("Final AtomSpace size=%lu\n", as->get_size());
211211
212#if THIS_IS_NOT_TRUE
213212 // Size should be 19: the 18 from before plus that annoying
214213 // (Predicate "*-TruthValueKey-*")
215 //
216 // Well, but this will not hold true, because the insert and
217 // remove ran in different threads, asynchronously, and so
218 // there may have been inserts after the "matching" remove.
219 // This is rare for this test (about one out of 30 runs)
220 // but happens a lot for the regular MultiDeleteUTest.
221 size_t expected_size = 9 + n_threads;
214 size_t expected_size = 3 + 6 + n_threads;
222215 if (as->get_size() != expected_size)
223216 printf("Error: Bad size! AtomSpace contents =\n%s\n",
224217 as->to_string().c_str());
225218
226219 TS_ASSERT_EQUALS(as->get_size(), expected_size);
227#endif
228220
229221 store->erase();
230222 store->close();
tests/persist/cog-storage/CMakeLists.txt +1 -1
……@@ -19,7 +19,7 @@ ADD_CXXTEST(AlphaEquivUTest)
1919ADD_CXXTEST(QueryPersistUTest)
2020ADD_CXXTEST(MultiPersistUTest)
2121ADD_CXXTEST(MultiUserUTest)
22# ADD_CXXTEST(MultiDeleteUTest)
22ADD_CXXTEST(MultiDeleteUTest)
2323
2424ADD_CXXTEST(LargeFlatUTest)
2525ADD_CXXTEST(LargeZipfUTest)
tests/persist/cog-storage/MultiDeleteUTest.cxxtest +5 -11
……@@ -182,10 +182,10 @@ void MultiDeleteUTest::test_add_delete(void)
182182 printf("Post-update AtomSpace size=%lu\n", as->get_size());
183183 // printf("AtomSpace contents =\n%s\n", as->to_string().c_str());
184184
185 // Verify the local AtomSpace size. Should be 18:
185 // Verify the local AtomSpace size. Should be 34:
186186 // The CogStrageNode itself, the (Concept "aaaa") and
187 // 16 from thread-id modulo 17
188 TS_ASSERT_EQUALS(as->get_size(), 8 + n_threads);
187 // 16 from thread-id modulo 16
188 TS_ASSERT_EQUALS(as->get_size(), 2 + 2*(n_threads+6));
189189
190190 // Verify the remote AtomSpace: pull everything from the
191191 // cogserver, back to here. Do this "independently", by
……@@ -196,7 +196,7 @@ void MultiDeleteUTest::test_add_delete(void)
196196 HandleSeq hs;
197197 as->get_handles_by_type(hs, CONCEPT_NODE);
198198 for (const Handle& h : hs)
199 as->extract_atom(h);
199 as->extract_atom(h, true);
200200 hs.clear();
201201 printf("AtomSpace contents =\n%s\n", as->to_string().c_str());
202202 TS_ASSERT_EQUALS(as->get_size(), 1);
……@@ -207,20 +207,14 @@ void MultiDeleteUTest::test_add_delete(void)
207207 store->load_atomspace();
208208 printf("Final AtomSpace size=%lu\n", as->get_size());
209209
210#if THIS_IS_NOT_TRUE
211210 // Size should be 19: the 18 from before plus that annoying
212211 // (Predicate "*-TruthValueKey-*")
213 //
214 // Well, but this will not hold true, because the insert and
215 // remove ran in different threads, asynchronously, and so
216 // there may have been inserts after the "matching" remove.
217 size_t expected_size = 9 + n_threads;
212 size_t expected_size = 3 + 6 + n_threads;
218213 if (as->get_size() != expected_size)
219214 printf("Error: Bad size! AtomSpace contents =\n%s\n",
220215 as->to_string().c_str());
221216
222217 TS_ASSERT_EQUALS(as->get_size(), expected_size);
223#endif
224218
225219 store->erase();
226220 store->close();