test: runtime unit tests refactored to have a bigger granularity (less top level tests)

This commit is contained in:
Mateusz Pusz
2024-11-12 11:27:52 +01:00
parent 123b4c0f14
commit 78204c7e5f
5 changed files with 1528 additions and 1495 deletions

View File

@@ -38,19 +38,22 @@ import mp_units;
using namespace mp_units;
TEST_CASE("fixed_string::at", "[fixed_string]")
TEST_CASE("fixed_string operations", "[fixed_string]")
{
basic_fixed_string txt = "abc";
SECTION("in range")
SECTION("fixed_string::at")
{
CHECK(txt.at(0) == 'a');
CHECK(txt.at(1) == 'b');
CHECK(txt.at(2) == 'c');
}
SECTION("out of range")
{
REQUIRE_THROWS_MATCHES(txt.at(3), std::out_of_range, Catch::Matchers::Message("basic_fixed_string::at"));
REQUIRE_THROWS_MATCHES(txt.at(1024), std::out_of_range, Catch::Matchers::Message("basic_fixed_string::at"));
basic_fixed_string txt = "abc";
SECTION("in range")
{
CHECK(txt.at(0) == 'a');
CHECK(txt.at(1) == 'b');
CHECK(txt.at(2) == 'c');
}
SECTION("out of range")
{
REQUIRE_THROWS_MATCHES(txt.at(3), std::out_of_range, Catch::Matchers::Message("basic_fixed_string::at"));
REQUIRE_THROWS_MATCHES(txt.at(1024), std::out_of_range, Catch::Matchers::Message("basic_fixed_string::at"));
}
}
}