Skip to content

Commit ccaf524

Browse files
committed
Add unit tests for GetNamespace function to verify namespace extraction behavior
1 parent 3f7caa7 commit ccaf524

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

modules/core/util/tests/util.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,24 @@ TEST(util_tests, threads_control_check_openmp_disabled_valgrind) {
2525
// Check Result
2626
ASSERT_EQ(ppc_num_threads, omp_num_threads);
2727
}
28+
29+
namespace test_ns {
30+
struct TypeInNamespace {};
31+
} // namespace test_ns
32+
33+
struct PlainType {};
34+
35+
TEST(GetNamespaceTest, ReturnsExpectedNamespace) {
36+
constexpr auto kNs = ppc::util::GetNamespace<test_ns::TypeInNamespace>();
37+
EXPECT_EQ(kNs, "test_ns");
38+
}
39+
40+
TEST(GetNamespaceTest, ReturnsEmptyIfNoNamespace_PrimitiveType) {
41+
constexpr auto kNs = ppc::util::GetNamespace<int>();
42+
EXPECT_EQ(kNs, "");
43+
}
44+
45+
TEST(GetNamespaceTest, ReturnsEmptyIfNoNamespace_PlainStruct) {
46+
constexpr auto kNs = ppc::util::GetNamespace<PlainType>();
47+
EXPECT_EQ(kNs, "");
48+
}

0 commit comments

Comments
 (0)