fixed push_whack_pop to also handle directories
[feisty_meow.git] / nucleus / library / tests_structures / test_hash_table.cpp
index e4486f60873b2593a5360ee3f518787d330671cb..ca0d465fcf9b980617680b0a68e1739436b3f493 100644 (file)
@@ -95,7 +95,9 @@ public:
   DEFINE_CLASS_NAME("test_hash_table");
 
   int raw_random_id();  //!< returns an unvetted random number.
-  int unused_random_id();  //!< returns an unused (so far) random number.
+
+  //! returns an unused (so far) random number.
+  int unused_random_id();
 
   int execute();
     // the main startup for the test.
@@ -159,6 +161,7 @@ int test_hash_table::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;  // this is a failure, but we will never get here.
 }
 
 int test_hash_table::execute()
@@ -244,7 +247,8 @@ bool test_hash_table::test_add()
   to_add->snacky_string = string_manipulation::make_random_name();
   to_add->food_bar = random_id;
   outcome expected = common::IS_NEW;
-  if (_keys_in_use.member(random_id)) return common::EXISTING;
+  // make sure it doesn't exist already.
+  if (_keys_in_use.member(random_id)) return false;
   ASSERT_EQUAL(_the_table.add(random_id, to_add).value(), expected.value(),
       "add should give proper outcome based on expectation");
   if (_keys_in_use.member(random_id))
@@ -517,3 +521,4 @@ return false;
 
 HOOPLE_MAIN(test_hash_table, )
 
+