Codemod: use #include angle brackets in folly and thrift
[folly.git] / folly / test / TraitsTest.cpp
index 7a80c6cc7041d17cff799c0641be0d5b4221c64e..129ad83ddb006d1cd3d5c36bb50439e090d1f14f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013 Facebook, Inc.
+ * Copyright 2014 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#include "folly/Benchmark.h"
-#include "folly/Traits.h"
+#include <folly/Benchmark.h>
+#include <folly/Traits.h>
 
 #include <gflags/gflags.h>
 #include <gtest/gtest.h>
@@ -50,7 +50,6 @@ TEST(Traits, containers) {
   EXPECT_TRUE  (IsRelocatable<vector<F1>>::value);
   EXPECT_FALSE((IsRelocatable<pair<F1, F1>>::value));
   EXPECT_TRUE ((IsRelocatable<pair<T1, T2>>::value));
-  EXPECT_TRUE  (IsRelocatable<set<F1>>::value);
 }
 
 TEST(Traits, original) {
@@ -96,6 +95,21 @@ TEST(Traits, is_negative) {
   EXPECT_FALSE(folly::is_non_positive(1u));
 }
 
+TEST(Traits, relational) {
+  // We test, especially, the edge cases to make sure we don't
+  // trip -Wtautological-comparisons
+
+  EXPECT_FALSE((folly::less_than<uint8_t, 0u,   uint8_t>(0u)));
+  EXPECT_FALSE((folly::less_than<uint8_t, 0u,   uint8_t>(254u)));
+  EXPECT_FALSE((folly::less_than<uint8_t, 255u, uint8_t>(255u)));
+  EXPECT_TRUE( (folly::less_than<uint8_t, 255u, uint8_t>(254u)));
+
+  EXPECT_FALSE((folly::greater_than<uint8_t, 0u,   uint8_t>(0u)));
+  EXPECT_TRUE( (folly::greater_than<uint8_t, 0u,   uint8_t>(254u)));
+  EXPECT_FALSE((folly::greater_than<uint8_t, 255u, uint8_t>(255u)));
+  EXPECT_FALSE((folly::greater_than<uint8_t, 255u, uint8_t>(254u)));
+}
+
 struct CompleteType {};
 struct IncompleteType;
 TEST(Traits, is_complete) {