OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-rocks commits / e01b4ec

Another batch of unit test API modernizations.
e01b4ec4100a368a273d52c30269893d732310b5
by Linas Vepstas <linasvepstas@gmail.com> · 2026-01-19T00:27:40.000Z

Changed files (5) +226 -213

tests/persist/rocks/BasicDeleteUTest.cxxtest +101 -98
……@@ -33,6 +33,7 @@
3333#include <opencog/atoms/atom_types/atom_types.h>
3434#include <opencog/atoms/value/FloatValue.h>
3535#include <opencog/atoms/value/LinkValue.h>
36#include <opencog/atoms/value/VoidValue.h>
3637#include <opencog/atomspace/AtomSpace.h>
3738
3839#include <opencog/persist/api/StorageNode.h>
……@@ -97,12 +98,12 @@ void BasicDeleteUTest::test_duplicates(void)
9798{
9899 logger().debug("BEGIN TEST: %s", __FUNCTION__);
99100
100 AtomSpace* as = new AtomSpace();
101 AtomSpacePtr as = createAtomSpace();
101102
102103 Handle hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
103104 StorageNodePtr store = StorageNodeCast(hsn);
104105
105 store->open();
106 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
106107 TS_ASSERT(store->connected())
107108
108109 // Clear out left-over junk, just in case.
……@@ -122,19 +123,21 @@ void BasicDeleteUTest::test_duplicates(void)
122123 // Remove the link. Since the link has duplicate atoms
123124 // in it, this can cause trouble, depending on how the
124125 // incoming set is managed.
125 store->remove_atom(as, li);
126 TS_ASSERT_EQUALS(as->get_size(), 4);
127 store->close();
126 store->remove_atom(as.get(), li);
127 // +1 for *-open-*
128 TS_ASSERT_EQUALS(as->get_size(), 5);
129 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
128130 as->extract_atom(li);
129 TS_ASSERT_EQUALS(as->get_size(), 3);
130 store->open();
131 // +1 for *-open-*, +1 for *-close-*
132 TS_ASSERT_EQUALS(as->get_size(), 5);
133 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
131134 store->load_atomspace();
132 // +1 for *-IsKeyFlag-*
133 TS_ASSERT_EQUALS(as->get_size(), 4);
135 // +1 for *-IsKeyFlag-*, +1 for *-open-*, +1 for *-close-*
136 TS_ASSERT_EQUALS(as->get_size(), 6);
134137
135138 store->erase();
136 store->close();
137 delete as;
139 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
140 as = nullptr;
138141
139142 logger().debug("END TEST: %s", __FUNCTION__);
140143}
……@@ -145,12 +148,12 @@ void BasicDeleteUTest::test_recursive(void)
145148{
146149 logger().debug("BEGIN TEST: %s", __FUNCTION__);
147150
148 AtomSpace* as = new AtomSpace();
151 AtomSpacePtr as = createAtomSpace();
149152
150153 Handle hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
151154 StorageNodePtr store = StorageNodeCast(hsn);
152155
153 store->open();
156 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
154157 TS_ASSERT(store->connected())
155158
156159 // Clear out left-over junk, just in case.
……@@ -171,12 +174,12 @@ void BasicDeleteUTest::test_recursive(void)
171174 for (const Handle& h : hset)
172175 printf("Atomspace contains: %s\n", h->to_short_string().c_str());
173176
174 // Verify the atomspace size
175 TS_ASSERT_EQUALS(as->get_size(), 5);
177 // Verify the atomspace size (+1 for *-open-*)
178 TS_ASSERT_EQUALS(as->get_size(), 6);
176179
177180 // Remove (Concept "a"). Since this appears twice, recursion
178181 // will hit it twice, in strange ways, and maybe crash.
179 store->remove_atom(as, ha, true);
182 store->remove_atom(as.get(), ha, true);
180183
181184 printf("Post-delete atomspace size=%lu\n", as->get_size());
182185 hset.clear();
……@@ -184,12 +187,12 @@ void BasicDeleteUTest::test_recursive(void)
184187 for (const Handle& h : hset)
185188 printf("Post delete: %s\n", h->to_short_string().c_str());
186189
187 store->close();
190 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
188191 as->extract_atom(ha, true);
189 store->open();
192 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
190193 store->load_atomspace();
191 // +1 for *-IsKeyFlag-*
192 TS_ASSERT_EQUALS(as->get_size(), 3);
194 // +1 for *-IsKeyFlag-*, +1 for *-open-*, +1 for *-close-*
195 TS_ASSERT_EQUALS(as->get_size(), 5);
193196
194197 // --------------------------------------
195198 // Do it again, but with a different order.
……@@ -199,19 +202,19 @@ void BasicDeleteUTest::test_recursive(void)
199202
200203 store->store_atom(lj);
201204 store->barrier();
202 store->close();
203 store->open();
205 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
206 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
204207 store->load_atomspace();
205 // +1 for *-IsKeyFlag-*
206 TS_ASSERT_EQUALS(as->get_size(), 6);
208 // +1 for *-IsKeyFlag-*, +1 for *-open-*, +1 for *-close-*
209 TS_ASSERT_EQUALS(as->get_size(), 8);
207210
208 store->remove_atom(as, ha, true);
209 store->close();
211 store->remove_atom(as.get(), ha, true);
212 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
210213 as->extract_atom(ha, true);
211 store->open();
214 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
212215 store->load_atomspace();
213 // +1 for *-IsKeyFlag-*
214 TS_ASSERT_EQUALS(as->get_size(), 3);
216 // +1 for *-IsKeyFlag-*, +1 for *-open-*, +1 for *-close-*
217 TS_ASSERT_EQUALS(as->get_size(), 5);
215218
216219 // --------------------------------------
217220 // Do it again, but with a complex order.
……@@ -221,19 +224,19 @@ void BasicDeleteUTest::test_recursive(void)
221224
222225 store->store_atom(lj);
223226 store->barrier();
224 store->close();
225 store->open();
227 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
228 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
226229 store->load_atomspace();
227 // +1 for *-IsKeyFlag-*
228 TS_ASSERT_EQUALS(as->get_size(), 6);
230 // +1 for *-IsKeyFlag-*, +1 for *-open-*, +1 for *-close-*
231 TS_ASSERT_EQUALS(as->get_size(), 8);
229232
230 store->remove_atom(as, ha, true);
231 store->close();
233 store->remove_atom(as.get(), ha, true);
234 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
232235 as->extract_atom(ha, true);
233 store->open();
236 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
234237 store->load_atomspace();
235 // +1 for *-IsKeyFlag-*
236 TS_ASSERT_EQUALS(as->get_size(), 3);
238 // +1 for *-IsKeyFlag-*, +1 for *-open-*, +1 for *-close-*
239 TS_ASSERT_EQUALS(as->get_size(), 5);
237240
238241 // --------------------------------------
239242 // Do it again, but more deeply.
……@@ -244,24 +247,24 @@ void BasicDeleteUTest::test_recursive(void)
244247
245248 store->store_atom(lk);
246249 store->barrier();
247 store->close();
248 store->open();
250 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
251 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
249252 store->load_atomspace();
250 // +1 for *-IsKeyFlag-*
251 TS_ASSERT_EQUALS(as->get_size(), 7);
253 // +1 for *-IsKeyFlag-*, +1 for *-open-*, +1 for *-close-*
254 TS_ASSERT_EQUALS(as->get_size(), 9);
252255
253 store->remove_atom(as, ha, true);
254 store->close();
256 store->remove_atom(as.get(), ha, true);
257 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
255258 as->extract_atom(ha, true);
256 store->open();
259 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
257260 store->load_atomspace();
258 // +1 for *-IsKeyFlag-*
259 TS_ASSERT_EQUALS(as->get_size(), 3);
261 // +1 for *-IsKeyFlag-*, +1 for *-open-*, +1 for *-close-*
262 TS_ASSERT_EQUALS(as->get_size(), 5);
260263
261264 // --------------------------------------
262265 store->erase();
263 store->close();
264 delete as;
266 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
267 as = nullptr;
265268
266269 logger().debug("END TEST: %s", __FUNCTION__);
267270}
……@@ -273,12 +276,12 @@ void BasicDeleteUTest::test_key_deletion(void)
273276 logger().debug("BEGIN TEST: %s", __FUNCTION__);
274277
275278 // Create an Atom with some keys on it.
276 AtomSpace* as = new AtomSpace();
279 AtomSpacePtr as = createAtomSpace();
277280
278281 Handle hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
279282 StorageNodePtr store = StorageNodeCast(hsn);
280283
281 store->open();
284 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
282285 TS_ASSERT(store->connected())
283286
284287 // Clear out left-over junk, just in case.
……@@ -297,8 +300,8 @@ void BasicDeleteUTest::test_key_deletion(void)
297300 store->store_atom(ha);
298301 store->barrier();
299302
300 // Verify the atomspace size (+1 for *-IsKeyFlag-*)
301 TS_ASSERT_EQUALS(as->get_size(), 6);
303 // Verify the atomspace size (+1 for *-IsKeyFlag-*, +1 for *-open-*)
304 TS_ASSERT_EQUALS(as->get_size(), 7);
302305
303306 // Verify that there are three keys
304307 HandleSet hs = ha->getKeys();
……@@ -307,17 +310,17 @@ void BasicDeleteUTest::test_key_deletion(void)
307310 TS_ASSERT_EQUALS(hs.size(), 3);
308311
309312 // Attempt to remove one of the keys. Should fail.
310 store->remove_atom(as, kb);
313 store->remove_atom(as.get(), kb);
311314 as->extract_atom(kb);
312 // +1 for *-IsKeyFlag-*
313 TS_ASSERT_EQUALS(as->get_size(), 6);
315 // +1 for *-IsKeyFlag-*, +1 for *-open-*
316 TS_ASSERT_EQUALS(as->get_size(), 7);
314317
315318 // Verify the key was NOT deleted by loading only PredicateNodes.
316 delete as;
317 as = new AtomSpace();
319 as = nullptr;
320 as = createAtomSpace();
318321 hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
319322 store = StorageNodeCast(hsn);
320 store->open();
323 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
321324 store->fetch_all_atoms_of_type(PREDICATE_NODE);
322325
323326 // All three keys need to still be here.
……@@ -331,24 +334,24 @@ void BasicDeleteUTest::test_key_deletion(void)
331334 // without the close().
332335
333336 // We are done.
334 delete as;
337 as = nullptr;
335338
336339 // -------------------------------------------------------
337340 // Start again, with a fresh connection.
338341 // Verify that in-use keys cannot be deleted.
339342
340 as = new AtomSpace();
343 as = createAtomSpace();
341344
342345 hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
343346 store = StorageNodeCast(hsn);
344347
345 store->open();
348 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
346349 TS_ASSERT(store->connected())
347350
348 // We expect 7 atoms (+1 for *-IsKeyFlag-*)
351 // We expect 8 atoms (+1 for *-IsKeyFlag-*, +1 for *-open-*)
349352 printf("Loading the atomspace ...\n");
350353 store->load_atomspace();
351 TS_ASSERT_EQUALS(as->get_size(), 7);
354 TS_ASSERT_EQUALS(as->get_size(), 8);
352355 printf("AtomSpace contents=\n%s\n", as->to_string().c_str());
353356
354357 // Verify that there are only three keys
……@@ -364,8 +367,8 @@ void BasicDeleteUTest::test_key_deletion(void)
364367 TS_ASSERT(nullptr != as->get_node(PREDICATE_NODE, "key-c"));
365368
366369 store->erase();
367 store->close();
368 delete as;
370 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
371 as = nullptr;
369372
370373 logger().debug("END TEST: %s", __FUNCTION__);
371374}
……@@ -379,12 +382,12 @@ void BasicDeleteUTest::test_key_corruption(void)
379382 logger().debug("BEGIN TEST: %s", __FUNCTION__);
380383
381384 // Create an Atom with some keys on it.
382 AtomSpace* as = new AtomSpace();
385 AtomSpacePtr as = createAtomSpace();
383386
384387 Handle hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
385388 StorageNodePtr store = StorageNodeCast(hsn);
386389
387 store->open();
390 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
388391 TS_ASSERT(store->connected())
389392
390393 // Clear out left-over junk, just in case.
……@@ -400,14 +403,14 @@ void BasicDeleteUTest::test_key_corruption(void)
400403 store->store_atom(hb);
401404 store->barrier();
402405
403 // Verify the atomspace size (+1 for *-IsKeyFlag-*)
404 TS_ASSERT_EQUALS(as->get_size(), 5);
406 // Verify the atomspace size (+1 for *-IsKeyFlag-*, +1 for *-open-*)
407 TS_ASSERT_EQUALS(as->get_size(), 6);
405408
406409 // Remove the value
407 store->remove_atom(as, hx);
410 store->remove_atom(as.get(), hx);
408411 as->extract_atom(hx);
409 // +1 for *-IsKeyFlag-*
410 TS_ASSERT_EQUALS(as->get_size(), 4);
412 // +1 for *-IsKeyFlag-*, +1 for *-open-*
413 TS_ASSERT_EQUALS(as->get_size(), 5);
411414
412415 // FYI, we should call store->close() at this point, but we
413416 // don't, because ... most users forget to do this too.
……@@ -415,21 +418,21 @@ void BasicDeleteUTest::test_key_corruption(void)
415418 // without the close().
416419
417420 // We are done.
418 delete as;
421 as = nullptr;
419422
420423 // -------------------------------------------------------
421424 // Start again, with a fresh connection.
422425 // Verify that the delete key is really deleted.
423426
424 as = new AtomSpace();
427 as = createAtomSpace();
425428
426429 hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
427430 store = StorageNodeCast(hsn);
428431
429 store->open();
432 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
430433 TS_ASSERT(store->connected())
431434
432 // We expect 5 atoms: b, x, key-x, *-IsKeyFlag-*, StorageNode
435 // We expect 6 atoms: b, x, key-x, *-IsKeyFlag-*, StorageNode, *-open-*
433436 // That's because the (Concept "x") sitting in the Value
434437 // was never actually deleted; thus it is restored.
435438 printf("Loading the atomspace ...\n");
……@@ -440,9 +443,9 @@ void BasicDeleteUTest::test_key_corruption(void)
440443 for (const Handle& h: hset)
441444 printf("Atomspace contains h=%s\n", h->to_short_string().c_str());
442445
443 // Size is 6 because (Concept "x") cannot be deleted.
444 // +1 for *-IsKeyFlag-*
445 TS_ASSERT_EQUALS(as->get_size(), 6);
446 // Size is 7 because (Concept "x") cannot be deleted.
447 // +1 for *-IsKeyFlag-*, +1 for *-open-*
448 TS_ASSERT_EQUALS(as->get_size(), 7);
446449
447450 hb = as->add_node(CONCEPT_NODE, "b");
448451 hx = as->add_node(CONCEPT_NODE, "x");
……@@ -455,41 +458,41 @@ void BasicDeleteUTest::test_key_corruption(void)
455458 store->store_atom(hb);
456459 store->barrier();
457460
458 // +1 for *-IsKeyFlag-*
459 TS_ASSERT_EQUALS(as->get_size(), 8);
461 // +1 for *-IsKeyFlag-*, +1 for *-open-*
462 TS_ASSERT_EQUALS(as->get_size(), 9);
460463
461464 // Remove the value .. again
462 store->remove_atom(as, hx);
465 store->remove_atom(as.get(), hx);
463466 as->extract_atom(hx);
464 // +1 for *-IsKeyFlag-*
465 TS_ASSERT_EQUALS(as->get_size(), 7);
466 store->close();
467 store->open();
468 store->load_atomspace();
469 // Size is 8 because (Concept "x") cannot be deleted.
470 // +1 for *-IsKeyFlag-*
467 // +1 for *-IsKeyFlag-*, +1 for *-open-*
471468 TS_ASSERT_EQUALS(as->get_size(), 8);
469 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
470 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
471 store->load_atomspace();
472 // Size is 10 because (Concept "x") cannot be deleted.
473 // +1 for *-IsKeyFlag-*, +1 for *-open-*, +1 for *-close-*
474 TS_ASSERT_EQUALS(as->get_size(), 10);
472475
473476 // We are done.
474 store->close();
475 delete as;
477 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
478 as = nullptr;
476479
477480 // -------------------------------------------------------
478481 // Start again, with a fresh connection.
479482 // Verify that the delete key is really deleted.
480483
481 as = new AtomSpace();
484 as = createAtomSpace();
482485
483486 hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
484487 store = StorageNodeCast(hsn);
485488
486 store->open();
489 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
487490 TS_ASSERT(store->connected())
488491
489 // We expect 8 atoms (+1 for *-IsKeyFlag-*)
492 // We expect 9 atoms (+1 for *-IsKeyFlag-*, +1 for *-open-*)
490493 printf("Loading the atomspace ...\n");
491494 store->load_atomspace();
492 TS_ASSERT_EQUALS(as->get_size(), 8);
495 TS_ASSERT_EQUALS(as->get_size(), 9);
493496
494497 // Verify that there are two keys
495498 hb = as->add_node(CONCEPT_NODE, "b");
……@@ -503,8 +506,8 @@ void BasicDeleteUTest::test_key_corruption(void)
503506 TS_ASSERT_EQUALS(hs.size(), 2);
504507
505508 store->erase();
506 store->close();
507 delete as;
509 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
510 as = nullptr;
508511
509512 logger().debug("END TEST: %s", __FUNCTION__);
510513}
tests/persist/rocks/BasicSaveUTest.cxxtest +7 -3
……@@ -34,8 +34,10 @@
3434#include <opencog/atoms/base/Node.h>
3535#include <opencog/atoms/atom_types/atom_types.h>
3636#include <opencog/atoms/value/FloatValue.h>
37#include <opencog/atoms/value/VoidValue.h>
3738#include <opencog/atomspace/AtomSpace.h>
3839#include <opencog/persist/rocks/RocksStorage.h>
40#include <opencog/persist/rocks-types/atom_types.h>
3941
4042#include <opencog/util/Logger.h>
4143
……@@ -169,9 +171,11 @@ static void atomCompare(Handle a, Handle b, const char* where)
169171 */
170172void BasicSaveUTest::single_atom_save_restore(std::string id)
171173{
172 RocksStorageNodePtr store = createRocksStorageNode(std::string(uri));
174 AtomSpacePtr as = createAtomSpace();
175 Handle hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
176 RocksStorageNodePtr store = RocksStorageNodeCast(hsn);
173177 logger().debug("single_atom_save_restore: create %p", store.get());
174 store->open();
178 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
175179 logger().debug("single_atom_save_restore: opened");
176180 if (!store->connected())
177181 {
……@@ -234,7 +238,7 @@ void BasicSaveUTest::single_atom_save_restore(std::string id)
234238 fflush(stdout);
235239
236240 store->kill_data();
237 store->close();
241 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
238242}
239243
240244// ============================================================
tests/persist/rocks/DeleteUTest.cxxtest +51 -47
……@@ -33,6 +33,7 @@
3333#include <opencog/atoms/base/Link.h>
3434#include <opencog/atoms/base/Node.h>
3535#include <opencog/atoms/value/FloatValue.h>
36#include <opencog/atoms/value/VoidValue.h>
3637#include <opencog/atomspace/AtomSpace.h>
3738#include <opencog/persist/rocks-types/atom_types.h>
3839#include <opencog/persist/rocks/RocksStorage.h>
……@@ -44,7 +45,7 @@ using namespace opencog;
4445class DeleteUTest : public CxxTest::TestSuite
4546{
4647 private:
47 AtomSpace* _as;
48 AtomSpacePtr _as;
4849 std::string uri;
4950
5051 NodePtr n1[10];
……@@ -113,12 +114,12 @@ DeleteUTest:: DeleteUTest(void)
113114 */
114115void DeleteUTest::setUp(void)
115116{
116 _as = new AtomSpace();
117 _as = createAtomSpace();
117118}
118119
119120void DeleteUTest::tearDown(void)
120121{
121 delete _as;
122 _as = nullptr;
122123}
123124
124125// ============================================================
……@@ -424,32 +425,33 @@ void DeleteUTest::test_remove(void)
424425
425426 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
426427 StorageNodePtr store = StorageNodeCast(hsn);
427 store->open();
428 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
428429 TS_ASSERT(store->connected())
429430
430431 int idx = 0;
431 add_to_space(idx++, _as, "AA-aa-wow ");
432 add_to_space(idx++, _as, "BB-bb-wow ");
433 add_to_space(idx++, _as, "CC-cc-wow ");
434 add_to_space(idx++, _as, "DD-dd-wow ");
435 add_to_space(idx++, _as, "EE-ee-wow ");
432 add_to_space(idx++, _as.get(), "AA-aa-wow ");
433 add_to_space(idx++, _as.get(), "BB-bb-wow ");
434 add_to_space(idx++, _as.get(), "CC-cc-wow ");
435 add_to_space(idx++, _as.get(), "DD-dd-wow ");
436 add_to_space(idx++, _as.get(), "EE-ee-wow ");
436437
437438 /* Make sure UTF-8 works fine. */
438 add_to_space(idx++, _as, "Попытка выбраться вызвала слабый стон ");
439 add_to_space(idx++, _as, "はにがうりだそうであってるのかはち ");
440 add_to_space(idx++, _as, "係拉丁字母");
439 add_to_space(idx++, _as.get(), "Попытка выбраться вызвала слабый стон ");
440 add_to_space(idx++, _as.get(), "はにがうりだそうであってるのかはち ");
441 add_to_space(idx++, _as.get(), "係拉丁字母");
441442
442443 /* Verify that the atoms were added */
443444 int i;
444445 for (i=0; i<idx; i++)
445 check_space(i, _as, "verify-add");
446 check_space(i, _as.get(), "verify-add");
446447
447448 /* Push all atoms out to storage */
448449 store->store_atomspace();
449450
450 printf("Initial Atomspace size=%lu expect=%d\n", _as->get_size(), 7*idx+1);
451 // +2 for *-open-* predicate and storage node
452 printf("Initial Atomspace size=%lu expect=%d\n", _as->get_size(), 7*idx+2);
451453 TSM_ASSERT("Initial unexpected atomspace size",
452 ((unsigned)(7*idx+1)) == _as->get_size());
454 ((unsigned)(7*idx+2)) == _as->get_size());
453455 /* Delete some atoms with non-empty incoming sets.
454456 * This should result in their being removed from the atomspace,
455457 * but NOT fom the backend!
……@@ -457,36 +459,37 @@ void DeleteUTest::test_remove(void)
457459 store->barrier();
458460
459461 for (i=0; i<idx; i++)
460 extract_links(i, _as);
462 extract_links(i, _as.get());
461463
462 printf("Atomspace size=%lu expect=%d\n", _as->get_size(), 4*idx+1);
463 TSM_ASSERT("Post-extract unexpected atomspace size", ((unsigned)(4*idx+1)) == _as->get_size());
464 // +2 for *-open-* predicate and storage node
465 printf("Atomspace size=%lu expect=%d\n", _as->get_size(), 4*idx+2);
466 TSM_ASSERT("Post-extract unexpected atomspace size", ((unsigned)(4*idx+2)) == _as->get_size());
464467
465468 /* Verify that the atoms can still be fetched from storage. */
466469 for (i=0; i<idx; i++) {
467470 fetch_space(i, store);
468 check_space(i, _as, "verify-fetch");
471 check_space(i, _as.get(), "verify-fetch");
469472 }
470473
471474 /* This time, kill them in the backend too. */
472475 for (i=0; i<idx; i++)
473476 delete_links(i, store);
474477
475 // +2 for *-TruthValueKey-* and *-IsKeyFlag-*
476 printf("Post-remove size=%lu expect=%d\n", _as->get_size(), 4*idx+3);
478 // +2 for *-TruthValueKey-* and *-IsKeyFlag-*, +1 for *-open-*
479 printf("Post-remove size=%lu expect=%d\n", _as->get_size(), 4*idx+4);
477480 TSM_ASSERT("Post-remove unexpected atomspace size",
478 ((unsigned)(4*idx+3)) == _as->get_size());
481 ((unsigned)(4*idx+4)) == _as->get_size());
479482
480483 /* Verify that the atoms are really gone from storage. */
481484 for (i=0; i<idx; i++) {
482485 fetch_space(i, store);
483 check_remove(i, _as, "verify-gone");
486 check_remove(i, _as.get(), "verify-gone");
484487 }
485488
486 // +2 for *-TruthValueKey-* and *-IsKeyFlag-*
487 printf("Post-referesh size=%lu expect=%d\n", _as->get_size(), 7*idx+3);
489 // +2 for *-TruthValueKey-* and *-IsKeyFlag-*, +1 for *-open-*
490 printf("Post-referesh size=%lu expect=%d\n", _as->get_size(), 7*idx+4);
488491 TSM_ASSERT("Post-refetch unexpected atomspace size",
489 ((unsigned)(7*idx+3)) == _as->get_size());
492 ((unsigned)(7*idx+4)) == _as->get_size());
490493
491494 /* Kill data for good */
492495 _as->clear();
……@@ -494,7 +497,7 @@ void DeleteUTest::test_remove(void)
494497
495498 /* Verify that the atoms are no longer being found. */
496499 for (i=0; i<idx; i++)
497 check_empty(i, _as);
500 check_empty(i, _as.get());
498501
499502 logger().debug("END TEST: %s", __FUNCTION__);
500503}
……@@ -507,26 +510,26 @@ void DeleteUTest::test_recurse(void)
507510
508511 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
509512 StorageNodePtr store = StorageNodeCast(hsn);
510 store->open();
513 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
511514
512515 TS_ASSERT(store->connected())
513516
514517 int idx = 0;
515 add_to_space(idx++, _as, "AA-aa-wow ");
516 add_to_space(idx++, _as, "BB-bb-wow ");
517 add_to_space(idx++, _as, "CC-cc-wow ");
518 add_to_space(idx++, _as, "DD-dd-wow ");
519 add_to_space(idx++, _as, "EE-ee-wow ");
518 add_to_space(idx++, _as.get(), "AA-aa-wow ");
519 add_to_space(idx++, _as.get(), "BB-bb-wow ");
520 add_to_space(idx++, _as.get(), "CC-cc-wow ");
521 add_to_space(idx++, _as.get(), "DD-dd-wow ");
522 add_to_space(idx++, _as.get(), "EE-ee-wow ");
520523
521524 /* Make sure UTF-8 works fine. */
522 add_to_space(idx++, _as, "Попытка выбраться вызвала слабый стон ");
523 add_to_space(idx++, _as, "はにがうりだそうであってるのかはち ");
524 add_to_space(idx++, _as, "係拉丁字母");
525 add_to_space(idx++, _as.get(), "Попытка выбраться вызвала слабый стон ");
526 add_to_space(idx++, _as.get(), "はにがうりだそうであってるのかはち ");
527 add_to_space(idx++, _as.get(), "係拉丁字母");
525528
526529 /* Verify that the atoms were added */
527530 int i;
528531 for (i=0; i<idx; i++)
529 check_space(i, _as, "verify-add");
532 check_space(i, _as.get(), "verify-add");
530533
531534 /* Push all atoms out to the SQL DB */
532535 store->store_atomspace();
……@@ -539,9 +542,10 @@ void DeleteUTest::test_recurse(void)
539542
540543 int zap = 4;
541544 for (i=0; i<zap; i++)
542 extract_nodes(i, _as);
545 extract_nodes(i, _as.get());
543546
544 size_t expsz = 7*(idx-zap) + 3*zap + 1;
547 // +1 for *-open-*
548 size_t expsz = 7*(idx-zap) + 3*zap + 2;
545549 printf("Atomspace size=%lu expect=%lu\n",
546550 _as->get_size(), expsz);
547551 TSM_ASSERT("Unexpected atomspace size", expsz == _as->get_size());
……@@ -549,14 +553,14 @@ void DeleteUTest::test_recurse(void)
549553 /* Verify that the atoms can still be fetched from storage. */
550554 for (i=0; i<idx; i++) {
551555 fetch_space(i, store);
552 check_space(i, _as, "verify-fetch");
556 check_space(i, _as.get(), "verify-fetch");
553557 }
554558
555559 /* This time, kill them in the backend too. */
556560 for (i=0; i<zap; i++)
557561 delete_nodes(i, store);
558562
559 // +1 for *-IsKeyFlag-*
563 // +1 for *-IsKeyFlag-*, expsz already has +1 for *-open-*
560564 printf("Post-remove size=%lu expect=%lu\n",
561565 _as->get_size(), expsz+2);
562566 TSM_ASSERT("Unexpected atomspace size", expsz+2 == _as->get_size());
……@@ -568,20 +572,20 @@ void DeleteUTest::test_recurse(void)
568572 fetch_space(i, store);
569573 }
570574
571 // +2 for *-TruthValueKey-* and *-IsKeyFlag-*
575 // +2 for *-TruthValueKey-* and *-IsKeyFlag-*, +1 for *-open-*
572576 printf("Post-refetch size=%lu expect=%d\n",
573 _as->get_size(), 7*idx+3);
577 _as->get_size(), 7*idx+4);
574578 TSM_ASSERT("Unexpected atomspace size",
575 ((unsigned) 7*idx+3) == _as->get_size());
579 ((unsigned) 7*idx+4) == _as->get_size());
576580
577581 /* Check that the removed atoms really got zapped. */
578582 for (i=0; i<zap; i++) {
579 check_remove(i, _as, "verify-zapped");
583 check_remove(i, _as.get(), "verify-zapped");
580584 }
581585
582586 /* However, others should still be there. */
583587 for (i=zap; i<idx; i++) {
584 check_space(i, _as, "verify-zap");
588 check_space(i, _as.get(), "verify-zap");
585589 }
586590
587591 /* Kill data for good */
……@@ -590,7 +594,7 @@ void DeleteUTest::test_recurse(void)
590594
591595 /* Verify that the atoms are no longer being found. */
592596 for (i=0; i<idx; i++)
593 check_empty(i, _as);
597 check_empty(i, _as.get());
594598
595599 logger().debug("END TEST: %s", __FUNCTION__);
596600}
tests/persist/rocks/PersistUTest.cxxtest +19 -18
……@@ -32,6 +32,7 @@
3232#include <opencog/atoms/base/Link.h>
3333#include <opencog/atoms/base/Node.h>
3434#include <opencog/atoms/value/FloatValue.h>
35#include <opencog/atoms/value/VoidValue.h>
3536
3637#include <opencog/atomspace/AtomSpace.h>
3738
……@@ -45,7 +46,7 @@ using namespace opencog;
4546class PersistUTest : public CxxTest::TestSuite
4647{
4748 private:
48 AtomSpace *_as;
49 AtomSpacePtr _as;
4950
5051 NodePtr n1[10];
5152 NodePtr n2[10];
……@@ -100,12 +101,12 @@ PersistUTest:: PersistUTest(void)
100101 */
101102void PersistUTest::setUp(void)
102103{
103 _as = new AtomSpace();
104 _as = createAtomSpace();
104105}
105106
106107void PersistUTest::tearDown(void)
107108{
108 delete _as;
109 _as = nullptr;
109110}
110111
111112// ============================================================
……@@ -317,25 +318,25 @@ void PersistUTest::test_atomspace(void)
317318
318319 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, "rocks:///tmp/cog-rocks-persist-utest");
319320 StorageNodePtr store = StorageNodeCast(hsn);
320 store->open();
321 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
321322 TS_ASSERT(store->connected())
322323
323324 int idx = 0;
324 add_to_space(idx++, _as, "AA-aa-wow ");
325 add_to_space(idx++, _as, "BB-bb-wow ");
326 add_to_space(idx++, _as, "CC-cc-wow ");
327 add_to_space(idx++, _as, "DD-dd-wow ");
328 add_to_space(idx++, _as, "EE-ee-wow ");
325 add_to_space(idx++, _as.get(), "AA-aa-wow ");
326 add_to_space(idx++, _as.get(), "BB-bb-wow ");
327 add_to_space(idx++, _as.get(), "CC-cc-wow ");
328 add_to_space(idx++, _as.get(), "DD-dd-wow ");
329 add_to_space(idx++, _as.get(), "EE-ee-wow ");
329330
330331 /* Make sure UTF-8 works fine. */
331 add_to_space(idx++, _as, "Попытка выбраться вызвала слабый стон ");
332 add_to_space(idx++, _as, "はにがうりだそうであってるのかはち ");
333 add_to_space(idx++, _as, "係拉丁字母");
332 add_to_space(idx++, _as.get(), "Попытка выбраться вызвала слабый стон ");
333 add_to_space(idx++, _as.get(), "はにがうりだそうであってるのかはち ");
334 add_to_space(idx++, _as.get(), "係拉丁字母");
334335
335336 /* Verify that the atoms were added */
336337 int i;
337338 for (i=0; i<idx; i++)
338 check_space(i, _as, "verify-add");
339 check_space(i, _as.get(), "verify-add");
339340
340341 /* Push all atoms out to the Cogserver */
341342 store->store_atomspace();
……@@ -351,12 +352,12 @@ void PersistUTest::test_atomspace(void)
351352 /* The above clear wiped out the storage node; recreate it. */
352353 hsn = _as->add_node(ROCKS_STORAGE_NODE, "rocks:///tmp/cog-rocks-persist-utest");
353354 store = StorageNodeCast(hsn);
354 store->open();
355 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
355356
356357 /* Verify that the atoms can still be fetched from storage. */
357358 for (i=0; i<idx; i++) {
358359 fetch_space(i, store);
359 check_space(i, _as, "verify-fetch");
360 check_space(i, _as.get(), "verify-fetch");
360361 }
361362
362363 /* Do it again, for good luck. */
……@@ -366,12 +367,12 @@ void PersistUTest::test_atomspace(void)
366367 /* The above clear wiped out the storage node; recreate it. */
367368 hsn = _as->add_node(ROCKS_STORAGE_NODE, "rocks:///tmp/cog-rocks-persist-utest");
368369 store = StorageNodeCast(hsn);
369 store->open();
370 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
370371
371372 /* Verify that the atoms can still be fetched from storage. */
372373 for (i=0; i<idx; i++) {
373374 fetch_space(i, store);
374 check_space(i, _as, "ver-again");
375 check_space(i, _as.get(), "ver-again");
375376 }
376377
377378 /* Kill data for good */
……@@ -380,7 +381,7 @@ void PersistUTest::test_atomspace(void)
380381
381382 /* Verify that the atoms are no longer being found. */
382383 for (i=0; i<idx; i++)
383 check_empty(i, _as);
384 check_empty(i, _as.get());
384385
385386 logger().debug("END TEST: %s", __FUNCTION__);
386387}
tests/persist/rocks/ValueSaveUTest.cxxtest +48 -47
……@@ -37,6 +37,7 @@
3737#include <opencog/atoms/value/LinkValue.h>
3838#include <opencog/atoms/value/StringValue.h>
3939#include <opencog/atoms/value/FloatValue.h>
40#include <opencog/atoms/value/VoidValue.h>
4041
4142#include <opencog/persist/rocks-types/atom_types.h>
4243#include <opencog/persist/rocks/RocksStorage.h>
……@@ -105,10 +106,10 @@ void ValueSaveUTest::test_single_atom_save()
105106{
106107 logger().info("BEGIN TEST: %s", __FUNCTION__);
107108
108 AtomSpace* as = new AtomSpace();
109 AtomSpacePtr as = createAtomSpace();
109110 Handle hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
110111 StorageNodePtr store = StorageNodeCast(hsn);
111 store->open();
112 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
112113 TS_ASSERT(store->connected())
113114
114115 Handle key = as->add_node(PREDICATE_NODE, "some pred key");
……@@ -154,7 +155,7 @@ void ValueSaveUTest::test_single_atom_save()
154155 store->store_atom(atom);
155156 store->barrier();
156157
157 delete as;
158 as = nullptr;
158159
159160 logger().info("END TEST: %s", __FUNCTION__);
160161}
……@@ -172,10 +173,10 @@ void ValueSaveUTest::check_one(ValuePtr pap, bool fetchkey)
172173 // ------
173174 // First, save the value
174175
175 AtomSpace* as = new AtomSpace();
176 AtomSpacePtr as = createAtomSpace();
176177 Handle hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
177178 StorageNodePtr store = StorageNodeCast(hsn);
178 store->open();
179 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
179180 TS_ASSERT(store->connected())
180181
181182 Handle key = store->fetch_atom(bkey);
……@@ -190,15 +191,15 @@ void ValueSaveUTest::check_one(ValuePtr pap, bool fetchkey)
190191 printf ("Stored atom %s\n", atom->to_string().c_str());
191192 printf ("Stored vals %s\n", atom->valuesToString().c_str());
192193
193 delete as;
194 as = nullptr;
194195
195196 // ---------------------------------
196197 // Now, fetch the value and compare.
197198
198 as = new AtomSpace();
199 as = createAtomSpace();
199200 hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
200201 store = StorageNodeCast(hsn);
201 store->open();
202 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
202203 TS_ASSERT(store->connected())
203204
204205 // Storage uses a different code path if the key is not yet
……@@ -213,17 +214,17 @@ void ValueSaveUTest::check_one(ValuePtr pap, bool fetchkey)
213214 printf("Expecting %s\n", pap->to_string().c_str());
214215 TS_ASSERT(*pap == *fap);
215216
216 delete as;
217 as = nullptr;
217218}
218219
219220void ValueSaveUTest::test_save_restore(bool fkey)
220221{
221222 logger().info("BEGIN TEST: %s", __FUNCTION__);
222223
223 AtomSpace* as = new AtomSpace();
224 AtomSpacePtr as = createAtomSpace();
224225 Handle hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
225226 StorageNodePtr store = StorageNodeCast(hsn);
226 store->open();
227 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
227228 TS_ASSERT(store->connected())
228229
229230 Handle key = as->add_node(PREDICATE_NODE, "some pred key");
……@@ -262,7 +263,7 @@ void ValueSaveUTest::test_save_restore(bool fkey)
262263 check_one(pvl2, fkey);
263264
264265 store->erase();
265 delete as;
266 as = nullptr;
266267
267268 logger().info("END TEST: %s", __FUNCTION__);
268269}
……@@ -276,10 +277,10 @@ void ValueSaveUTest::test_load_by_type()
276277{
277278 logger().info("BEGIN TEST: %s", __FUNCTION__);
278279
279 AtomSpace* as = new AtomSpace();
280 AtomSpacePtr as = createAtomSpace();
280281 Handle hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
281282 StorageNodePtr store = StorageNodeCast(hsn);
282 store->open();
283 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
283284 TS_ASSERT(store->connected())
284285
285286 // Clear out left-over junk, just in case.
……@@ -332,15 +333,15 @@ void ValueSaveUTest::test_load_by_type()
332333 store->store_atom(al);
333334 store->store_atom(av);
334335 store->barrier();
335 delete as;
336 as = nullptr;
336337
337338 // --------------------
338339 // Start it up again.
339340
340 as = new AtomSpace();
341 as = createAtomSpace();
341342 hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
342343 store = StorageNodeCast(hsn);
343 store->open();
344 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
344345 TS_ASSERT(store->connected())
345346
346347 // --------------------
……@@ -348,11 +349,11 @@ void ValueSaveUTest::test_load_by_type()
348349 store->fetch_all_atoms_of_type(CONCEPT_NODE);
349350 store->barrier();
350351
351 // Eight: 4 ConceptNodes, the PredicateNode "*-TruthValueKey-*",
352 // Nine: 4 ConceptNodes, the PredicateNode "*-TruthValueKey-*",
352353 // PredicateNode "*-IsKeyFlag-*", PredicateNode "some pred key",
353 // and the RocksStorageNode.
354 // the RocksStorageNode, and PredicateNode "*-open-*".
354355 printf ("fetched %lu atoms\n", as->get_size());
355 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 8);
356 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 9);
356357
357358 Handle gkey = as->add_node(PREDICATE_NODE, "some pred key");
358359 Handle gaf = as->add_node(CONCEPT_NODE, "float node");
……@@ -388,7 +389,7 @@ void ValueSaveUTest::test_load_by_type()
388389 TS_ASSERT(*gpv == *pvv);
389390
390391 // --------------------
391 delete as;
392 as = nullptr;
392393
393394 logger().info("END TEST: %s", __FUNCTION__);
394395}
……@@ -404,10 +405,10 @@ void ValueSaveUTest::test_link_by_type()
404405{
405406 logger().info("BEGIN TEST: %s", __FUNCTION__);
406407
407 AtomSpace* as = new AtomSpace();
408 AtomSpacePtr as = createAtomSpace();
408409 Handle hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
409410 StorageNodePtr store = StorageNodeCast(hsn);
410 store->open();
411 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
411412 TS_ASSERT(store->connected())
412413
413414 Handle key = as->add_node(PREDICATE_NODE, "some pred key");
……@@ -486,15 +487,15 @@ void ValueSaveUTest::test_link_by_type()
486487 store->store_atom(cv);
487488 store->barrier();
488489
489 delete as;
490 as = nullptr;
490491
491492 // --------------------
492493 // Start it up again.
493494
494 as = new AtomSpace();
495 as = createAtomSpace();
495496 hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
496497 store = StorageNodeCast(hsn);
497 store->open();
498 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
498499 TS_ASSERT(store->connected())
499500
500501 // --------------------
……@@ -510,11 +511,11 @@ void ValueSaveUTest::test_link_by_type()
510511 // The B-nodes are added after the fetch. In either case,
511512 // there should not be any values fetched for either A or B;
512513 // only the values on the C-links should be fetched.
513 // +1 for *-IsKeyFlag-*
514 // +1 for *-IsKeyFlag-*, +1 for *-open-*
514515 store->fetch_all_atoms_of_type(LIST_LINK);
515516 store->barrier();
516517 printf ("fetched %lu atoms\n", as->get_size());
517 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 16);
518 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 17);
518519
519520 Handle gbf = as->add_node(CONCEPT_NODE, "b float node");
520521 Handle gbt = as->add_node(CONCEPT_NODE, "b string node");
……@@ -601,7 +602,7 @@ void ValueSaveUTest::test_link_by_type()
601602 TS_ASSERT(*gpv == *pvv);
602603
603604 // --------------------
604 delete as;
605 as = nullptr;
605606
606607 logger().info("END TEST: %s", __FUNCTION__);
607608}
……@@ -614,10 +615,10 @@ void ValueSaveUTest::test_link_by_type_quoted()
614615{
615616 logger().info("BEGIN TEST: %s", __FUNCTION__);
616617
617 AtomSpace* as = new AtomSpace();
618 AtomSpacePtr as = createAtomSpace();
618619 Handle hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
619620 StorageNodePtr store = StorageNodeCast(hsn);
620 store->open();
621 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
621622 TS_ASSERT(store->connected())
622623
623624 Handle key = as->add_node(PREDICATE_NODE, "some (\"pred\"))) key");
……@@ -696,15 +697,15 @@ void ValueSaveUTest::test_link_by_type_quoted()
696697 store->store_atom(cv);
697698 store->barrier();
698699
699 delete as;
700 as = nullptr;
700701
701702 // --------------------
702703 // Start it up again.
703704
704 as = new AtomSpace();
705 as = createAtomSpace();
705706 hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
706707 store = StorageNodeCast(hsn);
707 store->open();
708 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
708709 TS_ASSERT(store->connected())
709710
710711 // --------------------
……@@ -723,10 +724,10 @@ void ValueSaveUTest::test_link_by_type_quoted()
723724 store->fetch_all_atoms_of_type(LIST_LINK);
724725 store->barrier();
725726
726 // We created 9 new atoms above, so expect 16 from before plus 9
727 // +1 for *-IsKeyFlag-*
728 printf ("fetched %lu atoms, expecting 25\n", as->get_size());
729 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 25);
727 // We created 9 new atoms above, so expect 17 from before plus 9
728 // +1 for *-IsKeyFlag-*, +1 for *-open-*
729 printf ("fetched %lu atoms, expecting 26\n", as->get_size());
730 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 26);
730731
731732 Handle gbf = as->add_node(CONCEPT_NODE, "b float node");
732733 Handle gbt = as->add_node(CONCEPT_NODE, "b string node");
……@@ -813,7 +814,7 @@ void ValueSaveUTest::test_link_by_type_quoted()
813814 TS_ASSERT(*gpv == *pvv);
814815
815816 // --------------------
816 delete as;
817 as = nullptr;
817818
818819 logger().info("END TEST: %s", __FUNCTION__);
819820}
……@@ -827,10 +828,10 @@ void ValueSaveUTest::test_incoming()
827828{
828829 logger().info("BEGIN TEST: %s", __FUNCTION__);
829830
830 AtomSpace* as = new AtomSpace();
831 AtomSpacePtr as = createAtomSpace();
831832 Handle hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
832833 StorageNodePtr store = StorageNodeCast(hsn);
833 store->open();
834 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
834835 TS_ASSERT(store->connected())
835836
836837 Handle key = as->add_node(PREDICATE_NODE, "some pred key");
……@@ -909,15 +910,15 @@ void ValueSaveUTest::test_incoming()
909910 store->store_atom(cv);
910911 store->barrier();
911912
912 delete as;
913 as = nullptr;
913914
914915 // --------------------
915916 // Start it up again.
916917
917 as = new AtomSpace();
918 as = createAtomSpace();
918919 hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
919920 store = StorageNodeCast(hsn);
920 store->open();
921 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
921922 TS_ASSERT(store->connected())
922923
923924 // --------------------
……@@ -938,9 +939,9 @@ void ValueSaveUTest::test_incoming()
938939 store->fetch_incoming_set(gal, false);
939940 store->fetch_incoming_set(gav, false);
940941 store->barrier();
941 // +1 for *-IsKeyFlag-*
942 // +1 for *-IsKeyFlag-*, +1 for *-open-*
942943 printf ("fetched %lu atoms\n", as->get_size());
943 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 16);
944 TSM_ASSERT("Wrong number of Atoms fetched!", as->get_size() == 17);
944945
945946 Handle gbf = as->add_node(CONCEPT_NODE, "b float node");
946947 Handle gbt = as->add_node(CONCEPT_NODE, "b string node");
……@@ -1025,7 +1026,7 @@ void ValueSaveUTest::test_incoming()
10251026 TS_ASSERT(*gpv == *pvv);
10261027
10271028 // --------------------
1028 delete as;
1029 as = nullptr;
10291030
10301031 logger().info("END TEST: %s", __FUNCTION__);
10311032}