mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 17:31:58 -05:00
AK: Make IsUnsigned<T> behave as you would expect
This commit is contained in:
parent
8743ea3149
commit
497d48a8de
2 changed files with 11 additions and 1 deletions
|
@ -533,7 +533,7 @@ template<typename... _Ignored>
|
|||
constexpr auto DependentFalse = false;
|
||||
|
||||
template<typename T>
|
||||
using IsUnsigned = IsSame<T, MakeUnsigned<T>>;
|
||||
using IsUnsigned = IsSame<T, typename MakeUnsigned<T>::Type>;
|
||||
|
||||
template<typename T>
|
||||
using IsArithmetic = IntegralConstant<bool, IsIntegral<T>::value || IsFloatingPoint<T>::value>;
|
||||
|
@ -620,6 +620,7 @@ using AK::IsFundamental;
|
|||
using AK::IsNullPointer;
|
||||
using AK::IsSame;
|
||||
using AK::IsUnion;
|
||||
using AK::IsUnsigned;
|
||||
using AK::IsVoid;
|
||||
using AK::MakeIndexSequence;
|
||||
using AK::MakeIntegerSequence;
|
||||
|
|
|
@ -80,6 +80,15 @@ TEST_CASE(FundamentalTypeClassification)
|
|||
EXPECT_TRAIT_TRUE(IsFundamental, unsigned short, unsigned int, unsigned long, unsigned long long);
|
||||
|
||||
EXPECT_TRAIT_FALSE(IsFundamental, Empty, int*, int&);
|
||||
|
||||
EXPECT_TRAIT_TRUE(IsUnsigned, unsigned);
|
||||
EXPECT_TRAIT_TRUE(IsUnsigned, unsigned short);
|
||||
EXPECT_TRAIT_TRUE(IsUnsigned, unsigned char);
|
||||
EXPECT_TRAIT_TRUE(IsUnsigned, unsigned long);
|
||||
EXPECT_TRAIT_FALSE(IsUnsigned, int);
|
||||
EXPECT_TRAIT_FALSE(IsUnsigned, short);
|
||||
EXPECT_TRAIT_FALSE(IsUnsigned, char);
|
||||
EXPECT_TRAIT_FALSE(IsUnsigned, long);
|
||||
}
|
||||
|
||||
TEST_CASE(AddConst)
|
||||
|
|
Loading…
Reference in a new issue