summaryrefslogtreecommitdiff
path: root/src/common/strings_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/strings_test.cpp')
-rw-r--r--src/common/strings_test.cpp47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/common/strings_test.cpp b/src/common/strings_test.cpp
index e83d283..b6a6f67 100644
--- a/src/common/strings_test.cpp
+++ b/src/common/strings_test.cpp
@@ -17,6 +17,9 @@ TYPED_TEST_P(StringTest, basic)
EXPECT_EQ(hi, hi2);
TypeParam hi0;
EXPECT_EQ(0, hi0.size());
+
+ __attribute__((unused))
+ const FString *base = hi.base();
}
TYPED_TEST_P(StringTest, iterators)
@@ -53,8 +56,50 @@ TYPED_TEST_P(StringTest, oslice)
EXPECT_EQ("World", hi.opslice(7, 12));
}
+TYPED_TEST_P(StringTest, convert)
+{
+ constexpr bool is_zstring = std::is_same<TypeParam, ZString>::value;
+ typedef typename std::conditional<is_zstring, TString, SString>::type Sstring;
+ typedef typename std::conditional<is_zstring, ZString, XString>::type Xstring;
+ FString f = "f";
+ TString t = "t";
+ Sstring s = "s";
+ ZString z = "z";
+ Xstring x = "x";
+ VString<255> v = "v";
+
+ TypeParam f2 = f;
+ TypeParam t2 = t;
+ TypeParam s2 = s;
+ TypeParam z2 = z;
+ TypeParam x2 = x;
+ TypeParam v2 = v;
+
+ EXPECT_EQ(f2, f);
+ EXPECT_EQ(t2, t);
+ EXPECT_EQ(s2, s);
+ EXPECT_EQ(z2, z);
+ EXPECT_EQ(x2, x);
+ EXPECT_EQ(v2, v);
+
+ TypeParam f3, t3, s3, z3, x3, v3;
+ f3 = f;
+ t3 = t;
+ s3 = s;
+ z3 = z;
+ x3 = x;
+ v3 = v;
+
+ EXPECT_EQ(f3, f);
+ EXPECT_EQ(t3, t);
+ EXPECT_EQ(s3, s);
+ EXPECT_EQ(z3, z);
+ EXPECT_EQ(x3, x);
+ EXPECT_EQ(v3, v);
+}
+
REGISTER_TYPED_TEST_CASE_P(StringTest,
- basic, iterators, xslice, oslice);
+ basic, iterators, xslice, oslice, convert);
typedef ::testing::Types<
FString, TString, SString, ZString, XString, VString<255>