From 7ce6a71c950e13ebbdd58f7c849217384a3cb443 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 20 Jul 2019 02:42:59 +0300 Subject: [PATCH] Steal part of modifications from #6007 --- ...411_long_accurate_number_comparison.python | 33 ++++++++++++------- ...ccurate_number_comparison_float.reference} | 0 ...1_long_accurate_number_comparison_float.sh | 8 +++++ ..._accurate_number_comparison_int1.reference | 1 + ...1_long_accurate_number_comparison_int1.sh} | 2 +- ..._accurate_number_comparison_int2.reference | 1 + ...11_long_accurate_number_comparison_int2.sh | 8 +++++ 7 files changed, 41 insertions(+), 12 deletions(-) rename dbms/tests/queries/0_stateless/{00411_long_accurate_number_comparison.reference => 00411_long_accurate_number_comparison_float.reference} (100%) create mode 100755 dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_float.sh create mode 100644 dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int1.reference rename dbms/tests/queries/0_stateless/{00411_long_accurate_number_comparison.sh => 00411_long_accurate_number_comparison_int1.sh} (73%) create mode 100644 dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int2.reference create mode 100755 dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int2.sh diff --git a/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison.python b/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison.python index b5b38d8ddca..aefcdec3610 100644 --- a/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison.python +++ b/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison.python @@ -1,6 +1,6 @@ #!/usr/bin/env python from __future__ import print_function -import os, itertools, urllib +import os, itertools, urllib, urllib2, sys def get_ch_answer(query): return urllib.urlopen(os.environ.get('CLICKHOUSE_URL', 'http://localhost:' + os.environ.get('CLICKHOUSE_PORT_HTTP', '8123') ), data=query).read() @@ -124,17 +124,28 @@ def main(): sql_file = open(base_name + '.sql', 'wt') ref_file = open(base_name + '.reference', 'wt') - for (v1, v2) in itertools.combinations(VALUES, 2): - q, a = test_pair(v1, v2) - if GENERATE_TEST_FILES: - sql_file.write(q + ";\n") - ref_file.write(a + "\n") + num_int_tests = len(VALUES) ** 2 - for (i, f) in itertools.product(VALUES_INT, VALUES_FLOAT): - q, a = test_float_pair(i, f) - if GENERATE_TEST_FILES: - sql_file.write(q + ";\n") - ref_file.write(a + "\n") + if 'int1' in sys.argv[1:]: + for (v1, v2) in itertools.islice(itertools.combinations(VALUES, 2), None, num_int_tests / 2): + q, a = test_pair(v1, v2) + if GENERATE_TEST_FILES: + sql_file.write(q + ";\n") + ref_file.write(a + "\n") + + if 'int2' in sys.argv[1:]: + for (v1, v2) in itertools.islice(itertools.combinations(VALUES, 2), num_int_tests / 2, None): + q, a = test_pair(v1, v2) + if GENERATE_TEST_FILES: + sql_file.write(q + ";\n") + ref_file.write(a + "\n") + + if 'float' in sys.argv[1:]: + for (i, f) in itertools.product(VALUES_INT, VALUES_FLOAT): + q, a = test_float_pair(i, f) + if GENERATE_TEST_FILES: + sql_file.write(q + ";\n") + ref_file.write(a + "\n") print("PASSED") diff --git a/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison.reference b/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_float.reference similarity index 100% rename from dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison.reference rename to dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_float.reference diff --git a/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_float.sh b/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_float.sh new file mode 100755 index 00000000000..9fa14a4dc5f --- /dev/null +++ b/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_float.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +. $CURDIR/../shell_config.sh + +# We should have correct env vars from shell_config.sh to run this test + +python $CURDIR/00411_long_accurate_number_comparison.python float diff --git a/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int1.reference b/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int1.reference new file mode 100644 index 00000000000..53cdf1e9393 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int1.reference @@ -0,0 +1 @@ +PASSED diff --git a/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison.sh b/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int1.sh similarity index 73% rename from dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison.sh rename to dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int1.sh index 0015ba2b860..d9eb68e5729 100755 --- a/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison.sh +++ b/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int1.sh @@ -5,4 +5,4 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) # We should have correct env vars from shell_config.sh to run this test -python $CURDIR/00411_long_accurate_number_comparison.python +python $CURDIR/00411_long_accurate_number_comparison.python int1 diff --git a/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int2.reference b/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int2.reference new file mode 100644 index 00000000000..53cdf1e9393 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int2.reference @@ -0,0 +1 @@ +PASSED diff --git a/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int2.sh b/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int2.sh new file mode 100755 index 00000000000..500bf76bca8 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00411_long_accurate_number_comparison_int2.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +. $CURDIR/../shell_config.sh + +# We should have correct env vars from shell_config.sh to run this test + +python $CURDIR/00411_long_accurate_number_comparison.python int2