File: props.t

package info (click to toggle)
libtest-lectrotest-perl 0.5001-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 412 kB
  • sloc: perl: 1,808; sh: 13; makefile: 6
file content (74 lines) | stat: -rwxr-xr-x 1,457 bytes parent folder | download | duplicates (6)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#! perl

# the following tests exercise properties
# within the default LT harness


use Test::LectroTest trials => 10;

my $intgen = Int;

Property {
    ##[ ]##
    1;
}, name => "0-arg always succeeds" ;

Property {
    ##[ #]##
    1;
}, name => "0-arg, alt-syntax always succeeds" ;

Property {
    ##[ x <- $intgen ]##
    $tcon->label("negative") if $x < 0;
    $tcon->label("odd")      if $x % 2;
    1;
}, name => "1-arg always succeeds (labels, too)" ;

Property {
    ##[ 
        x <- $intgen
    #]##
    1;
}, name => "1-arg, alt-syntax always succeeds" ;

Property {
    ##[ 
        x <- $intgen
    # ]##
    1;
}, name => "1-arg, alt2-syntax always succeeds" ;

Property {
    ##[ 
        x <- $intgen
    ####]##
    1;
}, name => "1-arg, alt3-syntax always succeeds" ;

Property {
    ##[ 
        x <- $intgen
    #### ]##
    1;
}, name => "1-arg, alt4-syntax always succeeds" ;

Property {
    ##[ x <- Float, y <- Int ]##
    1;
}, name => "2-arg always succeeds" ;

Property {
    ##[ x <- Unit(1), a <- Unit(2), c <- Unit(3), y <-Unit(4) ]##
    $x == 1 && $a == 2 && $c == 3 && $y == 4;
}, name => "argument order is preserved";

Property {
    ##[ r <- Unit(1), a <- Unit(2), w <- Unit(3), t <-Unit(4) ]##
    $r == 1 && $a == 2 && $w == 3 && $t == 4;
}, name => "argument order is preserved (2)";

Property {
    ##[ f <- Float ]##
    $tcon->dump( $f, "f" ) == $f;
}, name => "tcon->dump returns its value arg as its result";