From dc65301b5dde8db5a737a949967947d40dec95f0 Mon Sep 17 00:00:00 2001 From: Francisco Javier Jurado Moreno <9376816+Beetelbrox@users.noreply.github.com> Date: Mon, 27 May 2024 16:53:16 +0200 Subject: [PATCH] Add tests --- .../03166_from_readable_size.reference | 8 -------- .../0_stateless/03166_from_readable_size.sql | 19 ++++--------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/tests/queries/0_stateless/03166_from_readable_size.reference b/tests/queries/0_stateless/03166_from_readable_size.reference index 97ac1921006..c79f29c2851 100644 --- a/tests/queries/0_stateless/03166_from_readable_size.reference +++ b/tests/queries/0_stateless/03166_from_readable_size.reference @@ -5,15 +5,7 @@ 1.00 TiB 1.00 PiB 1.00 EiB -1.00 B -1.00 KB -1.00 MB -1.00 GB -1.00 TB -1.00 PB -1.00 EB 1.00 MiB -1.00 MB 1024 3072 -1024 diff --git a/tests/queries/0_stateless/03166_from_readable_size.sql b/tests/queries/0_stateless/03166_from_readable_size.sql index 0a485d6cf51..f16dd9825e1 100644 --- a/tests/queries/0_stateless/03166_from_readable_size.sql +++ b/tests/queries/0_stateless/03166_from_readable_size.sql @@ -7,18 +7,8 @@ SELECT formatReadableSize(fromReadableSize('1 TiB')); SELECT formatReadableSize(fromReadableSize('1 PiB')); SELECT formatReadableSize(fromReadableSize('1 EiB')); --- Should be the inverse of formatReadableDecimalSize -SELECT formatReadableDecimalSize(fromReadableSize('1 B')); -SELECT formatReadableDecimalSize(fromReadableSize('1 KB')); -SELECT formatReadableDecimalSize(fromReadableSize('1 MB')); -SELECT formatReadableDecimalSize(fromReadableSize('1 GB')); -SELECT formatReadableDecimalSize(fromReadableSize('1 TB')); -SELECT formatReadableDecimalSize(fromReadableSize('1 PB')); -SELECT formatReadableDecimalSize(fromReadableSize('1 EB')); - -- Is case-insensitive SELECT formatReadableSize(fromReadableSize('1 mIb')); -SELECT formatReadableDecimalSize(fromReadableSize('1 mb')); -- Should be able to parse decimals SELECT fromReadableSize('1.00 KiB'); -- 1024 @@ -51,11 +41,10 @@ SELECT fromReadableSize('1 B', '2 B'); -- { serverError NUMBER_OF_ARGUMENTS_DOES -- Wrong Type SELECT fromReadableSize(12); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT } -- Invalid input - overall garbage -SELECT fromReadableSize('oh no'); -- { serverError BAD_ARGUMENTS } +SELECT fromReadableSize('oh no'); -- { serverError CANNOT_PARSE_NUMBER } -- Invalid input - unknown unit -SELECT fromReadableSize('12.3 rb'); -- { serverError BAD_ARGUMENTS } +SELECT fromReadableSize('12.3 rb'); -- { serverError CANNOT_PARSE_TEXT } -- Invalid input - Leading whitespace -SELECT fromReadableSize(' 1 B'); -- { serverError BAD_ARGUMENTS } +SELECT fromReadableSize(' 1 B'); -- { serverError CANNOT_PARSE_INPUT_ASSERTION_FAILED } -- Invalid input - Trailing characters -SELECT fromReadableSize('1 B leftovers'); -- { serverError BAD_ARGUMENTS } -SELECT fromReadableSize(' 1 B'); -- { serverError BAD_ARGUMENTS } +SELECT fromReadableSize('1 B leftovers'); -- { serverError UNEXPECTED_DATA_AFTER_PARSED_VALUE }