Skip to content

Commit 5b78342

Browse files
add new test file
Signed-off-by: Ujjwal Shekhar <ujjwal.shekhar@research.iiit.ac.in>
1 parent 0b11ddc commit 5b78342

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Copyright (c) 2026 Ujjwal Shekhar
2+
// SPDX-License-Identifier: BSL-1.0
3+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
4+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5+
6+
#include <hpx/config.hpp>
7+
#include <hpx/modules/serialization.hpp>
8+
#include <hpx/modules/testing.hpp>
9+
10+
#include <string>
11+
#include <vector>
12+
13+
namespace empty_space {
14+
template <typename... Args>
15+
struct void_void {};
16+
}
17+
18+
namespace a::b::c::d {
19+
template <typename T1, typename T2, typename T3, typename T4, typename T5>
20+
struct pentagon {};
21+
}
22+
23+
namespace world {
24+
namespace continent {
25+
namespace country {
26+
template <typename T>
27+
struct city {};
28+
}
29+
}
30+
}
31+
32+
namespace local {
33+
struct person {};
34+
}
35+
36+
int main()
37+
{
38+
using hpx::serialization::detail::qualified_name_of;
39+
40+
// Empty/Variadic Template Test
41+
{
42+
using type = empty_space::void_void<>;
43+
char const* name = qualified_name_of<type>::get();
44+
HPX_TEST(name != nullptr);
45+
HPX_TEST_EQ(std::string(name), std::string("empty_space::void_void<>"));
46+
}
47+
48+
// Deep Namespace + High Arity
49+
{
50+
using type = a::b::c::d::pentagon<int, char, double, float, long>;
51+
char const* name = qualified_name_of<type>::get();
52+
HPX_TEST_EQ(std::string(name),
53+
std::string("a::b::c::d::pentagon<int,char,double,float,long>"));
54+
}
55+
56+
// Deeply Nested Custom Types as Template Args
57+
{
58+
// City containing a Person from a different namespace
59+
using nested_type = world::continent::country::city<local::person>;
60+
61+
// Wrap that in ANOTHER layer
62+
using deeper_nested_type = world::continent::country::city<nested_type>;
63+
64+
char const* name = qualified_name_of<deeper_nested_type>::get();
65+
66+
// Expected: world::continent::country::city<world::continent::country::city<local::person>>
67+
std::string expected = "world::continent::country::city<"
68+
"world::continent::country::city<local::person>>";
69+
70+
HPX_TEST_EQ(std::string(name), expected);
71+
}
72+
73+
return hpx::util::report_errors();
74+
}

0 commit comments

Comments
 (0)