From f38ebf829005a8cd6a98b63ac40924c187323c33 Mon Sep 17 00:00:00 2001 From: Nick Gerrets Date: Wed, 28 Feb 2024 11:06:06 +0100 Subject: [PATCH] tests --- test/sql/function/string/test_format.test | 21 ++++++++++ .../function/string/test_format_hugeint.test | 38 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 test/sql/function/string/test_format_hugeint.test diff --git a/test/sql/function/string/test_format.test b/test/sql/function/string/test_format.test index 44b36b0d6ec1..38ffba74524b 100644 --- a/test/sql/function/string/test_format.test +++ b/test/sql/function/string/test_format.test @@ -115,3 +115,24 @@ statement error SELECT format('{:d}', 'hello') ---- +# unsigned +query T +SELECT format('{}', 255::UTINYINT) +---- +255 + +query T +SELECT format('{}', 65535::USMALLINT) +---- +65535 + +query T +SELECT format('{}', 4294967295::UINTEGER) +---- +4294967295 + +query T +SELECT format('{}', 18446744073709551615::UBIGINT) +---- +18446744073709551615 + diff --git a/test/sql/function/string/test_format_hugeint.test b/test/sql/function/string/test_format_hugeint.test new file mode 100644 index 000000000000..be39370b9723 --- /dev/null +++ b/test/sql/function/string/test_format_hugeint.test @@ -0,0 +1,38 @@ +# name: test/sql/function/string/test_format_hugeint.test +# description: Test format on (u)hugeints +# group: [string] + +statement ok +PRAGMA enable_verification + +query I +select format('{}', '100000000000000000000000000000'::HUGEINT) +---- +100000000000000000000000000000 + +query I +select format('{}', '100000000000000000000000000000'::UHUGEINT) +---- +100000000000000000000000000000 + +# limits +query I +select format('{}', '170141183460469231731687303715884105727'::HUGEINT) +---- +170141183460469231731687303715884105727 + +query I +select format('{}', '340282366920938463463374607431768211455'::UHUGEINT) +---- +340282366920938463463374607431768211455 + +# thousand seperator +query I +select format('{:,}', '100000000000000000000000000000'::HUGEINT) +---- +100,000,000,000,000,000,000,000,000,000 + +query I +select format('{:,}', '100000000000000000000000000000'::UHUGEINT) +---- +100,000,000,000,000,000,000,000,000,000