// Copyright 2020 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include "src/tint/utils/strconv/float_to_string.h"

#include <math.h>
#include <cstring>
#include <limits>

#include "gtest/gtest.h"
#include "src/tint/utils/memory/bitcast.h"

namespace tint::writer {
namespace {

////////////////////////////////////////////////////////////////////////////////
// FloatToString                                                              //
////////////////////////////////////////////////////////////////////////////////

TEST(FloatToStringTest, Zero) {
    EXPECT_EQ(FloatToString(0.0f), "0.0");
}

TEST(FloatToStringTest, One) {
    EXPECT_EQ(FloatToString(1.0f), "1.0");
}

TEST(FloatToStringTest, MinusOne) {
    EXPECT_EQ(FloatToString(-1.0f), "-1.0");
}

TEST(FloatToStringTest, Billion) {
    EXPECT_EQ(FloatToString(1e9f), "1000000000.0");
}

TEST(FloatToStringTest, Small) {
    EXPECT_NE(FloatToString(std::numeric_limits<float>::epsilon()), "0.0");
}

TEST(FloatToStringTest, Highest) {
    const auto highest = std::numeric_limits<float>::max();
    const auto expected_highest = 340282346638528859811704183484516925440.0f;
    if (highest < expected_highest || highest > expected_highest) {
        GTEST_SKIP() << "std::numeric_limits<float>::max() is not as expected for "
                        "this target";
    }
    EXPECT_EQ(FloatToString(std::numeric_limits<float>::max()),
              "340282346638528859811704183484516925440.0");
}

TEST(FloatToStringTest, Lowest) {
    // Some compilers complain if you test floating point numbers for equality.
    // So say it via two inequalities.
    const auto lowest = std::numeric_limits<float>::lowest();
    const auto expected_lowest = -340282346638528859811704183484516925440.0f;
    if (lowest < expected_lowest || lowest > expected_lowest) {
        GTEST_SKIP() << "std::numeric_limits<float>::lowest() is not as expected for "
                        "this target";
    }
    EXPECT_EQ(FloatToString(std::numeric_limits<float>::lowest()),
              "-340282346638528859811704183484516925440.0");
}

TEST(FloatToStringTest, Precision) {
    EXPECT_EQ(FloatToString(1e-8f), "0.00000000999999993923");
    EXPECT_EQ(FloatToString(1e-9f), "0.00000000099999997172");
    EXPECT_EQ(FloatToString(1e-10f), "0.00000000010000000134");
    EXPECT_EQ(FloatToString(1e-20f), "0.00000000000000000001");
}

////////////////////////////////////////////////////////////////////////////////
// FloatToBitPreservingString                                                 //
////////////////////////////////////////////////////////////////////////////////

TEST(FloatToBitPreservingStringTest, Zero) {
    EXPECT_EQ(FloatToBitPreservingString(0.0f), "0.0");
}

TEST(FloatToBitPreservingStringTest, NegativeZero) {
    EXPECT_EQ(FloatToBitPreservingString(-0.0f), "-0.0");
}

TEST(FloatToBitPreservingStringTest, One) {
    EXPECT_EQ(FloatToBitPreservingString(1.0f), "1.0");
}

TEST(FloatToBitPreservingStringTest, MinusOne) {
    EXPECT_EQ(FloatToBitPreservingString(-1.0f), "-1.0");
}

TEST(FloatToBitPreservingStringTest, Billion) {
    EXPECT_EQ(FloatToBitPreservingString(1e9f), "1000000000.0");
}

TEST(FloatToBitPreservingStringTest, Small) {
    EXPECT_NE(FloatToBitPreservingString(std::numeric_limits<float>::epsilon()), "0.0");
}

TEST(FloatToBitPreservingStringTest, Highest) {
    const auto highest = std::numeric_limits<float>::max();
    const auto expected_highest = 340282346638528859811704183484516925440.0f;
    if (highest < expected_highest || highest > expected_highest) {
        GTEST_SKIP() << "std::numeric_limits<float>::max() is not as expected for "
                        "this target";
    }
    EXPECT_EQ(FloatToBitPreservingString(std::numeric_limits<float>::max()),
              "340282346638528859811704183484516925440.0");
}

TEST(FloatToBitPreservingStringTest, Lowest) {
    // Some compilers complain if you test floating point numbers for equality.
    // So say it via two inequalities.
    const auto lowest = std::numeric_limits<float>::lowest();
    const auto expected_lowest = -340282346638528859811704183484516925440.0f;
    if (lowest < expected_lowest || lowest > expected_lowest) {
        GTEST_SKIP() << "std::numeric_limits<float>::lowest() is not as expected for "
                        "this target";
    }
    EXPECT_EQ(FloatToBitPreservingString(std::numeric_limits<float>::lowest()),
              "-340282346638528859811704183484516925440.0");
}

TEST(FloatToBitPreservingStringTest, SmallestDenormal) {
    EXPECT_EQ(FloatToBitPreservingString(0x1p-149f), "0x1p-149");
    EXPECT_EQ(FloatToBitPreservingString(-0x1p-149f), "-0x1p-149");
}

TEST(FloatToBitPreservingStringTest, BiggerDenormal) {
    EXPECT_EQ(FloatToBitPreservingString(0x1p-148f), "0x1p-148");
    EXPECT_EQ(FloatToBitPreservingString(-0x1p-148f), "-0x1p-148");
}

TEST(FloatToBitPreservingStringTest, LargestDenormal) {
    static_assert(0x0.fffffep-126f == 0x1.fffffcp-127f);
    EXPECT_EQ(FloatToBitPreservingString(0x0.fffffep-126f), "0x1.fffffcp-127");
}

TEST(FloatToBitPreservingStringTest, Subnormal_cafebe) {
    EXPECT_EQ(FloatToBitPreservingString(0x1.2bfaf8p-127f), "0x1.2bfaf8p-127");
    EXPECT_EQ(FloatToBitPreservingString(-0x1.2bfaf8p-127f), "-0x1.2bfaf8p-127");
}

TEST(FloatToBitPreservingStringTest, Subnormal_aaaaa) {
    EXPECT_EQ(FloatToBitPreservingString(0x1.55554p-130f), "0x1.55554p-130");
    EXPECT_EQ(FloatToBitPreservingString(-0x1.55554p-130f), "-0x1.55554p-130");
}

TEST(FloatToBitPreservingStringTest, Infinity) {
    EXPECT_EQ(FloatToBitPreservingString(INFINITY), "0x1p+128");
    EXPECT_EQ(FloatToBitPreservingString(-INFINITY), "-0x1p+128");
}

TEST(FloatToBitPreservingStringTest, NaN) {
    // TODO(crbug.com/tint/1714): On x86, this bitcast will set bit 22 (the highest mantissa bit) to
    // 1, regardless of the bit value in the integer. This is likely due to IEEE 754's
    // recommendation that that the highest mantissa bit differentiates quiet NaNs from signalling
    // NaNs. On x86, float return values usually go via the FPU which can transform the signalling
    // NaN bit (0) to quiet NaN (1). As NaN floating point numbers can be silently modified by the
    // architecture, and the signalling bit is architecture defined, this test may fail on other
    // architectures.
    auto nan = tint::Bitcast<float>(0x7fc0beef);
    EXPECT_EQ(FloatToBitPreservingString(nan), "0x1.817ddep+128");
    EXPECT_EQ(FloatToBitPreservingString(-nan), "-0x1.817ddep+128");
}

////////////////////////////////////////////////////////////////////////////////
// DoubleToString                                                              //
////////////////////////////////////////////////////////////////////////////////

TEST(DoubleToStringTest, Zero) {
    EXPECT_EQ(DoubleToString(0.000000000), "0.0");
}

TEST(DoubleToStringTest, One) {
    EXPECT_EQ(DoubleToString(1.000000000), "1.0");
}

TEST(DoubleToStringTest, MinusOne) {
    EXPECT_EQ(DoubleToString(-1.000000000), "-1.0");
}

TEST(DoubleToStringTest, Billion) {
    EXPECT_EQ(DoubleToString(1e9), "1000000000.0");
}

TEST(DoubleToStringTest, Small) {
    EXPECT_NE(DoubleToString(std::numeric_limits<double>::epsilon()), "0.0");
}

TEST(DoubleToStringTest, Highest) {
    const auto highest = std::numeric_limits<double>::max();
    const auto expected_highest = 1.797693134862315708e+308;
    if (highest < expected_highest || highest > expected_highest) {
        GTEST_SKIP() << "std::numeric_limits<double>::max() is not as expected for "
                        "this target";
    }
    EXPECT_EQ(DoubleToString(std::numeric_limits<double>::max()),
              "179769313486231570814527423731704356798070567525844996598917476803157260780028538760"
              "589558632766878171540458953514382464234321326889464182768467546703537516986049910576"
              "551282076245490090389328944075868508455133942304583236903222948165808559332123348274"
              "797826204144723168738177180919299881250404026184124858368.0");
}

TEST(DoubleToStringTest, Lowest) {
    // Some compilers complain if you test floating point numbers for equality.
    // So say it via two inequalities.
    const auto lowest = std::numeric_limits<double>::lowest();
    const auto expected_lowest = -1.797693134862315708e+308;
    if (lowest < expected_lowest || lowest > expected_lowest) {
        GTEST_SKIP() << "std::numeric_limits<double>::lowest() is not as expected for "
                        "this target";
    }
    EXPECT_EQ(DoubleToString(std::numeric_limits<double>::lowest()),
              "-17976931348623157081452742373170435679807056752584499659891747680315726078002853876"
              "058955863276687817154045895351438246423432132688946418276846754670353751698604991057"
              "655128207624549009038932894407586850845513394230458323690322294816580855933212334827"
              "4797826204144723168738177180919299881250404026184124858368.0");
}

TEST(DoubleToStringTest, Precision) {
    EXPECT_EQ(DoubleToString(1e-8), "0.00000001");
    EXPECT_EQ(DoubleToString(1e-9), "0.000000001");
    EXPECT_EQ(DoubleToString(1e-10), "0.0000000001");
    EXPECT_EQ(DoubleToString(1e-15), "0.000000000000001");
}

////////////////////////////////////////////////////////////////////////////////
// DoubleToBitPreservingString                                                 //
////////////////////////////////////////////////////////////////////////////////

TEST(DoubleToBitPreservingStringTest, Zero) {
    EXPECT_EQ(DoubleToBitPreservingString(0.0), "0.0");
}

TEST(DoubleToBitPreservingStringTest, NegativeZero) {
    EXPECT_EQ(DoubleToBitPreservingString(-0.0), "-0.0");
}

TEST(DoubleToBitPreservingStringTest, One) {
    EXPECT_EQ(DoubleToBitPreservingString(1.0), "1.0");
}

TEST(DoubleToBitPreservingStringTest, MinusOne) {
    EXPECT_EQ(DoubleToBitPreservingString(-1.0), "-1.0");
}

TEST(DoubleToBitPreservingStringTest, Billion) {
    EXPECT_EQ(DoubleToBitPreservingString(1e9), "1000000000.0");
}

TEST(DoubleToBitPreservingStringTest, Small) {
    EXPECT_NE(DoubleToBitPreservingString(std::numeric_limits<double>::epsilon()), "0.0");
}

TEST(DoubleToBitPreservingStringTest, Highest) {
    const auto highest = std::numeric_limits<double>::max();
    const auto expected_highest = 1.797693134862315708e+308;
    if (highest < expected_highest || highest > expected_highest) {
        GTEST_SKIP() << "std::numeric_limits<float>::max() is not as expected for "
                        "this target";
    }
    EXPECT_EQ(DoubleToBitPreservingString(std::numeric_limits<double>::max()),
              "179769313486231570814527423731704356798070567525844996598917476803157260780028538760"
              "589558632766878171540458953514382464234321326889464182768467546703537516986049910576"
              "551282076245490090389328944075868508455133942304583236903222948165808559332123348274"
              "797826204144723168738177180919299881250404026184124858368.0");
}

TEST(DoubleToBitPreservingStringTest, Lowest) {
    // Some compilers complain if you test floating point numbers for equality.
    // So say it via two inequalities.
    const auto lowest = std::numeric_limits<double>::lowest();
    const auto expected_lowest = -1.797693134862315708e+308;
    if (lowest < expected_lowest || lowest > expected_lowest) {
        GTEST_SKIP() << "std::numeric_limits<float>::lowest() is not as expected for "
                        "this target";
    }
    EXPECT_EQ(DoubleToBitPreservingString(std::numeric_limits<double>::lowest()),
              "-17976931348623157081452742373170435679807056752584499659891747680315726078002853876"
              "058955863276687817154045895351438246423432132688946418276846754670353751698604991057"
              "655128207624549009038932894407586850845513394230458323690322294816580855933212334827"
              "4797826204144723168738177180919299881250404026184124858368.0");
}

TEST(DoubleToBitPreservingStringTest, SmallestDenormal) {
    EXPECT_EQ(DoubleToBitPreservingString(0x1p-1074), "0x1p-1074");
    EXPECT_EQ(DoubleToBitPreservingString(-0x1p-1074), "-0x1p-1074");
}

TEST(DoubleToBitPreservingStringTest, BiggerDenormal) {
    EXPECT_EQ(DoubleToBitPreservingString(0x1p-1073), "0x1p-1073");
    EXPECT_EQ(DoubleToBitPreservingString(-0x1p-1073), "-0x1p-1073");
}

TEST(DoubleToBitPreservingStringTest, LargestDenormal) {
    static_assert(0x0.fffffffffffffp-1022 == 0x1.ffffffffffffep-1023);
    EXPECT_EQ(DoubleToBitPreservingString(0x0.fffffffffffffp-1022), "0x1.ffffffffffffep-1023");
    EXPECT_EQ(DoubleToBitPreservingString(-0x0.fffffffffffffp-1022), "-0x1.ffffffffffffep-1023");
}

TEST(DoubleToBitPreservingStringTest, Subnormal_cafef00dbeef) {
    EXPECT_EQ(DoubleToBitPreservingString(0x1.cafef00dbeefp-1023), "0x1.cafef00dbeefp-1023");
    EXPECT_EQ(DoubleToBitPreservingString(-0x1.cafef00dbeefp-1023), "-0x1.cafef00dbeefp-1023");
}

TEST(DoubleToBitPreservingStringTest, Subnormal_aaaaaaaaaaaaap) {
    static_assert(0x0.aaaaaaaaaaaaap-1023 == 0x1.5555555555554p-1024);
    EXPECT_EQ(DoubleToBitPreservingString(0x0.aaaaaaaaaaaaap-1023), "0x1.5555555555554p-1024");
    EXPECT_EQ(DoubleToBitPreservingString(-0x0.aaaaaaaaaaaaap-1023), "-0x1.5555555555554p-1024");
}

TEST(DoubleToBitPreservingStringTest, Infinity) {
    EXPECT_EQ(DoubleToBitPreservingString(static_cast<double>(INFINITY)), "0x1p+1024");
    EXPECT_EQ(DoubleToBitPreservingString(static_cast<double>(-INFINITY)), "-0x1p+1024");
}

TEST(DoubleToBitPreservingStringTest, NaN) {
    auto nan = tint::Bitcast<double>(0x7ff8cafef00dbeefull);
    EXPECT_EQ(DoubleToBitPreservingString(static_cast<double>(nan)), "0x1.8cafef00dbeefp+1024");
    EXPECT_EQ(DoubleToBitPreservingString(static_cast<double>(-nan)), "-0x1.8cafef00dbeefp+1024");
}

}  // namespace
}  // namespace tint::writer
