mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-15 15:48:38 +00:00
Added a unittest for APFloat::getSmallestNormalized.
llvm-svn: 182897
This commit is contained in:
parent
09f3ab01b8
commit
bff1b48095
@ -824,6 +824,36 @@ TEST(APFloatTest, getSmallest) {
|
|||||||
EXPECT_TRUE(test.bitwiseIsEqual(expected));
|
EXPECT_TRUE(test.bitwiseIsEqual(expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(APFloatTest, getSmallestNormalized) {
|
||||||
|
APFloat test = APFloat::getSmallestNormalized(APFloat::IEEEsingle, false);
|
||||||
|
APFloat expected = APFloat(APFloat::IEEEsingle, "0x1p-126");
|
||||||
|
EXPECT_FALSE(test.isNegative());
|
||||||
|
EXPECT_TRUE(test.isNormal());
|
||||||
|
EXPECT_FALSE(test.isDenormal());
|
||||||
|
EXPECT_TRUE(test.bitwiseIsEqual(expected));
|
||||||
|
|
||||||
|
test = APFloat::getSmallestNormalized(APFloat::IEEEsingle, true);
|
||||||
|
expected = APFloat(APFloat::IEEEsingle, "-0x1p-126");
|
||||||
|
EXPECT_TRUE(test.isNegative());
|
||||||
|
EXPECT_TRUE(test.isNormal());
|
||||||
|
EXPECT_FALSE(test.isDenormal());
|
||||||
|
EXPECT_TRUE(test.bitwiseIsEqual(expected));
|
||||||
|
|
||||||
|
test = APFloat::getSmallestNormalized(APFloat::IEEEquad, false);
|
||||||
|
expected = APFloat(APFloat::IEEEquad, "0x1p-16382");
|
||||||
|
EXPECT_FALSE(test.isNegative());
|
||||||
|
EXPECT_TRUE(test.isNormal());
|
||||||
|
EXPECT_FALSE(test.isDenormal());
|
||||||
|
EXPECT_TRUE(test.bitwiseIsEqual(expected));
|
||||||
|
|
||||||
|
test = APFloat::getSmallestNormalized(APFloat::IEEEquad, true);
|
||||||
|
expected = APFloat(APFloat::IEEEquad, "-0x1p-16382");
|
||||||
|
EXPECT_TRUE(test.isNegative());
|
||||||
|
EXPECT_TRUE(test.isNormal());
|
||||||
|
EXPECT_FALSE(test.isDenormal());
|
||||||
|
EXPECT_TRUE(test.bitwiseIsEqual(expected));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(APFloatTest, convert) {
|
TEST(APFloatTest, convert) {
|
||||||
bool losesInfo;
|
bool losesInfo;
|
||||||
APFloat test(APFloat::IEEEdouble, "1.0");
|
APFloat test(APFloat::IEEEdouble, "1.0");
|
||||||
|
Loading…
Reference in New Issue
Block a user