ADD: added UtilFcuntion class and a test function
This commit is contained in:
38
tests/test_UtilFunctions.cpp
Normal file
38
tests/test_UtilFunctions.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include <SimCore/UtilFunctions.hpp>
|
||||
#include <string>
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
SCENARIO("Testing the SimCorePositionClass")
|
||||
{
|
||||
GIVEN("different position in different forms")
|
||||
{
|
||||
|
||||
std::string s1 = "hello.world.guy";
|
||||
std::string s2 = "my;Name;is;henry";
|
||||
|
||||
|
||||
WHEN("constructing Position Object with data")
|
||||
{
|
||||
auto v1 = SimCore::UtilFunctions::explode(s1, '.');
|
||||
auto v2 = SimCore::UtilFunctions::explode(s2, ';');
|
||||
auto v3 = SimCore::UtilFunctions::explode(s2, '.');
|
||||
|
||||
|
||||
THEN("positions attributes are correct")
|
||||
{
|
||||
REQUIRE(v1.size() == 3);
|
||||
REQUIRE(v1.begin()->compare("hello") == 0);
|
||||
|
||||
REQUIRE(v2.size() == 4);
|
||||
REQUIRE(v2[1].compare("Name") == 0);
|
||||
|
||||
|
||||
|
||||
} //THEN
|
||||
} // WHEN
|
||||
} // GIVEN
|
||||
} //SCENARIO
|
||||
Reference in New Issue
Block a user