From 695453738a3d7a5afa5929bc02f7046b95d91430 Mon Sep 17 00:00:00 2001 From: "Thomas G. Lockhart" Date: Tue, 27 Oct 1998 19:34:18 +0000 Subject: [PATCH] Add new inet/cidr regression test. All regression tests pass on Linux/i686 with the current source tree. --- src/test/regress/expected/inet.out | 100 ++++++++++++++++++++++++++++ src/test/regress/output/misc.source | 3 +- src/test/regress/sql/inet.sql | 35 ++++++++++ src/test/regress/sql/tests | 1 + 4 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 src/test/regress/expected/inet.out create mode 100644 src/test/regress/sql/inet.sql diff --git a/src/test/regress/expected/inet.out b/src/test/regress/expected/inet.out new file mode 100644 index 0000000000..a862a36851 --- /dev/null +++ b/src/test/regress/expected/inet.out @@ -0,0 +1,100 @@ +QUERY: DROP TABLE INET_TBL; +ERROR: Relation inet_tbl Does Not Exist! +QUERY: CREATE TABLE INET_TBL (c cidr, i inet); +QUERY: INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.226/24'); +QUERY: INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/24', '192.168.1.226'); +QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8'); +QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.0.0.0', '10.1.2.3/8'); +QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1.2.3', '10.1.2.3/32'); +QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1.2', '10.1.2.3/24'); +QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1', '10.1.2.3/16'); +QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8'); +QUERY: SELECT '' as eight, c as cidr, i as inet FROM INET_TBL; +eight|cidr |inet +-----+------------+---------------- + |192.168.1/24|192.168.1.226/24 + |192.168.1/24|192.168.1.226 + |10/8 |10.1.2.3/8 + |10.0.0.0/32 |10.1.2.3/8 + |10.1.2.3/32 |10.1.2.3 + |10.1.2/24 |10.1.2.3/24 + |10.1/16 |10.1.2.3/16 + |10/8 |10.1.2.3/8 +(8 rows) + +QUERY: SELECT '' as eight, i as inet, host(i) FROM INET_TBL; +eight|inet | host +-----+----------------+------------- + |192.168.1.226/24|192.168.1.226 + |192.168.1.226 |192.168.1.226 + |10.1.2.3/8 | 10.1.2.3 + |10.1.2.3/8 | 10.1.2.3 + |10.1.2.3 | 10.1.2.3 + |10.1.2.3/24 | 10.1.2.3 + |10.1.2.3/16 | 10.1.2.3 + |10.1.2.3/8 | 10.1.2.3 +(8 rows) + +QUERY: SELECT '' as eight, c as cidr, broadcast(c), + i as inet, broadcast(i) FROM INET_TBL; +eight|cidr | broadcast|inet | broadcast +-----+------------+---------------+----------------+--------------- + |192.168.1/24| 192.168.1.255|192.168.1.226/24| 192.168.1.255 + |192.168.1/24| 192.168.1.255|192.168.1.226 |255.255.255.255 + |10/8 | 10.255.255.255|10.1.2.3/8 | 10.255.255.255 + |10.0.0.0/32 |255.255.255.255|10.1.2.3/8 | 10.255.255.255 + |10.1.2.3/32 |255.255.255.255|10.1.2.3 |255.255.255.255 + |10.1.2/24 | 10.1.2.255|10.1.2.3/24 | 10.1.2.255 + |10.1/16 | 10.1.255.255|10.1.2.3/16 | 10.1.255.255 + |10/8 | 10.255.255.255|10.1.2.3/8 | 10.255.255.255 +(8 rows) + +QUERY: SELECT '' as eight, c as cidr, network(c) as "network(cidr)", + i as inet, network(i) as "network(inet)" FROM INET_TBL; +eight|cidr |network(cidr)|inet |network(inet) +-----+------------+-------------+----------------+------------- + |192.168.1/24| 0.1.168.192|192.168.1.226/24| 0.1.168.192 + |192.168.1/24| 0.1.168.192|192.168.1.226 |226.1.168.192 + |10/8 | 0.0.0.10|10.1.2.3/8 | 0.0.0.10 + |10.0.0.0/32 | 0.0.0.10|10.1.2.3/8 | 0.0.0.10 + |10.1.2.3/32 | 3.2.1.10|10.1.2.3 | 3.2.1.10 + |10.1.2/24 | 0.2.1.10|10.1.2.3/24 | 0.2.1.10 + |10.1/16 | 0.0.1.10|10.1.2.3/16 | 0.0.1.10 + |10/8 | 0.0.0.10|10.1.2.3/8 | 0.0.0.10 +(8 rows) + +QUERY: SELECT '' as eight, c as cidr, masklen(c) as "masklen(cidr)", + i as inet, masklen(i) as "masklen(inet)" FROM INET_TBL; +eight|cidr |masklen(cidr)|inet |masklen(inet) +-----+------------+-------------+----------------+------------- + |192.168.1/24| 24|192.168.1.226/24| 24 + |192.168.1/24| 24|192.168.1.226 | 32 + |10/8 | 8|10.1.2.3/8 | 8 + |10.0.0.0/32 | 32|10.1.2.3/8 | 8 + |10.1.2.3/32 | 32|10.1.2.3 | 32 + |10.1.2/24 | 24|10.1.2.3/24 | 24 + |10.1/16 | 16|10.1.2.3/16 | 16 + |10/8 | 8|10.1.2.3/8 | 8 +(8 rows) + +QUERY: SELECT '' as two, c as cidr, masklen(c) as "masklen(cidr)", + i as inet, masklen(i) as "masklen(inet)" FROM INET_TBL + WHERE masklen(c) <= 8; +two|cidr|masklen(cidr)|inet |masklen(inet) +---+----+-------------+----------+------------- + |10/8| 8|10.1.2.3/8| 8 + |10/8| 8|10.1.2.3/8| 8 +(2 rows) + +QUERY: SELECT '' as six, c as cidr, i as inet FROM INET_TBL + WHERE c = i; +six|cidr |inet +---+------------+---------------- + |192.168.1/24|192.168.1.226/24 + |10/8 |10.1.2.3/8 + |10.1.2.3/32 |10.1.2.3 + |10.1.2/24 |10.1.2.3/24 + |10.1/16 |10.1.2.3/16 + |10/8 |10.1.2.3/8 +(6 rows) + diff --git a/src/test/regress/output/misc.source b/src/test/regress/output/misc.source index 39a6101031..05b66d9aeb 100644 --- a/src/test/regress/output/misc.source +++ b/src/test/regress/output/misc.source @@ -481,6 +481,7 @@ hash_txt_heap hobbies_r iexit ihighway +inet_tbl insert_seq insert_tbl int2_tbl @@ -513,5 +514,5 @@ tinterval_tbl toyemp varchar_tbl xacttest -(71 rows) +(72 rows) diff --git a/src/test/regress/sql/inet.sql b/src/test/regress/sql/inet.sql new file mode 100644 index 0000000000..d178d7493e --- /dev/null +++ b/src/test/regress/sql/inet.sql @@ -0,0 +1,35 @@ +-- INET regression tests +-- + +-- prepare the table... + +DROP TABLE INET_TBL; +CREATE TABLE INET_TBL (c cidr, i inet); +INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.226/24'); +INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/24', '192.168.1.226'); +INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8'); +INSERT INTO INET_TBL (c, i) VALUES ('10.0.0.0', '10.1.2.3/8'); +INSERT INTO INET_TBL (c, i) VALUES ('10.1.2.3', '10.1.2.3/32'); +INSERT INTO INET_TBL (c, i) VALUES ('10.1.2', '10.1.2.3/24'); +INSERT INTO INET_TBL (c, i) VALUES ('10.1', '10.1.2.3/16'); +INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8'); + +SELECT '' as eight, c as cidr, i as inet FROM INET_TBL; + +-- now test some support functions + +SELECT '' as eight, i as inet, host(i) FROM INET_TBL; +SELECT '' as eight, c as cidr, broadcast(c), + i as inet, broadcast(i) FROM INET_TBL; +SELECT '' as eight, c as cidr, network(c) as "network(cidr)", + i as inet, network(i) as "network(inet)" FROM INET_TBL; +SELECT '' as eight, c as cidr, masklen(c) as "masklen(cidr)", + i as inet, masklen(i) as "masklen(inet)" FROM INET_TBL; + +SELECT '' as two, c as cidr, masklen(c) as "masklen(cidr)", + i as inet, masklen(i) as "masklen(inet)" FROM INET_TBL + WHERE masklen(c) <= 8; + +SELECT '' as six, c as cidr, i as inet FROM INET_TBL + WHERE c = i; + diff --git a/src/test/regress/sql/tests b/src/test/regress/sql/tests index e13da74021..849f1b6d2d 100644 --- a/src/test/regress/sql/tests +++ b/src/test/regress/sql/tests @@ -24,6 +24,7 @@ reltime abstime tinterval horology +inet comments create_function_1 create_type -- 2.40.0