-first draft of BinSearchArrayMap

This commit is contained in:
Metehan Tuncbilek
2024-09-23 17:00:07 +03:00
parent f8326a5686
commit 02d84af907
3 changed files with 6 additions and 7 deletions

View File

@@ -70,7 +70,8 @@ namespace OpenVulkano
return it->second;
}
V& Get(K key) noexcept {
V& Get(K key) noexcept
{
auto it = std::lower_bound(m_data.begin(), m_data.end(), key,
[](const auto& pair, const K& key) { return pair.first < key; });

View File

@@ -12,6 +12,7 @@
#include <type_traits>
#include "Data/Containers/BinSearchArrayMap.hpp"
#include "Data/Containers/StableVector.hpp"
using namespace OpenVulkano;
@@ -26,7 +27,6 @@ TEST_CASE("BinSearchArrayMap")
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");
@@ -39,4 +39,5 @@ TEST_CASE("BinSearchArrayMap")
map.Insert(10, "Five");
REQUIRE(map[6] == "Three");
REQUIRE(map[10] == "Five");
}

View File

@@ -95,7 +95,6 @@ TEST_CASE("MemMappedFileWrite")
OpenVulkano::MemMappedFileWriteHelper::USE_CURRENT_FILE_SIZE);
REQUIRE(helper.Data() != nullptr);
std::string testData((char*) helper.Data());
printf("size: %llu", helper.Size());
helper.Close();
std::ifstream file(path, std::ios::binary);
@@ -112,8 +111,6 @@ TEST_CASE("MemMappedFileWrite")
}
REQUIRE(streamData.size() == testData.size());
printf("helper size: %llu\n", helper.Size());
}
SECTION("Actual Size")