mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 02:22:30 +00:00
feat(string): add SStrDupA
This commit is contained in:
parent
d3f3c10aa5
commit
399e3f02d6
3 changed files with 25 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include "storm/String.hpp"
|
||||
#include "storm/Memory.hpp"
|
||||
#include "test/Test.hpp"
|
||||
|
||||
TEST_CASE("SStrCmp", "[string]") {
|
||||
|
|
@ -37,6 +38,19 @@ TEST_CASE("SStrCmpI", "[string]") {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE("SStrDupA", "[string]") {
|
||||
SECTION("duplicates string correctly") {
|
||||
auto string1 = "foo bar";
|
||||
auto string2 = SStrDupA(string1, __FILE__, __LINE__);
|
||||
auto compare = SStrCmp(string1, string2, STORM_MAX_STR);
|
||||
auto newPtr = string1 != string2;
|
||||
SMemFree(string2);
|
||||
|
||||
REQUIRE(compare == 0);
|
||||
REQUIRE(newPtr == true);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("SStrHashHT", "[string]") {
|
||||
SECTION("hashes simple string correctly") {
|
||||
auto hash = SStrHashHT("foo");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue