Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 69273c8

Browse files
committed
Add test case for abbrev(cidr)
This will in particular add some good test coverage for inet_cidr_ntop.c, which was previously completely uncovered. Reviewed-by: Tom Lane <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/cb0c4662-4596-dab4-7f64-839c5e8582c8%40enterprisedb.com
1 parent e7f4291 commit 69273c8

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/test/regress/expected/inet.out

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,28 @@ SELECT i AS inet, host(i), text(i), family(i) FROM INET_TBL;
8888
::4.3.2.1/24 | ::4.3.2.1 | ::4.3.2.1/24 | 6
8989
(17 rows)
9090

91+
SELECT c AS cidr, abbrev(c) FROM INET_TBL;
92+
cidr | abbrev
93+
--------------------+--------------------
94+
192.168.1.0/24 | 192.168.1/24
95+
192.168.1.0/26 | 192.168.1.0/26
96+
192.168.1.0/24 | 192.168.1/24
97+
192.168.1.0/24 | 192.168.1/24
98+
192.168.1.0/24 | 192.168.1/24
99+
192.168.1.0/24 | 192.168.1/24
100+
10.0.0.0/8 | 10/8
101+
10.0.0.0/32 | 10.0.0.0/32
102+
10.1.2.3/32 | 10.1.2.3/32
103+
10.1.2.0/24 | 10.1.2/24
104+
10.1.0.0/16 | 10.1/16
105+
10.0.0.0/8 | 10/8
106+
10.0.0.0/8 | 10/8
107+
10.0.0.0/8 | 10/8
108+
10:23::f1/128 | 10:23::f1/128
109+
10:23::8000/113 | 10:23::8000/113
110+
::ffff:1.2.3.4/128 | ::ffff:1.2.3.4/128
111+
(17 rows)
112+
91113
SELECT c AS cidr, broadcast(c),
92114
i AS inet, broadcast(i) FROM INET_TBL;
93115
cidr | broadcast | inet | broadcast

src/test/regress/sql/inet.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ SELECT c AS cidr, i AS inet FROM INET_TBL;
3434
-- now test some support functions
3535

3636
SELECT i AS inet, host(i), text(i), family(i) FROM INET_TBL;
37+
SELECT c AS cidr, abbrev(c) FROM INET_TBL;
3738
SELECT c AS cidr, broadcast(c),
3839
i AS inet, broadcast(i) FROM INET_TBL;
3940
SELECT c AS cidr, network(c) AS "network(cidr)",

0 commit comments

Comments
 (0)