feat(string): add SStrDupA

This commit is contained in:
fallenoak 2020-11-15 13:09:14 -06:00
parent d3f3c10aa5
commit 399e3f02d6
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
3 changed files with 25 additions and 0 deletions

View file

@ -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");