From c4ee8b93e3f3ec09fc4d2f5ae37e4e74b7405005 Mon Sep 17 00:00:00 2001 From: Maks Skorokhod Date: Thu, 23 Nov 2017 11:47:34 +0300 Subject: [PATCH] :white_check_mark: add test for gcd/lcm functions --- .../0_stateless/00515_gcd_lcm.reference | 34 +++++++++++++++++ .../queries/0_stateless/00515_gcd_lcm.sql | 38 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00515_gcd_lcm.reference create mode 100644 dbms/tests/queries/0_stateless/00515_gcd_lcm.sql diff --git a/dbms/tests/queries/0_stateless/00515_gcd_lcm.reference b/dbms/tests/queries/0_stateless/00515_gcd_lcm.reference new file mode 100644 index 00000000000..8bddd73754f --- /dev/null +++ b/dbms/tests/queries/0_stateless/00515_gcd_lcm.reference @@ -0,0 +1,34 @@ +256 +11 +64 +1 +2 +1 +1 +1 +2147483647 +1 +5120 +121 +256 +1 +4 +735 +64770 +4611686011984936962 +4611686011984936962 +2147483648 +256 +11 +64 +1 +2 +1 +1 +5120 +121 +256 +1 +4 +735 +64770 diff --git a/dbms/tests/queries/0_stateless/00515_gcd_lcm.sql b/dbms/tests/queries/0_stateless/00515_gcd_lcm.sql new file mode 100644 index 00000000000..5a8dfae9ba8 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00515_gcd_lcm.sql @@ -0,0 +1,38 @@ +-- test gcd +select gcd(1280, 1024); +select gcd(11, 121); +select gcd(-256, 64); +select gcd(1, 1); +select gcd(4, 2); +select gcd(15, 49); +select gcd(255, 254); +select gcd(2147483647, 2147483646); +select gcd(4611686011984936962, 2147483647); +select gcd(-2147483648, 1); +-- test lcm +select lcm(1280, 1024); +select lcm(11, 121); +select lcm(-256, 64); +select lcm(1, 1); +select lcm(4, 2); +select lcm(15, 49); +select lcm(255, 254); +select lcm(2147483647, 2147483646); +select lcm(4611686011984936962, 2147483647); +select lcm(-2147483648, 1); +-- test gcd float will cast to int +select gcd(1280.1, 1024.1); +select gcd(11.1, 121.1); +select gcd(-256.1, 64.1); +select gcd(1.1, 1.1); +select gcd(4.1, 2.1); +select gcd(15.1, 49.1); +select gcd(255.1, 254.1); +-- test lcm float cast to int +select lcm(1280.1, 1024.1); +select lcm(11.1, 121.1); +select lcm(-256.1, 64.1); +select lcm(1.1, 1.1); +select lcm(4.1, 2.1); +select lcm(15.1, 49.1); +select lcm(255.1, 254.1);