Lua exception handling test
[folly.git] / folly / test / MathTest.cpp
index a3023edc60d1fad52133e12b7c4eb6276df682a7..dba0d35c6ef1375df42f0d4af5a2e480829701db 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.
@@ -22,9 +22,9 @@
 #include <vector>
 
 #include <glog/logging.h>
-#include <gtest/gtest.h>
 
 #include <folly/Portability.h>
+#include <folly/portability/GTest.h>
 
 using namespace folly;
 using namespace folly::detail;
@@ -106,14 +106,14 @@ std::vector<T> cornerValues() {
   std::vector<T> rv;
   for (T i = 1; i < 24; ++i) {
     rv.push_back(i);
-    rv.push_back(std::numeric_limits<T>::max() / i);
-    rv.push_back(std::numeric_limits<T>::max() - i);
-    rv.push_back(std::numeric_limits<T>::max() / 2 - i);
+    rv.push_back(T(std::numeric_limits<T>::max() / i));
+    rv.push_back(T(std::numeric_limits<T>::max() - i));
+    rv.push_back(T(std::numeric_limits<T>::max() / T(2) - i));
     if (std::is_signed<T>::value) {
       rv.push_back(-i);
-      rv.push_back(std::numeric_limits<T>::min() / i);
-      rv.push_back(std::numeric_limits<T>::min() + i);
-      rv.push_back(std::numeric_limits<T>::min() / 2 + i);
+      rv.push_back(T(std::numeric_limits<T>::min() / i));
+      rv.push_back(T(std::numeric_limits<T>::min() + i));
+      rv.push_back(T(std::numeric_limits<T>::min() / T(2) + i));
     }
   }
   return rv;
@@ -155,7 +155,7 @@ TEST(Bits, divTestInt8) {
   runDivTests<int8_t, uint16_t, int64_t>();
   runDivTests<int8_t, int32_t, int64_t>();
   runDivTests<int8_t, uint32_t, int64_t>();
-#ifdef FOLLY_HAVE_INT128_T
+#if FOLLY_HAVE_INT128_T
   runDivTests<int8_t, int64_t, __int128>();
   runDivTests<int8_t, uint64_t, __int128>();
 #endif
@@ -167,7 +167,7 @@ TEST(Bits, divTestInt16) {
   runDivTests<int16_t, uint16_t, int64_t>();
   runDivTests<int16_t, int32_t, int64_t>();
   runDivTests<int16_t, uint32_t, int64_t>();
-#ifdef FOLLY_HAVE_INT128_T
+#if FOLLY_HAVE_INT128_T
   runDivTests<int16_t, int64_t, __int128>();
   runDivTests<int16_t, uint64_t, __int128>();
 #endif
@@ -179,12 +179,12 @@ TEST(Bits, divTestInt32) {
   runDivTests<int32_t, uint16_t, int64_t>();
   runDivTests<int32_t, int32_t, int64_t>();
   runDivTests<int32_t, uint32_t, int64_t>();
-#ifdef FOLLY_HAVE_INT128_T
+#if FOLLY_HAVE_INT128_T
   runDivTests<int32_t, int64_t, __int128>();
   runDivTests<int32_t, uint64_t, __int128>();
 #endif
 }
-#ifdef FOLLY_HAVE_INT128_T
+#if FOLLY_HAVE_INT128_T
 TEST(Bits, divTestInt64) {
   runDivTests<int64_t, int8_t, __int128>();
   runDivTests<int64_t, uint8_t, __int128>();
@@ -203,7 +203,7 @@ TEST(Bits, divTestUint8) {
   runDivTests<uint8_t, uint16_t, int64_t>();
   runDivTests<uint8_t, int32_t, int64_t>();
   runDivTests<uint8_t, uint32_t, int64_t>();
-#ifdef FOLLY_HAVE_INT128_T
+#if FOLLY_HAVE_INT128_T
   runDivTests<uint8_t, int64_t, __int128>();
   runDivTests<uint8_t, uint64_t, __int128>();
 #endif
@@ -215,7 +215,7 @@ TEST(Bits, divTestUint16) {
   runDivTests<uint16_t, uint16_t, int64_t>();
   runDivTests<uint16_t, int32_t, int64_t>();
   runDivTests<uint16_t, uint32_t, int64_t>();
-#ifdef FOLLY_HAVE_INT128_T
+#if FOLLY_HAVE_INT128_T
   runDivTests<uint16_t, int64_t, __int128>();
   runDivTests<uint16_t, uint64_t, __int128>();
 #endif
@@ -227,12 +227,12 @@ TEST(Bits, divTestUint32) {
   runDivTests<uint32_t, uint16_t, int64_t>();
   runDivTests<uint32_t, int32_t, int64_t>();
   runDivTests<uint32_t, uint32_t, int64_t>();
-#ifdef FOLLY_HAVE_INT128_T
+#if FOLLY_HAVE_INT128_T
   runDivTests<uint32_t, int64_t, __int128>();
   runDivTests<uint32_t, uint64_t, __int128>();
 #endif
 }
-#ifdef FOLLY_HAVE_INT128_T
+#if FOLLY_HAVE_INT128_T
 TEST(Bits, divTestUint64) {
   runDivTests<uint64_t, int8_t, __int128>();
   runDivTests<uint64_t, uint8_t, __int128>();