File: hosts_contains.sql

package info (click to toggle)
pg-gvm 22.6.11-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 416 kB
  • sloc: ansic: 574; sql: 201; sh: 30; makefile: 12
file content (17 lines) | stat: -rw-r--r-- 586 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-- Start transaction and plan the tests.
BEGIN;

-- IMPORTANT! See https://pgtap.org/documentation.html#iloveitwhenaplancomestogether
SELECT plan(3);

-- Run the tests.
-- Test with empty input
SELECT is(hosts_contains('',''), false, 'Empty input should return false.');

SELECT is(hosts_contains('192.168.123.1-192.168.123.20, 192.168.123.30', '192.168.123.10'), true, 'Should return true');

SELECT is(hosts_contains('192.168.123.1-192.168.123.20, 192.168.123.30',  '192.168.10.20'), false, 'Should return false');

-- Finish the tests and clean up.
SELECT * FROM finish();
ROLLBACK;