MCPcopy Create free account
hub / github.com/apache/arrow / TestSuccess

Method TestSuccess

cpp/src/arrow/util/decimal_test.cc:857–884  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

855 using ParamType = FromRealTestParam<Real>;
856
857 void TestSuccess() {
858 const std::vector<ParamType> params{
859 // clang-format off
860 {0.0f, 1, 0, "0"},
861 {0.0f, 19, 4, "0.0000"},
862 {123.0f, 7, 4, "123.0000"},
863 {456.78f, 7, 4, "456.7800"},
864 {456.784f, 5, 2, "456.78"},
865 {456.786f, 5, 2, "456.79"},
866 {999.99f, 5, 2, "999.99"},
867 {123.0f, 19, 0, "123"},
868 {123.4f, 19, 0, "123"},
869 {123.6f, 19, 0, "124"},
870 // 2**62
871 {4.6116860184273879e+18, 19, 0, "4611686018427387904"},
872 // 2**63
873 {9.2233720368547758e+18, 19, 0, "9223372036854775808"},
874 // 2**64
875 {1.8446744073709552e+19, 20, 0, "18446744073709551616"},
876 // clang-format on
877 };
878 for (const ParamType& param : params) {
879 if (Decimal::kMaxPrecision > param.precision) {
880 CheckDecimalFromReal<Decimal>(param.real, param.precision, param.scale,
881 param.expected);
882 }
883 }
884 }
885
886 void TestErrors() {
887 ASSERT_RAISES(Invalid, Decimal::FromReal(INFINITY, Decimal::kMaxPrecision / 2, 4));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected