40 lines
943 B
C++
40 lines
943 B
C++
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#include <catch2/catch_all.hpp>
|
|
|
|
#include <vector>
|
|
#include <map>
|
|
#include <utility>
|
|
#include <type_traits>
|
|
|
|
#include "Data/Containers/BinSearchArrayMap.hpp"
|
|
#include "Data/Containers/StableVector.hpp"
|
|
|
|
using namespace OpenVulkano;
|
|
|
|
TEST_CASE("BinSearchArrayMap")
|
|
{
|
|
BinSearchArrayMap<int, std::string, std::pair<int, std::string>, StableVector<std::pair<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.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);
|
|
}
|