From cdc60409027916d0b072d09eabee1b542ed2578e Mon Sep 17 00:00:00 2001 From: xufei Date: Fri, 10 Mar 2023 14:29:39 +0800 Subject: [PATCH] add more tests Signed-off-by: xufei --- .../Functions/tests/gtest_tidb_conversion.cpp | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/dbms/src/Functions/tests/gtest_tidb_conversion.cpp b/dbms/src/Functions/tests/gtest_tidb_conversion.cpp index c3b8e49937c..941ac240640 100644 --- a/dbms/src/Functions/tests/gtest_tidb_conversion.cpp +++ b/dbms/src/Functions/tests/gtest_tidb_conversion.cpp @@ -1317,44 +1317,44 @@ try dag_context->clearWarnings(); /// decimal32 to decimal32/64/128/256 - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(5, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(5, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(5,2)")})); - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(15, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(5, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(15,2)")})); - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(25, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(5, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(25,2)")})); - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(45, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(5, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(45,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(5, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(5, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(5,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(15, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(5, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(15,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(25, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(5, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(25,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(45, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(5, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(45,2)")})); /// decimal64 to decimal32/64/128/256 - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(5, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(15, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(5,2)")})); - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(15, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(15, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(15,2)")})); - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(25, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(15, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(25,2)")})); - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(45, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(15, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(45,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(5, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(15, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(5,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(15, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(15, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(15,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(25, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(15, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(25,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(45, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(15, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(45,2)")})); /// decimal128 to decimal32/64/128/256 - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(5, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(25, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(5,2)")})); - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(15, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(25, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(15,2)")})); - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(25, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(25, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(25,2)")})); - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(45, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(25, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(45,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(5, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(25, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(5,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(15, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(25, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(15,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(25, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(25, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(25,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(45, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(25, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(45,2)")})); /// decimal256 to decimal32/64/128/256 - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(5, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(45, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(5,2)")})); - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(15, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(45, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(15,2)")})); - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(25, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(45, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(25,2)")})); - ASSERT_COLUMN_EQ(createColumn(std::make_tuple(45, 2), {"1.23", "1.56", "1.01", "1.00"}), - executeFunction(func_name, {createColumn(std::make_tuple(45, 4), {"1.2300", "1.5600", "1.0056", "1.0023"}), createCastTypeConstColumn("Decimal(45,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(5, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(45, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(5,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(15, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(45, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(15,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(25, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(45, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(25,2)")})); + ASSERT_COLUMN_EQ(createColumn(std::make_tuple(45, 2), {"1.23", "1.56", "1.01", "1.00", "-1.23", "-1.56", "-1.01", "-1.00"}), + executeFunction(func_name, {createColumn(std::make_tuple(45, 4), {"1.2300", "1.5600", "1.0056", "1.0023", "-1.2300", "-1.5600", "-1.0056", "-1.0023"}), createCastTypeConstColumn("Decimal(45,2)")})); dag_context->setFlags(ori_flags); dag_context->clearWarnings();