Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6954537

Browse files
author
Thomas G. Lockhart
committed
Add new inet/cidr regression test.
All regression tests pass on Linux/i686 with the current source tree.
1 parent0ebb238 commit6954537

File tree

4 files changed

+138
-1
lines changed

4 files changed

+138
-1
lines changed

‎src/test/regress/expected/inet.out

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
QUERY: DROP TABLE INET_TBL;
2+
ERROR: Relation inet_tbl Does Not Exist!
3+
QUERY: CREATE TABLE INET_TBL (c cidr, i inet);
4+
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('192.168.1', '192.168.1.226/24');
5+
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/24', '192.168.1.226');
6+
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8');
7+
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.0.0.0', '10.1.2.3/8');
8+
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1.2.3', '10.1.2.3/32');
9+
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1.2', '10.1.2.3/24');
10+
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10.1', '10.1.2.3/16');
11+
QUERY: INSERT INTO INET_TBL (c, i) VALUES ('10', '10.1.2.3/8');
12+
QUERY: SELECT '' as eight, c as cidr, i as inet FROM INET_TBL;
13+
eight|cidr |inet
14+
-----+------------+----------------
15+
|192.168.1/24|192.168.1.226/24
16+
|192.168.1/24|192.168.1.226
17+
|10/8 |10.1.2.3/8
18+
|10.0.0.0/32 |10.1.2.3/8
19+
|10.1.2.3/32 |10.1.2.3
20+
|10.1.2/24 |10.1.2.3/24
21+
|10.1/16 |10.1.2.3/16
22+
|10/8 |10.1.2.3/8
23+
(8 rows)
24+
25+
QUERY: SELECT '' as eight, i as inet, host(i) FROM INET_TBL;
26+
eight|inet | host
27+
-----+----------------+-------------
28+
|192.168.1.226/24|192.168.1.226
29+
|192.168.1.226 |192.168.1.226
30+
|10.1.2.3/8 | 10.1.2.3
31+
|10.1.2.3/8 | 10.1.2.3
32+
|10.1.2.3 | 10.1.2.3
33+
|10.1.2.3/24 | 10.1.2.3
34+
|10.1.2.3/16 | 10.1.2.3
35+
|10.1.2.3/8 | 10.1.2.3
36+
(8 rows)
37+
38+
QUERY: SELECT '' as eight, c as cidr, broadcast(c),
39+
i as inet, broadcast(i) FROM INET_TBL;
40+
eight|cidr | broadcast|inet | broadcast
41+
-----+------------+---------------+----------------+---------------
42+
|192.168.1/24| 192.168.1.255|192.168.1.226/24| 192.168.1.255
43+
|192.168.1/24| 192.168.1.255|192.168.1.226 |255.255.255.255
44+
|10/8 | 10.255.255.255|10.1.2.3/8 | 10.255.255.255
45+
|10.0.0.0/32 |255.255.255.255|10.1.2.3/8 | 10.255.255.255
46+
|10.1.2.3/32 |255.255.255.255|10.1.2.3 |255.255.255.255
47+
|10.1.2/24 | 10.1.2.255|10.1.2.3/24 | 10.1.2.255
48+
|10.1/16 | 10.1.255.255|10.1.2.3/16 | 10.1.255.255
49+
|10/8 | 10.255.255.255|10.1.2.3/8 | 10.255.255.255
50+
(8 rows)
51+
52+
QUERY: SELECT '' as eight, c as cidr, network(c) as "network(cidr)",
53+
i as inet, network(i) as "network(inet)" FROM INET_TBL;
54+
eight|cidr |network(cidr)|inet |network(inet)
55+
-----+------------+-------------+----------------+-------------
56+
|192.168.1/24| 0.1.168.192|192.168.1.226/24| 0.1.168.192
57+
|192.168.1/24| 0.1.168.192|192.168.1.226 |226.1.168.192
58+
|10/8 | 0.0.0.10|10.1.2.3/8 | 0.0.0.10
59+
|10.0.0.0/32 | 0.0.0.10|10.1.2.3/8 | 0.0.0.10
60+
|10.1.2.3/32 | 3.2.1.10|10.1.2.3 | 3.2.1.10
61+
|10.1.2/24 | 0.2.1.10|10.1.2.3/24 | 0.2.1.10
62+
|10.1/16 | 0.0.1.10|10.1.2.3/16 | 0.0.1.10
63+
|10/8 | 0.0.0.10|10.1.2.3/8 | 0.0.0.10
64+
(8 rows)
65+
66+
QUERY: SELECT '' as eight, c as cidr, masklen(c) as "masklen(cidr)",
67+
i as inet, masklen(i) as "masklen(inet)" FROM INET_TBL;
68+
eight|cidr |masklen(cidr)|inet |masklen(inet)
69+
-----+------------+-------------+----------------+-------------
70+
|192.168.1/24| 24|192.168.1.226/24| 24
71+
|192.168.1/24| 24|192.168.1.226 | 32
72+
|10/8 | 8|10.1.2.3/8 | 8
73+
|10.0.0.0/32 | 32|10.1.2.3/8 | 8
74+
|10.1.2.3/32 | 32|10.1.2.3 | 32
75+
|10.1.2/24 | 24|10.1.2.3/24 | 24
76+
|10.1/16 | 16|10.1.2.3/16 | 16
77+
|10/8 | 8|10.1.2.3/8 | 8
78+
(8 rows)
79+
80+
QUERY: SELECT '' as two, c as cidr, masklen(c) as "masklen(cidr)",
81+
i as inet, masklen(i) as "masklen(inet)" FROM INET_TBL
82+
WHERE masklen(c) <= 8;
83+
two|cidr|masklen(cidr)|inet |masklen(inet)
84+
---+----+-------------+----------+-------------
85+
|10/8| 8|10.1.2.3/8| 8
86+
|10/8| 8|10.1.2.3/8| 8
87+
(2 rows)
88+
89+
QUERY: SELECT '' as six, c as cidr, i as inet FROM INET_TBL
90+
WHERE c = i;
91+
six|cidr |inet
92+
---+------------+----------------
93+
|192.168.1/24|192.168.1.226/24
94+
|10/8 |10.1.2.3/8
95+
|10.1.2.3/32 |10.1.2.3
96+
|10.1.2/24 |10.1.2.3/24
97+
|10.1/16 |10.1.2.3/16
98+
|10/8 |10.1.2.3/8
99+
(6 rows)
100+

‎src/test/regress/output/misc.source

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ hash_txt_heap
481481
hobbies_r
482482
iexit
483483
ihighway
484+
inet_tbl
484485
insert_seq
485486
insert_tbl
486487
int2_tbl
@@ -513,5 +514,5 @@ tinterval_tbl
513514
toyemp
514515
varchar_tbl
515516
xacttest
516-
(71 rows)
517+
(72 rows)
517518

‎src/test/regress/sql/inet.sql

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
-- INET regression tests
2+
--
3+
4+
-- prepare the table...
5+
6+
DROPTABLE INET_TBL;
7+
CREATETABLEINET_TBL (ccidr, iinet);
8+
INSERT INTO INET_TBL (c, i)VALUES ('192.168.1','192.168.1.226/24');
9+
INSERT INTO INET_TBL (c, i)VALUES ('192.168.1.2/24','192.168.1.226');
10+
INSERT INTO INET_TBL (c, i)VALUES ('10','10.1.2.3/8');
11+
INSERT INTO INET_TBL (c, i)VALUES ('10.0.0.0','10.1.2.3/8');
12+
INSERT INTO INET_TBL (c, i)VALUES ('10.1.2.3','10.1.2.3/32');
13+
INSERT INTO INET_TBL (c, i)VALUES ('10.1.2','10.1.2.3/24');
14+
INSERT INTO INET_TBL (c, i)VALUES ('10.1','10.1.2.3/16');
15+
INSERT INTO INET_TBL (c, i)VALUES ('10','10.1.2.3/8');
16+
17+
SELECT''as eight, cascidr, iasinetFROM INET_TBL;
18+
19+
-- now test some support functions
20+
21+
SELECT''as eight, iasinet, host(i)FROM INET_TBL;
22+
SELECT''as eight, cascidr, broadcast(c),
23+
iasinet, broadcast(i)FROM INET_TBL;
24+
SELECT''as eight, cascidr, network(c)as"network(cidr)",
25+
iasinet, network(i)as"network(inet)"FROM INET_TBL;
26+
SELECT''as eight, cascidr, masklen(c)as"masklen(cidr)",
27+
iasinet, masklen(i)as"masklen(inet)"FROM INET_TBL;
28+
29+
SELECT''as two, cascidr, masklen(c)as"masklen(cidr)",
30+
iasinet, masklen(i)as"masklen(inet)"FROM INET_TBL
31+
WHERE masklen(c)<=8;
32+
33+
SELECT''as six, cascidr, iasinetFROM INET_TBL
34+
WHERE c= i;
35+

‎src/test/regress/sql/tests

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ reltime
2424
abstime
2525
tinterval
2626
horology
27+
inet
2728
comments
2829
create_function_1
2930
create_type

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp