Skip to content

Commit

Permalink
uncomment and fix behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
matt439 committed Oct 2, 2024
1 parent b0191ca commit 9405f05
Showing 1 changed file with 19 additions and 27 deletions.
46 changes: 19 additions & 27 deletions coresdk/src/test/unit_tests/unit_test_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,17 +497,14 @@ TEST_CASE("replace all occurrences of a substring in a string with another strin
{
REQUIRE(replace_all("splashkit library", "splashkit", "") == " library");
}
// Following test cases are commented out because they cause infinite loops
// with the current implementation of replace_all

// SECTION("substring is empty")
// {
// REQUIRE(replace_all("splashkit library", "", "SK") == "splashkit library");
// }
// SECTION("both string and substring are empty")
// {
// REQUIRE(replace_all("", "", "SK") == "");
// }
SECTION("substring is empty")
{
REQUIRE(replace_all("splashkit library", "", "SK") == "splashkit library");
}
SECTION("both string and substring are empty")
{
REQUIRE(replace_all("", "", "SK") == "");
}
}
TEST_CASE("can split a string into an array of strings based on a delimiter")
{
Expand Down Expand Up @@ -670,14 +667,11 @@ TEST_CASE("random number int between 0 and ubound is generated", "[rnd(int uboun
int result = rnd(-1);
REQUIRE(result == 0);
}
// Following test case is commented out because it generates an
// unhadled arithmetic exception with the current implementation of rnd

// SECTION("ubound is 0")
// {
// int result = rnd(0);
// REQUIRE(result == 0);
// }
SECTION("ubound is 0")
{
int result = rnd(0);
REQUIRE(result == 0);
}
}
TEST_CASE("random number int between min and max is generated", "[rnd(int min, int max)]")
{
Expand All @@ -702,16 +696,14 @@ TEST_CASE("random number int between min and max is generated", "[rnd(int min, i
SECTION("min is 1 and max is 0")
{
int result = rnd(1, 0);
REQUIRE(result >= 0);
REQUIRE(result <= 1);
}
SECTION("min is 1 and max is 1")
{
int result = rnd(1, 1);
REQUIRE(result == 1);
}
// Following test case is commented out because it generates an
// unhadled arithmetic exception with the current implementation of rnd

// SECTION("min is 1 and max is 1")
// {
// int result = rnd(1, 1);
// REQUIRE(result == 1);
// }
}
TEST_CASE("gets the number of milliseconds that have passed since the program was started", "[current_ticks]")
{
Expand Down

0 comments on commit 9405f05

Please sign in to comment.