mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 06:00:28 +00:00
Unit tests for the getSwappedBytes(double) fix from r237673.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237795 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cc3dffb519
commit
5a2d715235
@ -125,6 +125,19 @@ TEST(getSwappedBytes, int64_t) {
|
||||
sys::getSwappedBytes(int64_t(0x8877665544332211LL)));
|
||||
}
|
||||
|
||||
TEST(getSwappedBytes, float) {
|
||||
EXPECT_EQ(1.79366203433576585078237386661e-43f, sys::getSwappedBytes(-0.0f));
|
||||
// 0x11223344
|
||||
EXPECT_EQ(7.1653228759765625e2f, sys::getSwappedBytes(1.2795344e-28f));
|
||||
}
|
||||
|
||||
TEST(getSwappedBytes, double) {
|
||||
EXPECT_EQ(6.32404026676795576546008054871e-322, sys::getSwappedBytes(-0.0));
|
||||
// 0x1122334455667788
|
||||
EXPECT_EQ(-7.08687663657301358331704585496e-268,
|
||||
sys::getSwappedBytes(3.84141202447173065923064450234e-226));
|
||||
}
|
||||
|
||||
TEST(swapByteOrder, uint8_t) {
|
||||
uint8_t value = 0x11;
|
||||
sys::swapByteOrder(value);
|
||||
@ -173,4 +186,16 @@ TEST(swapByteOrder, int64_t) {
|
||||
EXPECT_EQ(int64_t(0x1122334455667788LL), value);
|
||||
}
|
||||
|
||||
TEST(swapByteOrder, float) {
|
||||
float value = 7.1653228759765625e2f; // 0x44332211
|
||||
sys::swapByteOrder(value);
|
||||
EXPECT_EQ(1.2795344e-28f, value);
|
||||
}
|
||||
|
||||
TEST(swapByteOrder, double) {
|
||||
double value = -7.08687663657301358331704585496e-268; // 0x8877665544332211
|
||||
sys::swapByteOrder(value);
|
||||
EXPECT_EQ(3.84141202447173065923064450234e-226, value);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user