MCPcopy Create free account
hub / github.com/baidu/babylon / TEST

Function TEST

test/test_string_view.cpp:36–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34#endif
35
36TEST(string_view, construct_as_constexpr) {
37 {
38 constexpr StringView view {};
39 ASSERT_TRUE(view.empty());
40 }
41 {
42 constexpr StringView view = "10086";
43 ASSERT_EQ(5, view.size());
44 }
45 {
46 constexpr StringView view("10086");
47 ASSERT_EQ(5, view.size());
48 }
49 {
50 constexpr StringView view("10086", 4);
51 ASSERT_EQ(4, view.length());
52 }
53 {
54 constexpr StringView view("10086", 4);
55 constexpr StringView same_view(view);
56 ASSERT_EQ(4, same_view.length());
57 }
58#if __cplusplus >= 201402L
59 {
60 constexpr StringView view("10086", 4);
61 constexpr StringView same_view = use_assing_operator_in_constexpr(view);
62 ASSERT_EQ(4, same_view.length());
63 }
64#endif // __cplusplus
65}
66
67TEST(string_view, get_char_as_constexpr) {
68 constexpr StringView view = "10086";

Callers

nothing calls this directly

Calls 15

use_swap_in_constexprFunction · 0.85
StringViewFunction · 0.85
get_std_string_view_sizeFunction · 0.85
lengthMethod · 0.80
atMethod · 0.80
remove_prefixMethod · 0.80

Tested by

no test coverage detected