mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
fix(string): avoid undefined behavior in SStrToFloat
This commit is contained in:
parent
bbd07f7706
commit
08a8a33518
2 changed files with 7 additions and 3 deletions
|
|
@ -353,6 +353,12 @@ TEST_CASE("SStrToFloat", "[string]") {
|
|||
auto result = SStrToFloat(string);
|
||||
REQUIRE(result == 1.0f);
|
||||
}
|
||||
|
||||
SECTION("converts string without causing UBsan exception") {
|
||||
auto string = "0.82";
|
||||
auto result = SStrToFloat(string);
|
||||
REQUIRE(result == 0.82f);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("SStrToInt", "[string]") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue