X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Ftests_structures%2Ftest_int_hash.cpp;h=1d6b205180fa14d8ae41b494a33a2b28ca0de535;hb=56a8b71bcfe324f83044a12738004151ff2fc064;hp=1c888daae89523dfcac00b34f38436fbf3de1247;hpb=3ea085ec301ed1399dfa1e9f3a240312dc95410b;p=feisty_meow.git diff --git a/nucleus/library/tests_structures/test_int_hash.cpp b/nucleus/library/tests_structures/test_int_hash.cpp index 1c888daa..1d6b2051 100644 --- a/nucleus/library/tests_structures/test_int_hash.cpp +++ b/nucleus/library/tests_structures/test_int_hash.cpp @@ -102,7 +102,7 @@ public: data_shuttle() : snacky_string(string_manipulation::make_random_name()), - chunk(chao.inclusive(100, 10000)) {} + chunk(chao.inclusive(100, 10000)), food_bar(0), hungry(false) {} }; ////////////// @@ -252,6 +252,7 @@ int test_int_hash::unused_random_id() int checking = raw_random_id(); if (!_keys_in_use.member(checking)) return checking; // got one. } // keep going until we find unused id. + return -1; } bool test_int_hash::test_add() @@ -277,7 +278,7 @@ bool test_int_hash::test_add() #undef UNIT_BASE_THIS_OBJECT #define UNIT_BASE_THIS_OBJECT (*dynamic_cast(application_shell::single_instance())) -int_hash *_hang_on = NIL; +int_hash *_hang_on = NULL_POINTER; // must be set before calling the apply method. bool test_int_hash::equivalence_applier(const int &key, data_shuttle &item, void *dlink) @@ -451,11 +452,11 @@ bool test_int_hash::test_find() _hits[FIND - FIRST_TEST]++; int rand_indy = randomizer().inclusive(0, _keys_in_use.elements() - 1); int find_key = _keys_in_use[rand_indy]; - data_shuttle *found = NIL; + data_shuttle *found = NULL_POINTER; ASSERT_TRUE(_the_table.find(functional_return(find_key), found), "key should be there when we look"); ASSERT_TRUE(_the_table.find(functional_return(find_key)), "find2: key be there when checked"); - ASSERT_TRUE(found, "when key is found contents should not be NIL"); + ASSERT_TRUE(found, "when key is found contents should not be null"); ASSERT_EQUAL(found->food_bar, find_key, "stored key should be same as real key"); ASSERT_TRUE(found->snacky_string.length(), "stored string should have some length"); return true; @@ -490,10 +491,10 @@ bool test_int_hash::test_find_zap_add() int rand_indy = randomizer().inclusive(0, _keys_in_use.elements() - 1); // this is another key list invariant function, if it works. int find_key = _keys_in_use[rand_indy]; - data_shuttle *found = NIL; + data_shuttle *found = NULL_POINTER; ASSERT_TRUE(_the_table.find(find_key, found), "key should be there when sought"); ASSERT_TRUE(_the_table.find(find_key), "find2: key should be there for us to find"); - ASSERT_TRUE(found, "found key should have non-NIL contents"); + ASSERT_TRUE(found, "found key should have non-null contents"); ASSERT_EQUAL(found->food_bar, find_key, "stored key should have no differences from real key"); ASSERT_TRUE(found->snacky_string.length(), "stored string should have non-zero length"); // zap.