-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathuri.cpp
More file actions
29 lines (23 loc) · 1.05 KB
/
uri.cpp
File metadata and controls
29 lines (23 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <gtest/gtest.h>
#include "codspeed.h"
// Manual definition (to avoid including it in the public header):
std::string extract_namespace_clang(const std::string& func_str);
std::string extract_namespace_gcc(const std::string& func_str);
TEST(UriTest, TestExtractNamespaceClang) {
EXPECT_EQ(extract_namespace_clang("auto outer::test12::(anonymous class)::operator()() const"), "outer::test12::");
EXPECT_EQ(extract_namespace_clang("auto outer::(anonymous namespace)::test12::(anonymous class)::operator()() const"), "outer::(anonymous namespace)::test12::");
}
TEST(UriTest, TestExtractNamespaceGcc) {
EXPECT_EQ(extract_namespace_gcc("outer::test12::<lambda()>"), "outer::test12::");
EXPECT_EQ(extract_namespace_gcc("outer::(anonymous namespace)::test12::<lambda()>"), "outer::(anonymous namespace)::test12::");
}
namespace a {
namespace b {
namespace c {
static std::string pretty_func = ([]() { return __PRETTY_FUNCTION__; })();
TEST(UriTest, TestExtractNamespace) {
EXPECT_EQ(extract_lambda_namespace(pretty_func), "a::b::c::");
}
}
}
}