Consistently have the namespace closing comment
[folly.git] / folly / portability / test / ConstexprTest.cpp
index 1bf74382cdc1623fcff246495bdfe602a342bf39..b2bc97362062c6a782ead92d3ff5c3d64e3e864b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #include <folly/portability/Constexpr.h>
 
-#include <gtest/gtest.h>
+#include <folly/portability/GTest.h>
 
 namespace {
 
 class ConstexprTest : public testing::Test {};
-}
-
-TEST_F(ConstexprTest, constexpr_abs_unsigned) {
-  constexpr auto v = uint32_t(17);
-  constexpr auto a = folly::constexpr_abs(v);
-  EXPECT_EQ(17, a);
-  EXPECT_TRUE((std::is_same<const uint32_t, decltype(a)>::value));
-}
-
-TEST_F(ConstexprTest, constexpr_abs_signed_positive) {
-  constexpr auto v = int32_t(17);
-  constexpr auto a = folly::constexpr_abs(v);
-  EXPECT_EQ(17, a);
-  EXPECT_TRUE((std::is_same<const uint32_t, decltype(a)>::value));
-}
-
-TEST_F(ConstexprTest, constexpr_abs_signed_negative) {
-  constexpr auto v = int32_t(-17);
-  constexpr auto a = folly::constexpr_abs(v);
-  EXPECT_EQ(17, a);
-  EXPECT_TRUE((std::is_same<const uint32_t, decltype(a)>::value));
-}
-
-TEST_F(ConstexprTest, constexpr_abs_float_positive) {
-  constexpr auto v = 17.5f;
-  constexpr auto a = folly::constexpr_abs(v);
-  EXPECT_EQ(17.5, a);
-  EXPECT_TRUE((std::is_same<const float, decltype(a)>::value));
-}
-
-TEST_F(ConstexprTest, constexpr_abs_float_negative) {
-  constexpr auto v = -17.5f;
-  constexpr auto a = folly::constexpr_abs(v);
-  EXPECT_EQ(17.5, a);
-  EXPECT_TRUE((std::is_same<const float, decltype(a)>::value));
-}
+} // namespace
 
-TEST_F(ConstexprTest, constexpr_abs_double_positive) {
-  constexpr auto v = 17.5;
-  constexpr auto a = folly::constexpr_abs(v);
-  EXPECT_EQ(17.5, a);
-  EXPECT_TRUE((std::is_same<const double, decltype(a)>::value));
+TEST_F(ConstexprTest, constexpr_strlen_cstr) {
+  constexpr auto v = "hello";
+  constexpr auto a = folly::constexpr_strlen(v);
+  EXPECT_EQ(5, a);
+  EXPECT_TRUE((std::is_same<const size_t, decltype(a)>::value));
 }
 
-TEST_F(ConstexprTest, constexpr_abs_double_negative) {
-  constexpr auto v = -17.5;
-  constexpr auto a = folly::constexpr_abs(v);
-  EXPECT_EQ(17.5, a);
-  EXPECT_TRUE((std::is_same<const double, decltype(a)>::value));
+TEST_F(ConstexprTest, constexpr_strlen_ints) {
+  constexpr int v[] = {5, 3, 4, 0, 7};
+  constexpr auto a = folly::constexpr_strlen(v);
+  EXPECT_EQ(3, a);
+  EXPECT_TRUE((std::is_same<const size_t, decltype(a)>::value));
 }