From 97cf1d949e54668241726ac5c0d6a9980b489ed3 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 29 Aug 2022 11:55:10 -0700 Subject: [PATCH] Add a few FP test cases Summary: Add a few "interesting" FP test cases to the conformance test. The fmt_test_* are taken from {fmt} regression tests and may exercise some problematic paths in FP formatting code. Reviewed By: Alfus Differential Revision: D39043191 fbshipit-source-id: 63e3188c0f6d63f2b5e6badc82b5b163238c802b --- .../thrift/src/thrift/conformance/data/ValueGenerator.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/third-party/thrift/src/thrift/conformance/data/ValueGenerator.cpp b/third-party/thrift/src/thrift/conformance/data/ValueGenerator.cpp index 9d6a00f9391..83b07da2c60 100644 --- a/third-party/thrift/src/thrift/conformance/data/ValueGenerator.cpp +++ b/third-party/thrift/src/thrift/conformance/data/ValueGenerator.cpp @@ -56,6 +56,12 @@ void addNumberValues(NamedValues& values) { values.emplace_back(-values.back().value, "min_int"); values.emplace_back((1UL << numeric_limits::digits) - 1, "max_digits"); values.emplace_back(-values.back().value, "neg_max_digits"); + + values.emplace_back(0.1, "one_tenth"); + values.emplace_back( + std::nextafter(numeric_limits::min(), T(1)), "min_plus_ulp"); + values.emplace_back( + std::nextafter(numeric_limits::max(), T(1)), "max_minus_ulp"); } if constexpr (numeric_limits::has_infinity) { values.emplace_back(numeric_limits::infinity(), "inf"); @@ -77,6 +83,11 @@ void addNumberValues(NamedValues& values) { values.emplace_back(-numeric_limits::denorm_min(), "neg_denorm_min"); } + if constexpr (std::is_same_v) { + values.emplace_back(1.9156918820264798e-56, "fmt_case_1"); + values.emplace_back(3788512123356.9854, "fmt_case_2"); + } + if constexpr (!key) { if constexpr (numeric_limits::has_quiet_NaN) { values.emplace_back(numeric_limits::quiet_NaN(), "NaN"); -- 2.11.4.GIT