mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Common/Util: Trinity::StringTo<double> support (PR #25364)
(cherry picked from commit f45aa5cac1)
This commit is contained in:
@@ -48,13 +48,30 @@ TEST_CASE("Command argument parsing", "[ChatCommand]")
|
||||
TestChatCommand("true", [](ChatHandler*, uint32) { return true; }, false);
|
||||
}
|
||||
|
||||
SECTION("std::vector<uint8>")
|
||||
SECTION("Floating point argument")
|
||||
{
|
||||
TestChatCommand("1 2 3 4 5 6 7 8 9 10", [](ChatHandler*, std::vector<uint8> v)
|
||||
TestChatCommand("0.5", [](ChatHandler*, float f)
|
||||
{
|
||||
REQUIRE(v.size() == 10);
|
||||
for (size_t i = 0; i < 10; ++i)
|
||||
REQUIRE(v[i] == (i + 1));
|
||||
REQUIRE(f == 0.5);
|
||||
return true;
|
||||
});
|
||||
TestChatCommand("true", [](ChatHandler*, float) { return true; }, false);
|
||||
}
|
||||
|
||||
SECTION("std::vector<uint16>")
|
||||
{
|
||||
TestChatCommand("1 2 3 4 5 6 7 8 9 10", [](ChatHandler*, std::vector<uint16> v)
|
||||
{
|
||||
REQUIRE(v == std::vector<uint16>{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
SECTION("std::array<uint16>")
|
||||
{
|
||||
TestChatCommand("1 2 3 4 5 6 7 8 9 10", [](ChatHandler*, std::array<uint16, 10> v)
|
||||
{
|
||||
REQUIRE(v == std::array<uint16, 10>{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user