Add tests for int4_bool() in int.c
authorMichael Paquier <michael@paquier.xyz>
Wed, 31 Jan 2024 06:02:28 +0000 (15:02 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 31 Jan 2024 06:02:28 +0000 (15:02 +0900)
This cast was previously not covered at all by the regression tests.

Author: Christoph Berg
Discussion: https://postgr.es/m/ZYQZ1hNfLd_4rzkn@msg.df7cb.de

src/test/regress/expected/boolean.out
src/test/regress/sql/boolean.sql

index 57d251eea76c20ea7df40202a127bc5db0b8da23..0e99eb7ffc0012bbad02eea138d4cb9954073223 100644 (file)
@@ -566,6 +566,25 @@ SELECT isnul OR istrue OR isfalse FROM booltbl4;
  t
 (1 row)
 
+-- Casts
+SELECT 0::boolean;
+ bool 
+------
+ f
+(1 row)
+
+SELECT 1::boolean;
+ bool 
+------
+ t
+(1 row)
+
+SELECT 2::boolean;
+ bool 
+------
+ t
+(1 row)
+
 --
 -- Clean up
 -- Many tables are retained by the regression test, but these do not seem
index 5b9dcd23172c331571384cf05dba3f261d101882..85c6b01988236e29ee342636585674307a4bd98d 100644 (file)
@@ -250,6 +250,11 @@ SELECT isfalse OR isnul OR istrue FROM booltbl4;
 SELECT istrue OR isfalse OR isnul FROM booltbl4;
 SELECT isnul OR istrue OR isfalse FROM booltbl4;
 
+-- Casts
+SELECT 0::boolean;
+SELECT 1::boolean;
+SELECT 2::boolean;
+
 
 --
 -- Clean up