ADD: added a simple threadsafe map class
This commit is contained in:
41
tests/test_SafeMap.cpp
Normal file
41
tests/test_SafeMap.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
#include <memory>
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
#include <SimCore/SafeMap.hpp>
|
||||
#include <loguru.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
SCENARIO("Testing the SimCore Track")
|
||||
{
|
||||
GIVEN("different Attributes for a Track in different forms")
|
||||
{
|
||||
|
||||
int i = 0;
|
||||
WHEN("constructing Track Object with data")
|
||||
{
|
||||
auto store = SimCore::SafeMap<std::string, int>();
|
||||
|
||||
store.addValue("h1", 1);
|
||||
store.addValue("h2", 2);
|
||||
LOG_S(INFO)<<"store size = " << store.size();
|
||||
|
||||
store.removePair("h2");
|
||||
THEN("check if Track attributes are correct")
|
||||
{
|
||||
REQUIRE(store.size() == 1);
|
||||
REQUIRE(store.getValue("h1") == 1);
|
||||
|
||||
store.overRideValue("h1", 3);
|
||||
REQUIRE(store.size() == 1);
|
||||
REQUIRE(store.getValue("h1") == 3);
|
||||
|
||||
|
||||
|
||||
|
||||
} //THEN
|
||||
} // WHEN
|
||||
} // GIVEN
|
||||
} //SCENARIO
|
||||
Reference in New Issue
Block a user