[llvm] r183028 - [APFloat] Added a unittest for APFloat::getZero.
Rafael EspĂndola
rafael.espindola at gmail.com
Sat Jun 1 14:37:05 PDT 2013
looks like an arm buildbot is not happy with this:
http://lab.llvm.org:8011/builders/llvm-armv5-linux/builds/352/steps/compile/logs/stdio
Xerxes, what is the host compiler. It looks like it thinks "long long"
is the same thing as "long" :-(
On 31 May 2013 14:43, Michael Gottesman <mgottesman at apple.com> wrote:
> Author: mgottesman
> Date: Fri May 31 13:43:34 2013
> New Revision: 183028
>
> URL: http://llvm.org/viewvc/llvm-project?rev=183028&view=rev
> Log:
> [APFloat] Added a unittest for APFloat::getZero.
>
> Modified:
> llvm/trunk/unittests/ADT/APFloatTest.cpp
>
> Modified: llvm/trunk/unittests/ADT/APFloatTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/APFloatTest.cpp?rev=183028&r1=183027&r2=183028&view=diff
> ==============================================================================
> --- llvm/trunk/unittests/ADT/APFloatTest.cpp (original)
> +++ llvm/trunk/unittests/ADT/APFloatTest.cpp Fri May 31 13:43:34 2013
> @@ -1274,6 +1274,43 @@ TEST(APFloatTest, getSmallestNormalized)
> EXPECT_TRUE(test.bitwiseIsEqual(expected));
> }
>
> +TEST(APFloatTest, getZero) {
> + struct {
> + const fltSemantics *semantics;
> + const bool sign;
> + const unsigned long long bitPattern[2];
> + const unsigned bitPatternLength;
> + } GetZeroTest[] = {
> + { &APFloat::IEEEhalf, false, {0, 0}, 1},
> + { &APFloat::IEEEhalf, true, {0x8000, 0}, 1},
> + { &APFloat::IEEEsingle, false, {0, 0}, 1},
> + { &APFloat::IEEEsingle, true, {0x80000000, 0}, 1},
> + { &APFloat::IEEEdouble, false, {0, 0}, 1},
> + { &APFloat::IEEEdouble, true, {0x8000000000000000, 0}, 1},
> + { &APFloat::IEEEquad, false, {0, 0}, 2},
> + { &APFloat::IEEEquad, true, {0, 0x8000000000000000}, 2},
> + { &APFloat::PPCDoubleDouble, false, {0, 0}, 2},
> + { &APFloat::PPCDoubleDouble, true, {0x8000000000000000, 0}, 2},
> + { &APFloat::x87DoubleExtended, false, {0, 0}, 2},
> + { &APFloat::x87DoubleExtended, true, {0, 0x8000}, 2},
> + };
> + const unsigned NumGetZeroTests = 12;
> + for (unsigned i = 0; i < NumGetZeroTests; ++i) {
> + APFloat test = APFloat::getZero(*GetZeroTest[i].semantics,
> + GetZeroTest[i].sign);
> + const char *pattern = GetZeroTest[i].sign? "-0x0p+0" : "0x0p+0";
> + APFloat expected = APFloat(*GetZeroTest[i].semantics,
> + pattern);
> + EXPECT_TRUE(test.isZero());
> + EXPECT_TRUE(GetZeroTest[i].sign? test.isNegative() : !test.isNegative());
> + EXPECT_TRUE(test.bitwiseIsEqual(expected));
> + for (unsigned j = 0, je = GetZeroTest[i].bitPatternLength; j < je; ++j) {
> + EXPECT_EQ(GetZeroTest[i].bitPattern[j],
> + test.bitcastToAPInt().getRawData()[j]);
> + }
> + }
> +}
> +
> TEST(APFloatTest, convert) {
> bool losesInfo;
> APFloat test(APFloat::IEEEdouble, "1.0");
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list