diff --git a/llvm/unittests/Support/ScopedPrinterTest.cpp b/llvm/unittests/Support/ScopedPrinterTest.cpp --- a/llvm/unittests/Support/ScopedPrinterTest.cpp +++ b/llvm/unittests/Support/ScopedPrinterTest.cpp @@ -567,17 +567,20 @@ W.printNumber("float-max", MaxFloat); W.printNumber("float-min", MinFloat); - W.printNumber("float-inf", InfFloat); - W.printNumber("float-nan", NaNFloat); W.printNumber("float-42.0", 42.0f); W.printNumber("float-42.5625", 42.5625f); W.printNumber("double-max", MaxDouble); W.printNumber("double-min", MinDouble); - W.printNumber("double-inf", InfDouble); - W.printNumber("double-nan", NaNDouble); W.printNumber("double-42.0", 42.0); W.printNumber("double-42.5625", 42.5625); + + // FIXME: temporarily disable checking the for Inf and NaN until we have a + // cross platform solution can handle this case + // W.printNumber("float-inf", InfFloat); + // W.printNumber("float-nan", NaNFloat); + // W.printNumber("double-inf", InfDouble); + // W.printNumber("double-nan", NaNDouble); }; // Make sure when we check floating point representation we avoid @@ -598,33 +601,35 @@ format("%5.1f", MaxDouble).snprint(Buf, sizeof(Buf)); std::string MaxDoubleStr(Buf); - format("%5.1f", InfFloat).snprint(Buf, sizeof(Buf)); - std::string InfFloatStr(Buf); - - format("%5.1f", InfDouble).snprint(Buf, sizeof(Buf)); - std::string InfDoubleStr(Buf); - - format("%5.1f", NaNFloat).snprint(Buf, sizeof(Buf)); - std::string NaNFloatStr(Buf); - - format("%5.1f", NaNDouble).snprint(Buf, sizeof(Buf)); - std::string NaNDoubleStr(Buf); - - format("%.*g", InfFloat).snprint(Buf, sizeof(Buf)); - std::string JsonInfFloatStr(Buf); - - format("%.*g", InfDouble).snprint(Buf, sizeof(Buf)); - std::string JsonInfDoubleStr(Buf); - - format("%.*g", NaNFloat).snprint(Buf, sizeof(Buf)); - std::string JsonNaNFloatStr(Buf); - - format("%.*g", NaNDouble).snprint(Buf, sizeof(Buf)); - std::string JsonNaNDoubleStr(Buf); - - - std::string ExpectedOut = Twine( - R"(uint64_t-max: 18446744073709551615 + // FIXME: temporarily disable checking the for Inf and NaN until we have a + // cross platform solution can handle this case + // format("%5.1f", InfFloat).snprint(Buf, sizeof(Buf)); + // std::string InfFloatStr(Buf); + // + // format("%5.1f", InfDouble).snprint(Buf, sizeof(Buf)); + // std::string InfDoubleStr(Buf); + // + // format("%5.1f", NaNFloat).snprint(Buf, sizeof(Buf)); + // std::string NaNFloatStr(Buf); + // + // format("%5.1f", NaNDouble).snprint(Buf, sizeof(Buf)); + // std::string NaNDoubleStr(Buf); + // + // format("%.*g", InfFloat).snprint(Buf, sizeof(Buf)); + // std::string JsonInfFloatStr(Buf); + // + // format("%.*g", InfDouble).snprint(Buf, sizeof(Buf)); + // std::string JsonInfDoubleStr(Buf); + // + // format("%.*g", NaNFloat).snprint(Buf, sizeof(Buf)); + // std::string JsonNaNFloatStr(Buf); + // + // format("%.*g", NaNDouble).snprint(Buf, sizeof(Buf)); + // std::string JsonNaNDoubleStr(Buf); + // + std::string ExpectedOut = + Twine( + R"(uint64_t-max: 18446744073709551615 uint64_t-min: 0 uint32_t-max: 4294967295 uint32_t-min: 0 @@ -642,23 +647,31 @@ int8_t-min: -128 apsint: 9999999999999999999999 label: value (0) -float-max: )" + MaxFloatStr + R"( +float-max: )" + + MaxFloatStr + R"( float-min: 0.0 -float-inf: )" + InfFloatStr + R"( -float-nan: )" + NaNFloatStr + R"( float-42.0: 42.0 float-42.5625: 42.6 -double-max: )" + MaxDoubleStr + - R"( +double-max: )" + + MaxDoubleStr + + R"( double-min: 0.0 -double-inf: )" + InfDoubleStr + R"( -double-nan: )" + NaNDoubleStr + R"( double-42.0: 42.0 double-42.5625: 42.6 -)") - .str(); - - std::string JSONExpectedOut = Twine(R"({ +)" + + // FIXME: temporarily disable checking the for Inf and NaN until we + // have a cross platform solution can handle this case + // + R"(float-inf: )" + InfFloatStr + + // R"( + // float-nan: )" + NaNFloatStr + R"( + // double-inf: )" + InfDoubleStr + R"( + // double-nan: )" + NaNDoubleStr + ) + .str(); + + std::string JSONExpectedOut = + Twine(R"({ "uint64_t-max": 18446744073709551615, "uint64_t-min": 0, "uint32_t-max": 4294967295, @@ -682,17 +695,22 @@ }, "float-max": 3.4028234663852886e+38, "float-min": 1.1754943508222875e-38, - "float-inf": )" + JsonInfFloatStr + R"(, - "float-nan": )" + JsonNaNFloatStr + R"(, "float-42.0": 42, "float-42.5625": 42.5625, "double-max": 1.7976931348623157e+308, "double-min": 2.2250738585072014e-308, - "double-inf": )" + JsonInfDoubleStr + R"(, - "double-nan": )" + JsonNaNDoubleStr + R"(, "double-42.0": 42, "double-42.5625": 42.5625 -})").str(); +})" + + // FIXME: temporarily disable checking the for Inf and NaN until we + // have a cross platform solution can handle this case + // + R"("float-inf": )" + JsonInfFloatStr + R"(, + // "float-nan": )" + JsonNaNFloatStr + R"(, + // "double-inf": )" + JsonInfDoubleStr + R"(, + // "double-nan": )" + JsonNaNDoubleStr + "," + ) + .str(); verifyAll(ExpectedOut, JSONExpectedOut, PrintFunc); }