fix on BinSearchArrayMap (W.I.P)
This commit is contained in:
@@ -18,26 +18,22 @@ using namespace OpenVulkano;
|
||||
|
||||
TEST_CASE("BinSearchArrayMap")
|
||||
{
|
||||
std::vector<std::pair<int, std::string>> data;
|
||||
data.push_back(std::make_pair(1, "One"));
|
||||
data.push_back(std::make_pair(2, "Two"));
|
||||
data.push_back(std::make_pair(6, "Three"));
|
||||
data.push_back(std::make_pair(8, "Four"));
|
||||
data.push_back(std::make_pair(10, "Five"));
|
||||
BinSearchArrayMap<int, std::string, std::pair<int, std::string>, StableVector<std::pair<int, std::string>>> map;
|
||||
|
||||
auto wtf =
|
||||
std::lower_bound(data.begin(), data.end(), 10, [](const auto& pair, const int& key) { return pair.first < key; });
|
||||
auto test = *wtf;
|
||||
REQUIRE(test.first == 10);
|
||||
REQUIRE(test.second == "Five");
|
||||
|
||||
BinSearchArrayMap<int, std::string> map;
|
||||
map.Insert(1, "One");
|
||||
map.Insert(2, "Two");
|
||||
map.Insert(6, "Three");
|
||||
map.Insert(8, "Four");
|
||||
map.Insert(10, "Five");
|
||||
|
||||
REQUIRE(map[6] == "Three");
|
||||
REQUIRE(map[10] == "Five");
|
||||
REQUIRE(map.Get(1) == "One");
|
||||
REQUIRE(map.Get(2) == "Two");
|
||||
REQUIRE(map.Get(6) == "Three");
|
||||
REQUIRE(map.Get(8) == "Four");
|
||||
REQUIRE(map.Get(10) == "Five");
|
||||
|
||||
REQUIRE(map.Size() == 5);
|
||||
|
||||
map.Remove(6);
|
||||
REQUIRE(map.Size() == 4);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user