File: real_set.t

package info (click to toggle)
libset-intspan-perl 1.19-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 224 kB
  • sloc: perl: 1,236; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 846 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- perl -*-

use strict;
use Set::IntSpan 1.17;

my $N = 1;
sub Not { print "not " }
sub OK  { print "ok ", $N++, "\n" }

print "1..4\n";
print "#real_set\n";

my $set = new Set::IntSpan;
my $set_1 = union $set;
my $run_list_1 = run_list $set_1;

print "#real_set:  union set -> $run_list_1\n";
empty $set_1 or Not; OK;

my $set_2 = union $set "1-5,8-9";
my $set_3 = union $set $set_2;
my $set_4 = union $set +[1, 5, 2, 8, 9, 1, 3, 4, 9];

my $run_list_2 = run_list $set_2;
my $run_list_3 = run_list $set_3;
my $run_list_4 = run_list $set_4;

print "#real_set: $run_list_2 -> $run_list_3\n";
$set_2->equal($set_3) or Not; OK;

print "#real_set: $run_list_2 -> $run_list_4\n";
$set_2->equal($set_4) or Not; OK;

my $set_5 = union $set "0";
my $run_list_5 = run_list $set_5;
print "#real_set: $run_list_5 -> 0\n";
$run_list_5 eq "0" or Not; OK;