Files
TourmalineTests/test_Hashmap.cpp
2026-03-04 07:05:37 +02:00

40 lines
886 B
C++

#include <Tourmaline/Containers/Hashmap.hpp>
#include <Tourmaline/Systems/Logging.hpp>
#include <string>
using namespace Tourmaline;
int main() {
Containers::Hashmap<std::string, std::size_t, 0.75f, 8> count;
std::string input = "74 eb ff 5c f0 a9 4f 93 2e e1 1b 47 a4 13 3b 93 ";
std::string buffer = "";
for (char letter : input) {
if (letter == ' ') {
if (count.Has(buffer)) {
count.Get(buffer)++;
} else {
count.Insert(buffer, 1);
}
buffer.clear();
continue;
}
buffer += letter;
}
for (char letter : input) {
if (letter == ' ') {
if (count.Has(buffer)) {
Systems::Logging::Log(std::format("{} = {}", buffer, count.Get(buffer)),
"Test");
count.Remove(buffer);
}
buffer.clear();
continue;
}
buffer += letter;
}
return 0;
}