Skip to content

Commit

Permalink
[tests] add: intern empty string test
Browse files Browse the repository at this point in the history
add: twoda cache wrong restype test
  • Loading branch information
jd28 committed Oct 13, 2024
1 parent 06f63f1 commit 5120aa6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tests/kernel_strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ TEST(KernelStrings, Intern)

auto str3 = nw::kernel::strings().get_interned("This is a Test");
EXPECT_TRUE(str3);
EXPECT_EQ(str3, str);

auto str4 = nw::kernel::strings().intern("");
EXPECT_FALSE(str4);

auto str5 = nw::kernel::strings().intern(0);
EXPECT_TRUE(str5);
EXPECT_EQ(str5.view(), "Bad Strref");
}
5 changes: 4 additions & 1 deletion tests/kernel_twoda_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <nw/kernel/Kernel.hpp>
#include <nw/kernel/TwoDACache.hpp>

using namespace std::literals;
namespace nwk = nw::kernel;

TEST(Kernel2daCache, Get)
Expand All @@ -15,7 +16,9 @@ TEST(Kernel2daCache, Get)
auto s2 = nwk::twodas().get("placeables");
EXPECT_EQ(s1, s2);
auto s3 = nwk::twodas().get("dontexist");
EXPECT_TRUE(!s3);
EXPECT_FALSE(s3);
auto s4 = nwk::twodas().get(nw::Resource{"test"sv, nw::ResourceType::png});
EXPECT_FALSE(s4);

nwk::unload_module();
}

0 comments on commit 5120aa6

Please sign in to comment.