OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-rocks commits / 86e2287

Convert the reamining unit tests
86e22879555adbe944527afcfb5b6d5b8eb52b35
by Linas Vepstas <linasvepstas@gmail.com> · 2026-01-19T00:46:19.000Z

Changed files (8) +95 -88

tests/persist/rocks/AlphaEquivUTest.cxxtest +16 -16
……@@ -31,7 +31,7 @@
3131#include <opencog/atoms/base/Link.h>
3232#include <opencog/atoms/base/Node.h>
3333#include <opencog/atoms/value/FloatValue.h>
34#include <opencog/atoms/value/FloatValue.h>
34#include <opencog/atoms/value/VoidValue.h>
3535#include <opencog/atomspace/AtomSpace.h>
3636#include <opencog/persist/rocks-types/atom_types.h>
3737#include <opencog/persist/rocks/RocksStorage.h>
……@@ -43,7 +43,7 @@ using namespace opencog;
4343class AlphaEquivUTest : public CxxTest::TestSuite
4444{
4545 private:
46 AtomSpace* _as;
46 AtomSpacePtr _as;
4747 std::string uri;
4848
4949 public:
……@@ -123,11 +123,11 @@ void AlphaEquivUTest::setup_data(void)
123123{
124124 kill_data();
125125
126 _as = new AtomSpace();
126 _as = createAtomSpace();
127127
128128 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
129129 StorageNodePtr store = StorageNodeCast(hsn);
130 store->open();
130 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
131131 TS_ASSERT(store->connected())
132132
133133 /* Populate the Storage with stuff that we will later query. */
……@@ -140,7 +140,7 @@ void AlphaEquivUTest::setup_data(void)
140140 store->store_atomspace();
141141 store->barrier();
142142
143 delete _as;
143 _as = nullptr;
144144}
145145
146146// ============================================================
……@@ -152,10 +152,10 @@ void AlphaEquivUTest::test_fetch(void)
152152
153153 setup_data();
154154
155 _as = new AtomSpace();
155 _as = createAtomSpace();
156156 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
157157 StorageNodePtr store = StorageNodeCast(hsn);
158 store->open();
158 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
159159 TS_ASSERT(store->connected())
160160
161161 // Fetch an alpha-equivalent lambda link.
……@@ -183,7 +183,7 @@ void AlphaEquivUTest::test_fetch(void)
183183 FloatValuePtr fvp = FloatValueCast(fu);
184184 TSM_ASSERT_EQUALS("Expecting three floats", fvp->size(), 3);
185185
186 delete _as;
186 _as = nullptr;
187187
188188 logger().info("END TEST: %s", __FUNCTION__);
189189}
……@@ -197,15 +197,15 @@ void AlphaEquivUTest::test_remove(void)
197197
198198 setup_data();
199199
200 _as = new AtomSpace();
200 _as = createAtomSpace();
201201 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
202202 StorageNodePtr store = StorageNodeCast(hsn);
203 store->open();
203 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
204204 TS_ASSERT(store->connected())
205205
206206 // Remove the alpha-equivalent lambda link.
207207 Handle ly = al(LAMBDA_LINK, an(VARIABLE, "Y"), an(CONCEPT, "A"));
208 store->remove_atom(_as, ly);
208 store->remove_atom(_as.get(), ly);
209209 store->barrier();
210210 ly = Handle::UNDEFINED;
211211
……@@ -221,7 +221,7 @@ void AlphaEquivUTest::test_remove(void)
221221 ValuePtr fu = lx->getValue(an(PREDICATE, "foo"));
222222 TSM_ASSERT("Expecting null value", nullptr == fu);
223223
224 delete _as;
224 _as = nullptr;
225225
226226 logger().info("END TEST: %s", __FUNCTION__);
227227}
……@@ -235,15 +235,15 @@ void AlphaEquivUTest::test_recursive_remove(void)
235235
236236 setup_data();
237237
238 _as = new AtomSpace();
238 _as = createAtomSpace();
239239 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
240240 StorageNodePtr store = StorageNodeCast(hsn);
241 store->open();
241 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
242242 TS_ASSERT(store->connected())
243243
244244 // Recursive remove Concept "A".
245245 Handle ca = an(CONCEPT, "A");
246 store->remove_atom(_as, ca, true);
246 store->remove_atom(_as.get(), ca, true);
247247 store->barrier();
248248
249249 // What happens if we look for the original?
……@@ -258,7 +258,7 @@ void AlphaEquivUTest::test_recursive_remove(void)
258258 ValuePtr fu = lx->getValue(an(PREDICATE, "foo"));
259259 TSM_ASSERT("Expecting null value", nullptr == fu);
260260
261 delete _as;
261 _as = nullptr;
262262
263263 logger().info("END TEST: %s", __FUNCTION__);
264264}
tests/persist/rocks/BasicDeleteUTest.cxxtest +2 -2
……@@ -117,8 +117,8 @@ void BasicDeleteUTest::test_duplicates(void)
117117 store->store_atom(li);
118118 store->barrier();
119119
120 // Verify the atomspace size
121 TS_ASSERT_EQUALS(as->get_size(), 4);
120 // Verify the atomspace size: 2 concepts + 1 link + 1 storage node + 1 *-open-*
121 TS_ASSERT_EQUALS(as->get_size(), 5);
122122
123123 // Remove the link. Since the link has duplicate atoms
124124 // in it, this can cause trouble, depending on how the
tests/persist/rocks/LargeFlatUTest.cxxtest +20 -19
……@@ -30,6 +30,7 @@
3030#include <opencog/atoms/base/Link.h>
3131#include <opencog/atoms/base/Node.h>
3232#include <opencog/atoms/value/FloatValue.h>
33#include <opencog/atoms/value/VoidValue.h>
3334#include <opencog/atomspace/AtomSpace.h>
3435#include <opencog/persist/rocks-types/atom_types.h>
3536#include <opencog/persist/rocks/RocksStorage.h>
……@@ -41,7 +42,7 @@ using namespace opencog;
4142class LargeFlatUTest : public CxxTest::TestSuite
4243{
4344 private:
44 AtomSpace *_as;
45 AtomSpacePtr _as;
4546
4647// 75000 * 7 == half-a-million atoms
4748// 19000 * 7 == 133K atoms
……@@ -104,12 +105,12 @@ LargeFlatUTest::~LargeFlatUTest()
104105 */
105106void LargeFlatUTest::setUp(void)
106107{
107 _as = new AtomSpace();
108 _as = createAtomSpace();
108109}
109110
110111void LargeFlatUTest::tearDown(void)
111112{
112 delete _as;
113 _as = nullptr;
113114 kill_data();
114115}
115116
……@@ -342,16 +343,16 @@ int LargeFlatUTest::filler_up(AtomSpace *space)
342343 while (idx < (NCOPIES-20))
343344 {
344345 std::string lbl = std::to_string(idx);
345 add_to_space(idx++, _as, "AA-aa-wow " + lbl);
346 add_to_space(idx++, _as, "BB-bb-wow " + lbl);
347 add_to_space(idx++, _as, "CC-cc-wow " + lbl);
348 add_to_space(idx++, _as, "DD-dd-wow " + lbl);
349 add_to_space(idx++, _as, "EE-ee-wow " + lbl);
346 add_to_space(idx++, _as.get(), "AA-aa-wow " + lbl);
347 add_to_space(idx++, _as.get(), "BB-bb-wow " + lbl);
348 add_to_space(idx++, _as.get(), "CC-cc-wow " + lbl);
349 add_to_space(idx++, _as.get(), "DD-dd-wow " + lbl);
350 add_to_space(idx++, _as.get(), "EE-ee-wow " + lbl);
350351
351352 /* Make sure UTF-8 works fine. */
352 add_to_space(idx++, _as, "Попытка выбраться вызвала слабый стон " + lbl);
353 add_to_space(idx++, _as, "はにがうりだそうであってるのかはち " + lbl);
354 add_to_space(idx++, _as, "係拉丁字母" + lbl);
353 add_to_space(idx++, _as.get(), "Попытка выбраться вызвала слабый стон " + lbl);
354 add_to_space(idx++, _as.get(), "はにがうりだそうであってるのかはち " + lbl);
355 add_to_space(idx++, _as.get(), "係拉丁字母" + lbl);
355356 }
356357 return idx;
357358}
……@@ -364,16 +365,16 @@ void LargeFlatUTest::test_atomspace(void)
364365
365366 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, "rocks:///tmp/cog-rocks-large-flat-utest");
366367 StorageNodePtr store = StorageNodeCast(hsn);
367 store->open();
368 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
368369 TS_ASSERT(store->connected())
369370
370371 /* Create a large number of atoms */
371 int idx = filler_up(_as);
372 int idx = filler_up(_as.get());
372373
373374 /* Verify that the atoms were added */
374375 int i;
375376 for (i=0; i<idx; i++)
376 check_space(i, _as, "verify-add");
377 check_space(i, _as.get(), "verify-add");
377378
378379 /* Push all atoms out to the SQL DB */
379380 store->store_atomspace();
……@@ -389,14 +390,14 @@ void LargeFlatUTest::test_atomspace(void)
389390 /* The clear above nuked the storage, so restart */
390391 hsn = _as->add_node(ROCKS_STORAGE_NODE, "rocks:///tmp/cog-rocks-large-flat-utest");
391392 store = StorageNodeCast(hsn);
392 store->open();
393 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
393394 TS_ASSERT(store->connected())
394395
395396 /* Verify that the atoms can still be fetched from storage. */
396397 for (i=0; i<idx; i++) {
397398 fetch_space(i, store);
398399 store->barrier();
399 check_space(i, _as, "verify-fetch");
400 check_space(i, _as.get(), "verify-fetch");
400401 }
401402
402403 /* Do it again, for good luck. */
……@@ -406,14 +407,14 @@ void LargeFlatUTest::test_atomspace(void)
406407 /* The clear above nuked the storage, so restart */
407408 hsn = _as->add_node(ROCKS_STORAGE_NODE, "rocks:///tmp/cog-rocks-large-flat-utest");
408409 store = StorageNodeCast(hsn);
409 store->open();
410 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
410411 TS_ASSERT(store->connected())
411412
412413 /* Verify that the atoms can still be fetched from storage. */
413414 for (i=0; i<idx; i++) {
414415 fetch_space(i, store);
415416 store->barrier();
416 check_space(i, _as, "ver-again");
417 check_space(i, _as.get(), "ver-again");
417418 }
418419
419420 /* Kill data for good */
……@@ -422,7 +423,7 @@ void LargeFlatUTest::test_atomspace(void)
422423
423424 /* Verify that the atoms are no longer being found. */
424425 for (i=0; i<idx; i++)
425 check_empty(i, _as);
426 check_empty(i, _as.get());
426427
427428 logger().debug("END TEST: %s", __FUNCTION__);
428429}
tests/persist/rocks/LargeZipfUTest.cxxtest +14 -13
……@@ -33,6 +33,7 @@
3333#include <opencog/atoms/base/Node.h>
3434#include <opencog/atomspace/AtomSpace.h>
3535#include <opencog/atoms/value/FloatValue.h>
36#include <opencog/atoms/value/VoidValue.h>
3637#include <opencog/persist/rocks-types/atom_types.h>
3738#include <opencog/persist/rocks/RocksStorage.h>
3839
……@@ -43,7 +44,7 @@ using namespace opencog;
4344class LargeZipfUTest : public CxxTest::TestSuite
4445{
4546 private:
46 AtomSpace *_as;
47 AtomSpacePtr _as;
4748
4849#define NWORDS 35000
4950 Handle hword[NWORDS];
……@@ -92,12 +93,12 @@ LargeZipfUTest::~LargeZipfUTest()
9293 */
9394void LargeZipfUTest::setUp(void)
9495{
95 _as = new AtomSpace();
96 _as = createAtomSpace();
9697}
9798
9899void LargeZipfUTest::tearDown(void)
99100{
100 delete _as;
101 _as = nullptr;
101102 kill_data();
102103}
103104
……@@ -289,14 +290,14 @@ void LargeZipfUTest::test_atomspace(void)
289290
290291 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, "rocks:///tmp/cog-rocks-large-zipf-utest");
291292 StorageNodePtr store = StorageNodeCast(hsn);
292 store->open();
293 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
293294 TS_ASSERT(store->connected())
294295
295296 /* Create a large number of atoms */
296 filler_up(_as);
297 filler_up(_as.get());
297298
298299 /* Verify that the atoms were added */
299 check_space(_as, "verify-add");
300 check_space(_as.get(), "verify-add");
300301
301302 /* Push all atoms out to the SQL DB */
302303 store->store_atomspace();
……@@ -312,13 +313,13 @@ void LargeZipfUTest::test_atomspace(void)
312313 /* The clear above nuked the storage, so restart */
313314 hsn = _as->add_node(ROCKS_STORAGE_NODE, "rocks:///tmp/cog-rocks-large-zipf-utest");
314315 store = StorageNodeCast(hsn);
315 store->open();
316 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
316317 TS_ASSERT(store->connected())
317318
318319 /* Verify that the atoms can still be fetched from storage. */
319 fetch_space(_as, store);
320 fetch_space(_as.get(), store);
320321 store->barrier();
321 check_space(_as, "verify-fetch");
322 check_space(_as.get(), "verify-fetch");
322323
323324 /* Do it again, for good luck. */
324325 _as->clear();
……@@ -327,20 +328,20 @@ void LargeZipfUTest::test_atomspace(void)
327328 /* The clear above nuked the storage, so restart */
328329 hsn = _as->add_node(ROCKS_STORAGE_NODE, "rocks:///tmp/cog-rocks-large-zipf-utest");
329330 store = StorageNodeCast(hsn);
330 store->open();
331 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
331332 TS_ASSERT(store->connected())
332333
333334 /* Verify that the atoms can still be fetched from storage. */
334 fetch_space(_as, store);
335 fetch_space(_as.get(), store);
335336 store->barrier();
336 check_space(_as, "ver-again");
337 check_space(_as.get(), "ver-again");
337338
338339 /* Kill data for good */
339340 _as->clear();
340341 TSM_ASSERT("Non-empty atomspace", 0 == _as->get_size());
341342
342343 /* Verify that the atoms are no longer being found. */
343 check_empty(_as);
344 check_empty(_as.get());
344345
345346 logger().debug("END TEST: %s", __FUNCTION__);
346347}
tests/persist/rocks/MultiDeleteUTest.cxxtest +16 -14
……@@ -34,6 +34,7 @@
3434#include <opencog/atoms/atom_types/atom_types.h>
3535#include <opencog/atoms/value/FloatValue.h>
3636#include <opencog/atoms/value/LinkValue.h>
37#include <opencog/atoms/value/VoidValue.h>
3738#include <opencog/atomspace/AtomSpace.h>
3839
3940#include <opencog/persist/api/StorageNode.h>
……@@ -127,7 +128,7 @@ void MultiDeleteUTest::worker(int thread_id)
127128 if (nullptr == li) continue;
128129
129130 // Remove the link.
130 store->remove_atom(as, li);
131 store->remove_atom(as.get(), li);
131132 }
132133 }
133134
……@@ -150,7 +151,7 @@ void MultiDeleteUTest::test_add_delete(void)
150151 Handle hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
151152 store = StorageNodeCast(hsn);
152153
153 store->open();
154 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
154155 TS_ASSERT(store->connected())
155156
156157 // Clear out left-over junk, just in case.
……@@ -170,17 +171,17 @@ void MultiDeleteUTest::test_add_delete(void)
170171 printf("Post-update AtomSpace size=%lu\n", as->get_size());
171172 // printf("AtomSpace contents =\n%s\n", as->to_string().c_str());
172173
173 // Verify the local AtomSpace size. Should be 34:
174 // The StorageNode itself, the (Concept "aaaa") and
174 // Verify the local AtomSpace size. Should be 35:
175 // The StorageNode itself, the (Concept "aaaa"), *-open-* predicate, and
175176 // 16 Concept and Lists from thread-id modulo 16
176177 // Note: *-IsKeyFlag-* is NOT added by store_atom, only by load operations
177 TS_ASSERT_EQUALS(as->get_size(), 2 + 2*(n_threads+6));
178 TS_ASSERT_EQUALS(as->get_size(), 3 + 2*(n_threads+6));
178179
179180 // Verify the DB contents: pull everything from the DB,
180181 // back to here. Do this "independently", by closing and
181182 // reopening; this forces the Storagenode through assorted
182183 // flush and close code, potentially exposing bugs.
183 store->close();
184 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
184185
185186 HandleSeq hs;
186187 as->get_handles_by_type(hs, CONCEPT_NODE);
……@@ -188,21 +189,22 @@ void MultiDeleteUTest::test_add_delete(void)
188189 as->extract_atom(h, true);
189190 hs.clear();
190191 printf("AtomSpace contents =\n%s\n", as->to_string().c_str());
191 TS_ASSERT_EQUALS(as->get_size(), 1);
192 // Storage node + *-open-* + *-close-*
193 TS_ASSERT_EQUALS(as->get_size(), 3);
192194
193 store->open();
195 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
194196 TS_ASSERT(store->connected())
195197
196198 store->load_atomspace();
197199 printf("Final AtomSpace size=%lu\n", as->get_size());
198200
199 // Size should be 20: the 18 from before plus
200 // (Predicate "*-TruthValueKey-*") and (Predicate "*-IsKeyFlag-*")
201 // Size should be 21: the 18 from before plus
202 // (Predicate "*-TruthValueKey-*"), (Predicate "*-IsKeyFlag-*"), and *-open-*
201203 // Well, actually, there is no guarantee that the removes will
202204 // happen after the stores. Best we can do is check lower and
203 // upper bounds of 20 and 36:
204 size_t min_size = 4 + n_threads + 6;
205 size_t max_size = 4 + 2*(n_threads + 6);
205 // upper bounds of 21 and 37:
206 size_t min_size = 5 + n_threads + 6;
207 size_t max_size = 5 + 2*(n_threads + 6);
206208 if (as->get_size() < min_size or max_size < as->get_size())
207209 printf("Error: Bad size! AtomSpace contents =\n%s\n",
208210 as->to_string().c_str());
……@@ -211,7 +213,7 @@ void MultiDeleteUTest::test_add_delete(void)
211213 TS_ASSERT(as->get_size() <= max_size);
212214
213215 store->erase();
214 store->close();
216 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
215217 store = nullptr;
216218
217219 logger().debug("END TEST: %s", __FUNCTION__);
tests/persist/rocks/MultiPersistUTest.cxxtest +20 -19
……@@ -38,6 +38,7 @@
3838#include <opencog/persist/rocks/RocksStorage.h>
3939
4040#include <opencog/atoms/value/FloatValue.h>
41#include <opencog/atoms/value/VoidValue.h>
4142
4243#include <opencog/util/Logger.h>
4344
……@@ -46,7 +47,7 @@ using namespace opencog;
4647class MultiPersistUTest : public CxxTest::TestSuite
4748{
4849 private:
49 AtomSpace *_as;
50 AtomSpacePtr _as;
5051 StorageNodePtr store;
5152
5253#define NTHREADS 6
……@@ -127,18 +128,18 @@ MultiPersistUTest:: MultiPersistUTest(void)
127128 */
128129void MultiPersistUTest::setUp(void)
129130{
130 _as = new AtomSpace();
131 _as = createAtomSpace();
131132
132133 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, "rocks:///tmp/cog-rocks-multi-persist-utest");
133134 store = StorageNodeCast(hsn);
134 store->open();
135 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
135136 TS_ASSERT(store->connected())
136137}
137138
138139void MultiPersistUTest::tearDown(void)
139140{
140 store->close();
141 delete _as;
141 store->setValue(_as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
142 _as = nullptr;
142143}
143144
144145// ============================================================
……@@ -384,20 +385,20 @@ void MultiPersistUTest::threaded_add(int thread_id)
384385 int idx = 0;
385386 int off = NHACK*thread_id;
386387
387 add_to_space(off + idx++, _as, store, "AA-aa-wow ");
388 add_to_space(off + idx++, _as, store, "BB-bb-wow ");
389 add_to_space(off + idx++, _as, store, "CC-cc-wow ");
390 add_to_space(off + idx++, _as, store, "DD-dd-wow ");
391 add_to_space(off + idx++, _as, store, "EE-ee-wow ");
388 add_to_space(off + idx++, _as.get(), store, "AA-aa-wow ");
389 add_to_space(off + idx++, _as.get(), store, "BB-bb-wow ");
390 add_to_space(off + idx++, _as.get(), store, "CC-cc-wow ");
391 add_to_space(off + idx++, _as.get(), store, "DD-dd-wow ");
392 add_to_space(off + idx++, _as.get(), store, "EE-ee-wow ");
392393
393394 /* Make sure UTF-8 works fine. */
394 add_to_space(off + idx++, _as, store, "Попытка выбраться вызвала слабый стон ");
395 add_to_space(off + idx++, _as, store, "はにがうりだそうであってるのかはち ");
396 add_to_space(off + idx++, _as, store, "係拉丁字母");
395 add_to_space(off + idx++, _as.get(), store, "Попытка выбраться вызвала слабый стон ");
396 add_to_space(off + idx++, _as.get(), store, "はにがうりだそうであってるのかはち ");
397 add_to_space(off + idx++, _as.get(), store, "係拉丁字母");
397398
398399 /* Verify that the atoms were added */
399400 for (int i=0; i<idx; i++)
400 check_space(off+i, _as, "verify-add");
401 check_space(off+i, _as.get(), "verify-add");
401402}
402403
403404// ============================================================
……@@ -431,7 +432,7 @@ void MultiPersistUTest::test_atomspace(void)
431432 /* The clear above nuked the storage, so restart */
432433 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, "rocks:///tmp/cog-rocks-multi-persist-utest");
433434 store = StorageNodeCast(hsn);
434 store->open();
435 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
435436 TS_ASSERT(store->connected())
436437
437438 int i, off;
……@@ -440,7 +441,7 @@ void MultiPersistUTest::test_atomspace(void)
440441 for (off=0; off<n_threads; off++)
441442 for (i=0; i<NATS; i++) {
442443 fetch_space(NHACK*off+i, store);
443 check_space(NHACK*off+i, _as, "verify-fetch-idx=" + std::to_string(i));
444 check_space(NHACK*off+i, _as.get(), "verify-fetch-idx=" + std::to_string(i));
444445 }
445446
446447 /* Do it again, for good luck. */
……@@ -450,14 +451,14 @@ void MultiPersistUTest::test_atomspace(void)
450451 /* The clear above nuked the storage, so restart */
451452 hsn = _as->add_node(ROCKS_STORAGE_NODE, "rocks:///tmp/cog-rocks-multi-persist-utest");
452453 store = StorageNodeCast(hsn);
453 store->open();
454 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
454455 TS_ASSERT(store->connected())
455456
456457 /* Verify that the atoms can still be fetched from storage. */
457458 for (off=0; off<n_threads; off++)
458459 for (i=0; i<NATS; i++) {
459460 fetch_space(NHACK*off+i, store);
460 check_space(NHACK*off+i, _as, "verify-again");
461 check_space(NHACK*off+i, _as.get(), "verify-again");
461462 }
462463
463464 /* Kill data for good */
……@@ -467,7 +468,7 @@ void MultiPersistUTest::test_atomspace(void)
467468 /* Verify that the atoms are no longer being found. */
468469 for (off=0; off<n_threads; off++)
469470 for (i=0; i<NATS; i++)
470 check_empty(NHACK*off+i, _as);
471 check_empty(NHACK*off+i, _as.get());
471472
472473 logger().debug("END TEST: %s", __FUNCTION__);
473474}
tests/persist/rocks/QueryPersistUTest.cxxtest +4 -3
……@@ -33,6 +33,7 @@
3333#include <opencog/atomspace/AtomSpace.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/persist/rocks-types/atom_types.h>
3738#include <opencog/persist/rocks/RocksStorage.h>
3839
……@@ -126,7 +127,7 @@ void QueryPersistUTest::setup_data(void)
126127
127128 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
128129 StorageNodePtr store = StorageNodeCast(hsn);
129 store->open();
130 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
130131 TS_ASSERT(store->connected())
131132
132133 /* Populate the Storage with stuff that we will later query. */
……@@ -173,7 +174,7 @@ void QueryPersistUTest::test_meet(void)
173174 _as = createAtomSpace();
174175 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
175176 StorageNodePtr store = StorageNodeCast(hsn);
176 store->open();
177 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
177178 TS_ASSERT(store->connected())
178179
179180 // Create a query to find all things that have wheels.
……@@ -234,7 +235,7 @@ void QueryPersistUTest::test_join(void)
234235 _as = createAtomSpace();
235236 Handle hsn = _as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
236237 StorageNodePtr store = StorageNodeCast(hsn);
237 store->open();
238 store->setValue(_as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
238239 TS_ASSERT(store->connected())
239240
240241 // Create a join to find all vehicles.
tests/persist/rocks/ThreadCountUTest.cxxtest +3 -2
……@@ -32,6 +32,7 @@
3232
3333#include <opencog/atoms/base/Atom.h>
3434#include <opencog/atoms/value/FloatValue.h>
35#include <opencog/atoms/value/VoidValue.h>
3536#include <opencog/atomspace/AtomSpace.h>
3637#include <opencog/guile/SchemeEval.h>
3738
……@@ -242,7 +243,7 @@ void ThreadCountUTest::harness(int n_loops, const char* cmd)
242243 hsn = as->add_node(ROCKS_STORAGE_NODE, std::string(uri));
243244 store = StorageNodeCast(hsn);
244245
245 store->open();
246 store->setValue(as->add_node(PREDICATE_NODE, "*-open-*"), createVoidValue());
246247 TS_ASSERT(store->connected())
247248
248249 store->load_atomspace();
……@@ -252,7 +253,7 @@ void ThreadCountUTest::harness(int n_loops, const char* cmd)
252253 check(n_threads * n_loops, relo.c_str());
253254
254255 store->erase();
255 store->close();
256 store->setValue(as->add_node(PREDICATE_NODE, "*-close-*"), createVoidValue());
256257 store = nullptr;
257258}
258259