From 39de699790439bff3469a46a1255764961eee234 Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Thu, 14 Jan 2021 19:13:14 +0300 Subject: [PATCH] Added test. --- .../01653_tuple_hamming_distance_2.reference | 18 +++++++++++++++ .../01653_tuple_hamming_distance_2.sql | 23 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/queries/0_stateless/01653_tuple_hamming_distance_2.reference create mode 100644 tests/queries/0_stateless/01653_tuple_hamming_distance_2.sql diff --git a/tests/queries/0_stateless/01653_tuple_hamming_distance_2.reference b/tests/queries/0_stateless/01653_tuple_hamming_distance_2.reference new file mode 100644 index 00000000000..613ab096c8c --- /dev/null +++ b/tests/queries/0_stateless/01653_tuple_hamming_distance_2.reference @@ -0,0 +1,18 @@ +0 +1 +\N +\N +2 +1 +1 +1 +0 +1 +2 +\N +\N +\N +1 +0 +1 +2 diff --git a/tests/queries/0_stateless/01653_tuple_hamming_distance_2.sql b/tests/queries/0_stateless/01653_tuple_hamming_distance_2.sql new file mode 100644 index 00000000000..81afb1e1201 --- /dev/null +++ b/tests/queries/0_stateless/01653_tuple_hamming_distance_2.sql @@ -0,0 +1,23 @@ +SELECT tupleHammingDistance(tuple(1), tuple(1)); +SELECT tupleHammingDistance(tuple(1), tuple(2)); +SELECT tupleHammingDistance(tuple(1), tuple(Null)); +SELECT tupleHammingDistance(tuple(Null), tuple(Null)); +SELECT tupleHammingDistance((1, 2), (3, 4)); +SELECT tupleHammingDistance((1, 2), (1, 4)); +SELECT tupleHammingDistance(materialize((1, 2)), (1, 4)); +SELECT tupleHammingDistance(materialize((1, 2)),materialize ((1, 4))); +SELECT tupleHammingDistance((1, 2), (1, 2)); +SELECT tupleHammingDistance((1, 2), (1, 257)); +SELECT tupleHammingDistance((1, 2, 3), (1, 257, 65537)); +SELECT tupleHammingDistance((1, 2), (1, Null)); +SELECT tupleHammingDistance((1, Null), (1, Null)); +SELECT tupleHammingDistance((Null, Null), (Null, Null)); +SELECT tupleHammingDistance(('abc', 2), ('abc', 257)); +SELECT tupleHammingDistance(('abc', (1, 2)), ('abc', (1, 2))); +SELECT tupleHammingDistance(('abc', (1, 2)), ('def', (1, 2))); +SELECT tupleHammingDistance(('abc', (1, 2)), ('def', (1, 3))); + + +SELECT tupleHammingDistance(tuple(1), tuple(1, 1)); --{serverError 43} +SELECT tupleHammingDistance(tuple(1), tuple('a')); --{serverError 386} +SELECT tupleHammingDistance((1, 3), (3, 'a')); --{serverError 386}