From 5120aa69839151b2521cbde3058fd3de8ae168c9 Mon Sep 17 00:00:00 2001 From: jmd Date: Sun, 13 Oct 2024 16:54:04 -0700 Subject: [PATCH] [tests] add: intern empty string test add: twoda cache wrong restype test --- tests/kernel_strings.cpp | 8 ++++++++ tests/kernel_twoda_cache.cpp | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/kernel_strings.cpp b/tests/kernel_strings.cpp index 6e7159e21..132daa8da 100644 --- a/tests/kernel_strings.cpp +++ b/tests/kernel_strings.cpp @@ -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"); } diff --git a/tests/kernel_twoda_cache.cpp b/tests/kernel_twoda_cache.cpp index 8221f80fe..c1d4148ee 100644 --- a/tests/kernel_twoda_cache.cpp +++ b/tests/kernel_twoda_cache.cpp @@ -3,6 +3,7 @@ #include #include +using namespace std::literals; namespace nwk = nw::kernel; TEST(Kernel2daCache, Get) @@ -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(); }