/*
- * 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.
* 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>
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) {
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) {