OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace-cog commits / b8b8d2f

More conversions; fixed count on MultiDeleteUTest
b8b8d2f640f1484903e6dd3103a1102fc3506521
by Linas Vepstas <linasvepstas@gmail.com> · 2025-12-13T04:14:16.000Z

Changed files (4) +13 -39

tests/persist/cog-storage/BasicDeleteUTest.cxxtest +3 -12
……@@ -46,8 +46,7 @@ class BasicDeleteUTest : public CxxTest::TestSuite
4646{
4747 private:
4848 std::string uri;
49 CogServer* srvr = NULL;
50 std::thread* main_loop = NULL;
49 DECLARE_TEST_COGSERVER
5150
5251 public:
5352
……@@ -59,21 +58,13 @@ class BasicDeleteUTest : public CxxTest::TestSuite
5958
6059 uri = "cog://localhost:16010";
6160
62 // Create a single cogserver node that will act as
63 // as the repo for the duration of the test.
64 srvr = &cogserver();
65 srvr->loadModules();
66 srvr->enableNetworkServer(16010);
67 main_loop = new std::thread(&CogServer::serverLoop, srvr);
61 INIT_TEST_COGSERVER(16010);
6862 printf("Started CogServer\n");
6963 }
7064
7165 ~BasicDeleteUTest()
7266 {
73 srvr->stop();
74 main_loop->join();
75 srvr->disableNetworkServer();
76 delete main_loop;
67 STOP_TEST_COGSERVER
7768
7869 // erase the log file if no assertions failed
7970 if (!CxxTest::TestTracker::tracker().suiteFailed())
tests/persist/cog-storage/DeleteUTest.cxxtest +3 -12
……@@ -44,8 +44,7 @@ class DeleteUTest : public CxxTest::TestSuite
4444{
4545 private:
4646 AtomSpacePtr _as;
47 CogServer* srvr = NULL;
48 std::thread * main_loop = NULL;
47 DECLARE_TEST_COGSERVER
4948
5049 NodePtr n1[10];
5150 NodePtr n2[10];
……@@ -67,10 +66,7 @@ class DeleteUTest : public CxxTest::TestSuite
6766 DeleteUTest(void);
6867 ~DeleteUTest()
6968 {
70 srvr->stop();
71 main_loop->join();
72 srvr->disableNetworkServer();
73 delete main_loop;
69 STOP_TEST_COGSERVER
7470
7571 // erase the log file if no assertions failed
7672 if (!CxxTest::TestTracker::tracker().suiteFailed())
……@@ -104,12 +100,7 @@ DeleteUTest:: DeleteUTest(void)
104100 logger().set_print_to_stdout_flag(true);
105101 // logger().set_sync_flag(true);
106102
107 // Create a single cogserver node that will act as
108 // as the repo for the duration of the test.
109 srvr = &cogserver();
110 srvr->loadModules();
111 srvr->enableNetworkServer(16005);
112 main_loop = new std::thread(&CogServer::serverLoop, srvr);
103 INIT_TEST_COGSERVER(16005);
113104 printf("Started CogServer\n");
114105}
115106
tests/persist/cog-storage/FetchUTest.cxxtest +2 -10
……@@ -55,10 +55,7 @@ class FetchUTest : public CxxTest::TestSuite
5555 FetchUTest(void);
5656 ~FetchUTest()
5757 {
58 srvr->stop();
59 main_loop->join();
60 srvr->disableNetworkServer();
61 delete main_loop;
58 STOP_TEST_COGSERVER
6259
6360 logger().flush();
6461
……@@ -86,12 +83,7 @@ FetchUTest::FetchUTest(void)
8683
8784 srv_open = "(cog-open (CogStorageNode \"" + uri + "\"))\n";
8885
89 // Create a single cogserver node that will act as
90 // as the repo for the duration of the test.
91 srvr = &cogserver();
92 srvr->loadModules();
93 srvr->enableNetworkServer(16004);
94 main_loop = new std::thread(&CogServer::serverLoop, srvr);
86 INIT_TEST_COGSERVER(16004);
9587 printf("Started CogServer\n");
9688}
9789
tests/persist/cog-storage/MultiDeleteUTest.cxxtest +5 -5
……@@ -197,13 +197,13 @@ void MultiDeleteUTest::test_add_delete(void)
197197 store->load_atomspace();
198198 printf("Final AtomSpace size=%lu\n", as->get_size());
199199
200 // Size should be 19: the 18 from before plus that annoying
201 // (Predicate "*-TruthValueKey-*")
200 // Size should be 20: the 18 from before plus that annoying
201 // (Predicate "*-TruthValueKey-*") And also *-IsKeyFlag-*
202202 // Well, actually, there is no guarantee that the removes will
203203 // happen after the stores. Best we can do is check lower and
204 // upper bounds of 18 and 34:
205 size_t min_size = 3 + n_threads + 6;
206 size_t max_size = 3 + 2*(n_threads + 6);
204 // upper bounds of 20 and 36:
205 size_t min_size = 4 + n_threads + 6;
206 size_t max_size = 4 + 2*(n_threads + 6);
207207 if (as->get_size() < min_size or max_size < as->get_size())
208208 printf("Error: Bad size! AtomSpace contents =\n%s\n",
209209 as->to_string().c_str());