make Range::size() constexpr
[folly.git] / folly / test / RangeTest.cpp
index 8c98ee48151ced68b49439a774268b362c711f64..294659c90d621ad7e5775cf5f459164b1e55aff8 100644 (file)
@@ -298,9 +298,11 @@ constexpr char helloArray[] = "hello";
 TEST(StringPiece, Constexpr) {
   constexpr StringPiece hello1("hello");
   EXPECT_EQ("hello", hello1);
 TEST(StringPiece, Constexpr) {
   constexpr StringPiece hello1("hello");
   EXPECT_EQ("hello", hello1);
+  static_assert(hello1.size() == 5, "hello size should be 5 at compile time");
 
   constexpr StringPiece hello2(helloArray);
   EXPECT_EQ("hello", hello2);
 
   constexpr StringPiece hello2(helloArray);
   EXPECT_EQ("hello", hello2);
+  static_assert(hello2.size() == 5, "hello size should be 5 at compile time");
 }
 
 TEST(StringPiece, Prefix) {
 }
 
 TEST(StringPiece, Prefix) {