11#include < gtest/gtest.h>
22
3+ #include < string>
4+
35#include " util/include/util.hpp"
46
57// This file tests edge cases that might cause demangling failures
68// or other uncovered branches in GetNamespace
79
810// Test with an extern "C" function type that might have special handling
911extern " C" {
10- typedef void (*CFunction )();
12+ using CFunction = void (*)();
1113}
1214
1315TEST (GetNamespaceEdgeCases, GetNamespace_WithExternCFunction_HandlesCorrectly) {
@@ -25,21 +27,35 @@ TEST(GetNamespaceEdgeCases, GetNamespace_WithNoColonColon_ReturnsEmpty) {
2527 EXPECT_EQ (k_ns, " " );
2628}
2729
28- // Test with built-in types that might have special mangling
29- TEST (GetNamespaceEdgeCases, GetNamespace_WithBuiltinTypes_ReturnsEmpty ) {
30+ // Test with basic built-in types
31+ TEST (GetNamespaceEdgeCases, GetNamespace_WithBasicBuiltinTypes_ReturnsEmpty ) {
3032 EXPECT_EQ (ppc::util::GetNamespace<void >(), " " );
3133 EXPECT_EQ (ppc::util::GetNamespace<char >(), " " );
3234 EXPECT_EQ (ppc::util::GetNamespace<short >(), " " );
35+ EXPECT_EQ (ppc::util::GetNamespace<int >(), " " );
3336 EXPECT_EQ (ppc::util::GetNamespace<long >(), " " );
3437 EXPECT_EQ (ppc::util::GetNamespace<long long >(), " " );
38+ EXPECT_EQ (ppc::util::GetNamespace<bool >(), " " );
39+ }
40+
41+ // Test with unsigned built-in types
42+ TEST (GetNamespaceEdgeCases, GetNamespace_WithUnsignedBuiltinTypes_ReturnsEmpty) {
3543 EXPECT_EQ (ppc::util::GetNamespace<unsigned char >(), " " );
3644 EXPECT_EQ (ppc::util::GetNamespace<unsigned short >(), " " );
45+ EXPECT_EQ (ppc::util::GetNamespace<unsigned int >(), " " );
3746 EXPECT_EQ (ppc::util::GetNamespace<unsigned long >(), " " );
3847 EXPECT_EQ (ppc::util::GetNamespace<unsigned long long >(), " " );
48+ }
49+
50+ // Test with floating point types
51+ TEST (GetNamespaceEdgeCases, GetNamespace_WithFloatingPointTypes_ReturnsEmpty) {
3952 EXPECT_EQ (ppc::util::GetNamespace<float >(), " " );
4053 EXPECT_EQ (ppc::util::GetNamespace<double >(), " " );
4154 EXPECT_EQ (ppc::util::GetNamespace<long double >(), " " );
42- EXPECT_EQ (ppc::util::GetNamespace<bool >(), " " );
55+ }
56+
57+ // Test with character types
58+ TEST (GetNamespaceEdgeCases, GetNamespace_WithCharacterTypes_ReturnsEmpty) {
4359 EXPECT_EQ (ppc::util::GetNamespace<wchar_t >(), " " );
4460 EXPECT_EQ (ppc::util::GetNamespace<char16_t >(), " " );
4561 EXPECT_EQ (ppc::util::GetNamespace<char32_t >(), " " );
@@ -49,23 +65,9 @@ TEST(GetNamespaceEdgeCases, GetNamespace_WithBuiltinTypes_ReturnsEmpty) {
4965}
5066
5167// Test with very long namespace chain
52- namespace a {
53- namespace b {
54- namespace c {
55- namespace d {
56- namespace e {
57- namespace f {
58- namespace g {
59- namespace h {
68+ namespace a ::b::c::d::e::f::g::h {
6069struct DeepType {};
61- } // namespace h
62- } // namespace g
63- } // namespace f
64- } // namespace e
65- } // namespace d
66- } // namespace c
67- } // namespace b
68- } // namespace a
70+ } // namespace a::b::c::d::e::f::g::h
6971
7072TEST (GetNamespaceEdgeCases, GetNamespace_WithVeryDeepNamespace_ExtractsCorrectly) {
7173 std::string k_ns = ppc::util::GetNamespace<a::b::c::d::e::f::g::h::DeepType>();
0 commit comments