Fix regression test now that code seems to work.

Add tests for comparison operators.
This commit is contained in:
Thomas G. Lockhart 1998-10-29 18:12:50 +00:00
parent 396571d79c
commit d9a2be00ec
1 changed files with 105 additions and 71 deletions

View File

@ -9,84 +9,98 @@ 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: INSERT INTO INET_TBL (c, i) VALUES ('10', '11.1.2.3/8');
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '9.1.2.3/8');
QUERY: SELECT '' AS ten, c AS cidr, i AS inet FROM INET_TBL;
ten|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
|10/8 |11.1.2.3/8
|10/8 |9.1.2.3/8
(10 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 ten, i AS inet, host(i) FROM INET_TBL;
ten|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
|11.1.2.3/8 | 11.1.2.3
|9.1.2.3/8 | 9.1.2.3
(10 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 ten, c AS cidr, broadcast(c),
i AS inet, broadcast(i) FROM INET_TBL;
ten|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
|10/8 | 10.255.255.255|11.1.2.3/8 | 11.255.255.255
|10/8 | 10.255.255.255|9.1.2.3/8 | 9.255.255.255
(10 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 ten, c AS cidr, network(c) AS "network(cidr)",
i AS inet, network(i) AS "network(inet)" FROM INET_TBL;
ten|cidr |network(cidr)|inet |network(inet)
---+------------+-------------+----------------+----------------
|192.168.1/24|192.168.1/24 |192.168.1.226/24|192.168.1/24
|192.168.1/24|192.168.1/24 |192.168.1.226 |192.168.1.226/32
|10/8 |10/8 |10.1.2.3/8 |10/8
|10.0.0.0/32 |10.0.0.0/32 |10.1.2.3/8 |10/8
|10.1.2.3/32 |10.1.2.3/32 |10.1.2.3 |10.1.2.3/32
|10.1.2/24 |10.1.2/24 |10.1.2.3/24 |10.1.2/24
|10.1/16 |10.1/16 |10.1.2.3/16 |10.1/16
|10/8 |10/8 |10.1.2.3/8 |10/8
|10/8 |10/8 |11.1.2.3/8 |11/8
|10/8 |10/8 |9.1.2.3/8 |9/8
(10 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 ten, c AS cidr, masklen(c) AS "masklen(cidr)",
i AS inet, masklen(i) AS "masklen(inet)" FROM INET_TBL;
ten|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
|10/8 | 8|11.1.2.3/8 | 8
|10/8 | 8|9.1.2.3/8 | 8
(10 rows)
QUERY: SELECT '' as two, c as cidr, masklen(c) as "masklen(cidr)",
i as inet, masklen(i) as "masklen(inet)" FROM INET_TBL
QUERY: SELECT '' AS four, 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)
four|cidr|masklen(cidr)|inet |masklen(inet)
----+----+-------------+----------+-------------
|10/8| 8|10.1.2.3/8| 8
|10/8| 8|10.1.2.3/8| 8
|10/8| 8|11.1.2.3/8| 8
|10/8| 8|9.1.2.3/8 | 8
(4 rows)
QUERY: SELECT '' as six, c as cidr, i as inet FROM INET_TBL
QUERY: SELECT '' AS six, c AS cidr, i AS inet FROM INET_TBL
WHERE c = i;
six|cidr |inet
---+------------+----------------
@ -98,3 +112,23 @@ six|cidr |inet
|10/8 |10.1.2.3/8
(6 rows)
QUERY: SELECT '' AS ten, i, c,
i < c AS lt, i <= c AS le, i = c AS eq,
i >= c AS ge, i > c AS gt, i <> c AS ne,
i << c AS sb, i <<= c AS sbe,
i >> c AS sup, i >>= c AS spe
FROM INET_TBL;
ten|i |c |lt|le|eq|ge|gt|ne|sb|sbe|sup|spe
---+----------------+------------+--+--+--+--+--+--+--+---+---+---
|192.168.1.226/24|192.168.1/24|f |t |t |t |f |f |f |t |f |t
|192.168.1.226 |192.168.1/24|f |f |f |t |t |t |t |t |f |f
|10.1.2.3/8 |10/8 |f |t |t |t |f |f |f |t |f |t
|10.1.2.3/8 |10.0.0.0/32 |f |f |f |t |t |t |f |f |t |t
|10.1.2.3 |10.1.2.3/32 |f |t |t |t |f |f |f |t |f |t
|10.1.2.3/24 |10.1.2/24 |f |t |t |t |f |f |f |t |f |t
|10.1.2.3/16 |10.1/16 |f |t |t |t |f |f |f |t |f |t
|10.1.2.3/8 |10/8 |f |t |t |t |f |f |f |t |f |t
|11.1.2.3/8 |10/8 |f |f |f |t |t |t |f |f |f |f
|9.1.2.3/8 |10/8 |t |t |f |f |f |t |f |f |f |f
(10 rows)