pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedsmall test case for abbrev(cidr)
2+ messages / 2 participants
[nested] [flat]
Commits from this thread:
2021-02-11 69273c8f88 Add test case for abbrev(cidr)
* small test case for abbrev(cidr)
@ 2021-02-08 18:40 Peter Eisentraut <peter.eisentraut@enterprisedb.com>
0 siblings, 1 reply; 2+ messages in thread
From: Peter Eisentraut @ 2021-02-08 18:40 UTC (permalink / raw)
To: pgsql-hackers
I noticed that the file src/backend/utils/adt/inet_cidr_ntop.c has no
test coverage at all. The only way to reach this appears to be by
calling abbrev(cidr). It was easy to add a test case for this into the
existing, otherwise pretty complete, cidr tests.
Attachments:
0001-Add-test-case-for-abbrev-cidr.patch (text/plain, 2.2K) download
From 4bba4782c81ec6cab3d85e045abc89a85092e2d0 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Mon, 8 Feb 2021 15:03:49 +0100
Subject: [PATCH] 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.
---
src/test/regress/expected/inet.out | 22 ++++++++++++++++++++++
src/test/regress/sql/inet.sql | 1 +
2 files changed, 23 insertions(+)
diff --git a/src/test/regress/expected/inet.out b/src/test/regress/expected/inet.out
index 298af7e913..d5bf9e2aaa 100644
--- a/src/test/regress/expected/inet.out
+++ b/src/test/regress/expected/inet.out
@@ -88,6 +88,28 @@ SELECT i AS inet, host(i), text(i), family(i) FROM INET_TBL;
::4.3.2.1/24 | ::4.3.2.1 | ::4.3.2.1/24 | 6
(17 rows)
+SELECT c AS cidr, abbrev(c) FROM INET_TBL;
+ cidr | abbrev
+--------------------+--------------------
+ 192.168.1.0/24 | 192.168.1/24
+ 192.168.1.0/26 | 192.168.1.0/26
+ 192.168.1.0/24 | 192.168.1/24
+ 192.168.1.0/24 | 192.168.1/24
+ 192.168.1.0/24 | 192.168.1/24
+ 192.168.1.0/24 | 192.168.1/24
+ 10.0.0.0/8 | 10/8
+ 10.0.0.0/32 | 10.0.0.0/32
+ 10.1.2.3/32 | 10.1.2.3/32
+ 10.1.2.0/24 | 10.1.2/24
+ 10.1.0.0/16 | 10.1/16
+ 10.0.0.0/8 | 10/8
+ 10.0.0.0/8 | 10/8
+ 10.0.0.0/8 | 10/8
+ 10:23::f1/128 | 10:23::f1/128
+ 10:23::8000/113 | 10:23::8000/113
+ ::ffff:1.2.3.4/128 | ::ffff:1.2.3.4/128
+(17 rows)
+
SELECT c AS cidr, broadcast(c),
i AS inet, broadcast(i) FROM INET_TBL;
cidr | broadcast | inet | broadcast
diff --git a/src/test/regress/sql/inet.sql b/src/test/regress/sql/inet.sql
index 23e5b93e69..d2ac85bb7f 100644
--- a/src/test/regress/sql/inet.sql
+++ b/src/test/regress/sql/inet.sql
@@ -34,6 +34,7 @@ CREATE TABLE INET_TBL (c cidr, i inet);
-- now test some support functions
SELECT i AS inet, host(i), text(i), family(i) FROM INET_TBL;
+SELECT c AS cidr, abbrev(c) FROM INET_TBL;
SELECT c AS cidr, broadcast(c),
i AS inet, broadcast(i) FROM INET_TBL;
SELECT c AS cidr, network(c) AS "network(cidr)",
--
2.30.0
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: small test case for abbrev(cidr)
@ 2021-02-08 19:29 Tom Lane <tgl@sss.pgh.pa.us>
parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2021-02-08 19:29 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: pgsql-hackers
Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> I noticed that the file src/backend/utils/adt/inet_cidr_ntop.c has no
> test coverage at all. The only way to reach this appears to be by
> calling abbrev(cidr). It was easy to add a test case for this into the
> existing, otherwise pretty complete, cidr tests.
Seems reasonable.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2021-02-08 19:29 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08 18:40 small test case for abbrev(cidr) Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2021-02-08 19:29 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox