diff --git a/libuavcan/test/util/map.cpp b/libuavcan/test/util/map.cpp index 947bb52010..0fa31f03f1 100644 --- a/libuavcan/test/util/map.cpp +++ b/libuavcan/test/util/map.cpp @@ -87,14 +87,6 @@ TEST(Map, Basic) ASSERT_EQ("d", *map->access("4")); ASSERT_FALSE(map->access("hi")); - // Ordering - ASSERT_TRUE(map->getByIndex(0)->match("1")); - ASSERT_TRUE(map->getByIndex(1)->match("2")); - ASSERT_TRUE(map->getByIndex(2)->match("3")); - ASSERT_TRUE(map->getByIndex(3)->match("4")); - ASSERT_FALSE(map->getByIndex(4)); - ASSERT_FALSE(map->getByIndex(1000)); - // Modifying existing entries *map->access("1") = "A"; *map->access("2") = "B"; @@ -130,22 +122,17 @@ TEST(Map, Basic) ASSERT_EQ("C", *map->access("3")); ASSERT_EQ("D", *map->access("4")); - // Ordering has not changed - first dynamic entry has moved to the first static slot - ASSERT_TRUE(map->getByIndex(0)->match("3")); - ASSERT_TRUE(map->getByIndex(1)->match("2")); - ASSERT_TRUE(map->getByIndex(2)->match("4")); - - // Removing another static + // Removing another map->remove("2"); - ASSERT_EQ(1, map->getSize()); - ASSERT_EQ(1, pool.getNumUsedBlocks()); // No dynamic entries left + ASSERT_EQ(2, map->getSize()); + ASSERT_EQ(2, pool.getNumUsedBlocks()); ASSERT_FALSE(map->access("1")); ASSERT_FALSE(map->access("2")); ASSERT_EQ("C", *map->access("3")); ASSERT_EQ("D", *map->access("4")); - // Adding some new dynamics + // Adding some new unsigned max_key_integer = 0; for (int i = 0; i < 100; i++) { @@ -195,36 +182,6 @@ TEST(Map, Basic) } -TEST(Map, NoStatic) -{ - using uavcan::Map; - - static const int POOL_BLOCKS = 3; - uavcan::PoolAllocator pool; - - typedef Map MapType; - std::auto_ptr map(new MapType(pool)); - - // Empty - ASSERT_FALSE(map->access("hi")); - map->remove("foo"); - ASSERT_EQ(0, pool.getNumUsedBlocks()); - ASSERT_FALSE(map->getByIndex(0)); - - // Insertion - ASSERT_EQ("a", *map->insert("1", "a")); - ASSERT_EQ("b", *map->insert("2", "b")); - ASSERT_EQ(1, pool.getNumUsedBlocks()); - ASSERT_EQ(2, map->getSize()); - - // Ordering - ASSERT_TRUE(map->getByIndex(0)->match("1")); - ASSERT_TRUE(map->getByIndex(1)->match("2")); - ASSERT_FALSE(map->getByIndex(3)); - ASSERT_FALSE(map->getByIndex(1000)); -} - - TEST(Map, PrimitiveKey) { using uavcan::Map; diff --git a/libuavcan/test/util/multiset.cpp b/libuavcan/test/util/multiset.cpp index bfd6384049..715d99922d 100644 --- a/libuavcan/test/util/multiset.cpp +++ b/libuavcan/test/util/multiset.cpp @@ -108,10 +108,6 @@ TEST(Multiset, Basic) ASSERT_LE(1, pool.getNumUsedBlocks()); // One or more ASSERT_EQ(4, mset->getSize()); - // Making sure everything is here - ASSERT_EQ("1", *mset->getByIndex(0)); - ASSERT_EQ("2", *mset->getByIndex(1)); - // 2 and 3 are not tested because their placement depends on number of items per dynamic block ASSERT_FALSE(mset->getByIndex(100)); ASSERT_FALSE(mset->getByIndex(4)); @@ -219,16 +215,6 @@ TEST(Multiset, PrimitiveKey) ASSERT_EQ(4, *mset->emplace(4)); ASSERT_EQ(4, mset->getSize()); -#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11 - // Only C++11 because C++03 uses one entry per pool block which breaks ordering - ASSERT_EQ(1, *mset->getByIndex(0)); - ASSERT_EQ(2, *mset->getByIndex(1)); - ASSERT_EQ(3, *mset->getByIndex(2)); - ASSERT_EQ(4, *mset->getByIndex(3)); - ASSERT_FALSE(mset->getByIndex(5)); - ASSERT_FALSE(mset->getByIndex(1000)); -#endif - // Summation and clearing { SummationOperator summation_operator; @@ -268,11 +254,9 @@ TEST(Multiset, NoncopyableWithCounter) mset->removeFirst(NoncopyableWithCounter(0)); ASSERT_EQ(4, NoncopyableWithCounter::num_objects); - ASSERT_EQ(123, mset->getByIndex(0)->value); mset->removeFirstWhere(&NoncopyableWithCounter::isNegative); ASSERT_EQ(3, NoncopyableWithCounter::num_objects); - ASSERT_EQ(456, mset->getByIndex(1)->value); // -456 is now removed mset->removeAllWhere(&NoncopyableWithCounter::isNegative); ASSERT_EQ(2, NoncopyableWithCounter::num_objects); // Only 1 and 2 are left