diff --git a/libc/utils/CPP/TypeTraits.h b/libc/utils/CPP/TypeTraits.h --- a/libc/utils/CPP/TypeTraits.h +++ b/libc/utils/CPP/TypeTraits.h @@ -37,9 +37,6 @@ template <> struct IsIntegral : public TrueValue {}; template <> struct IsIntegral : public TrueValue {}; -template struct IsIntegralNotBool : public IsIntegral {}; -template <> struct IsIntegralNotBool : public FalseValue {}; - template struct IsPointerType : public FalseValue {}; template struct IsPointerType : public TrueValue {}; diff --git a/libc/utils/UnitTest/Test.h b/libc/utils/UnitTest/Test.h --- a/libc/utils/UnitTest/Test.h +++ b/libc/utils/UnitTest/Test.h @@ -63,9 +63,8 @@ // is the result of the |Cond| operation on |LHS| and |RHS|. Though not bad, // |Cond| on mismatched |LHS| and |RHS| types can potentially succeed because // of type promotion. - template < - typename ValType, - cpp::EnableIfType::Value, ValType> = 0> + template ::Value, ValType> = 0> static bool test(RunContext &Ctx, TestCondition Cond, ValType LHS, ValType RHS, const char *LHSStr, const char *RHSStr, const char *File, unsigned long Line) { @@ -176,3 +175,19 @@ #define ASSERT_STRNE(LHS, RHS) \ if (!EXPECT_STRNE(LHS, RHS)) \ return + +#define EXPECT_TRUE(VAL) \ + __llvm_libc::testing::Test::test(Ctx, __llvm_libc::testing::Cond_EQ, (VAL), \ + true, #VAL, "true", __FILE__, __LINE__) + +#define ASSERT_TRUE(VAL) \ + if (!EXPECT_TRUE(VAL)) \ + return + +#define EXPECT_FALSE(VAL) \ + __llvm_libc::testing::Test::test(Ctx, __llvm_libc::testing::Cond_EQ, (VAL), \ + false, #VAL, "false", __FILE__, __LINE__) + +#define ASSERT_FALSE(VAL) \ + if (!EXPECT_FALSE(VAL)) \ + return diff --git a/libc/utils/UnitTest/Test.cpp b/libc/utils/UnitTest/Test.cpp --- a/libc/utils/UnitTest/Test.cpp +++ b/libc/utils/UnitTest/Test.cpp @@ -204,6 +204,11 @@ const char *RHSStr, const char *File, unsigned long Line); +template bool Test::test(RunContext &Ctx, TestCondition Cond, bool LHS, + bool RHS, const char *LHSStr, + const char *RHSStr, const char *File, + unsigned long Line); + template bool Test::test( RunContext &Ctx, TestCondition Cond, unsigned long long LHS, unsigned long long RHS, const char *LHSStr, const char *RHSStr,