OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-rocks commits / 68da159

More test conversions
68da159f68bd06589ec998ede0a4cba0e5d6e6d2
by Linas Vepstas <linasvepstas@gmail.com> · 2026-01-19T00:13:54.000Z

Changed files (3) +38 -35

tests/persist/monospace/MonoLargeFlatUTest.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/monospace/MonoStorage.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(MONO_STORAGE_NODE, "monospace:///tmp/cog-mono-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(MONO_STORAGE_NODE, "monospace:///tmp/cog-mono-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(MONO_STORAGE_NODE, "monospace:///tmp/cog-mono-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/monospace/MonoLargeZipfUTest.cxxtest +14 -13
……@@ -34,6 +34,7 @@
3434#include <opencog/atomspace/AtomSpace.h>
3535#include <opencog/persist/rocks-types/atom_types.h>
3636#include <opencog/atoms/value/FloatValue.h>
37#include <opencog/atoms/value/VoidValue.h>
3738#include <opencog/persist/monospace/MonoStorage.h>
3839
3940#include <opencog/util/Logger.h>
……@@ -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(MONO_STORAGE_NODE, "monospace:///tmp/cog-mono-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(MONO_STORAGE_NODE, "monospace:///tmp/cog-mono-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(MONO_STORAGE_NODE, "monospace:///tmp/cog-mono-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/monospace/MonoQueryPersistUTest.cxxtest +4 -3
……@@ -34,6 +34,7 @@
3434#include <opencog/persist/rocks-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/persist/monospace/MonoStorage.h>
3839
3940#include <opencog/util/Logger.h>
……@@ -126,7 +127,7 @@ void QueryPersistUTest::setup_data(void)
126127
127128 Handle hsn = _as->add_node(MONO_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(MONO_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(MONO_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.