1package # hide
2Data_Test_Arguments;
3
4use 5.10.0;
5use warnings;
6use strict;
7
8
9sub valid_values {
10    return {
11        beep         => [ 0, 1 ],
12        clear_screen => [ 0, 1 ],
13        hide_cursor  => [ 0, 1 ],
14        index        => [ 0, 1 ],
15        alignment    => [ 0, 1, 2 ],
16        layout       => [ 0, 1, 2, 3 ],
17        mouse        => [ 0, 1 ],
18        order        => [ 0, 1 ],
19        page         => [ 0, 1, 2],
20
21        # '[ 1-9 ][ 0-9 ]*'
22        keep       => [ 1, 2, 100, 999999, undef ],
23        ll         => [ 1, 2, 100, 999999, undef ],
24        max_height => [ 1, 2, 100, 999999, undef ],
25        max_width  => [ 1, 2, 100, 999999, undef ],
26
27        # '[ 0-9 ]+'
28        default     => [ 0, 1, 2, 100, 999999, undef ],
29        pad         => [ 0, 1, 2, 100, 999999, undef ],
30
31        # ''
32        empty  => [ 0, 'Hello' x 50, '', ' ', 'abc', 'world', undef ],
33        prompt => [ 0, 'Hello' x 50, '', ' ', 'abc', 'world', undef ],
34        undef  => [ 0, 'Hello' x 50, '', ' ', 'abc', 'world', undef ],
35
36        # ARRAY max 2 int
37        tabs_info   => [ [ 2, 4 ], [ 8 ], [], undef ],
38        tabs_prompt => [ [ 2, 4 ], [ 8 ], [], undef ],
39
40        # ARRAY int
41        mark        => [ [ 0, 1, 2, 100, 999999 ], [ 1 ], undef ],
42        no_spacebar => [ [ 0, 1, 2, 100, 999999 ], [ 1 ], undef ],
43    };
44}
45
46sub mixed_options_1 {
47    return {
48        beep  => 0, clear_screen => undef, hide_cursor => 1, index => 0, alignment => 0, layout => 0, mouse => 0,
49        order => 1, page => 0, keep => 1, ll => 1, max_height => 19, max_width => 19, default => 9, pad => 3,
50        empty => '', prompt => '', undef => '', tabs_info => [ 1 ], no_spacebar => [ 0 ], mark => [ 3, 4 ]
51    };
52}
53
54
55sub mixed_options_2 {
56    return {
57        mark => [ 0 ], no_spacebar => [ 11, 0, 8 ], tabs_prompt => [ 1, 1 ], undef => '', prompt => 'prompt_line', empty => '',
58        pad => 3, default => 9, max_width => 19, max_height => 119, ll => 15, keep => 1, page => 1, order => 1,
59        mouse => 1, layout => 3, alignment => 0, index => 0, hide_cursor => 1, clear_screen => undef, beep => 0,
60        tabs_prompt => [ 4, 4 ]
61    };
62}
63
64##################################################################################################
65
66sub invalid_values {
67    my @invalid = ( -1, 2, 2 .. 10, 999999, '01', '', 'a', { 1, 1 }, [ 1 ], [ 2 ] );
68    return{
69        beep         => [ grep { ! /^[ 0 1 ]\z/x }         @invalid ],
70        clear_screen => [ grep { ! /^[ 0 1 ]\z/x }         @invalid ],
71        hide_cursor  => [ grep { ! /^[ 0 1 ]\z/x }         @invalid ],
72        index        => [ grep { ! /^[ 0 1 ]\z/x }         @invalid ],
73        alignment    => [ grep { ! /^[ 0 1 2 ]\z/x }       @invalid ],
74        layout       => [ grep { ! /^[ 0 1 2 3 ]\z/x }     @invalid ],
75        mouse        => [ grep { ! /^[ 0 1 ]\z/x }         @invalid ],
76        order        => [ grep { ! /^[ 0 1 ]\z/x }         @invalid ],
77        page         => [ grep { ! /^[ 0 1 2 ]\z/x }         @invalid ],
78        keep         => [ grep { ! /^[ 1-9 ][ 0-9 ]*\z/x } @invalid ],
79        ll           => [ grep { ! /^[ 1-9 ][ 0-9 ]*\z/x } @invalid ],
80        max_height   => [ grep { ! /^[ 1-9 ][ 0-9 ]*\z/x } @invalid ],
81        max_width    => [ grep { ! /^[ 1-9 ][ 0-9 ]*\z/x } @invalid ],
82        default      => [ grep { ! /^[ 0-9 ]+\z/x }        @invalid ],
83        pad          => [ grep { ! /^[ 0-9 ]+\z/x }        @invalid ],
84
85        # ''
86        empty  => [ { 1, 1 }, [ 1 ], {}, [], [ 2 ] ],
87        prompt => [ { 1, 1 }, [ 1 ], {}, [], [ 2 ] ],
88        undef  => [ { 1, 1 }, [ 1 ], {}, [], [ 2 ] ],
89
90        # ARRAY max 2 int
91        tabs_info   => [ -2, -1, 0, 1, '', 'a', { 1, 1 }, {}, [ 1, 2, 's', ], [ 'a', 'b' ], [ -3, -4 ] ],
92        tabs_prompt => [ -2, -1, 0, 1, '', 'a', { 1, 1 }, {}, [ 1, 2, 'g', ], [ 'a', 'b' ], [ -3, -4 ] ],
93
94        # ARRAY int
95        mark        => [ -2, -1, 0, 1, '', 'a', { 1, 1 }, {}, [ 'a', 'b' ], [ -3, -4 ] ],
96        no_spacebar => [ -2, -1, 0, 1, '', 'a', { 1, 1 }, {}, [ 'a', 'b' ], [ -3, -4 ] ],
97    };
98}
99
100sub mixed_invalid_1 {
101    return {
102        beep  => -1, clear_screen => 2, hide_cursor => 3, index => 4, alignment => '@', layout => 5, mouse => {},
103        order => 1, page => 'l', keep => -1, ll => -1, max_height => 0, max_width => 0, default => [], pad => 'a',
104        empty => [], prompt => {}, undef => [], lf => 4, no_spacebar => 4, mark => 'o'
105    };
106}
107
108
109sub mixed_invalid_2 {
110    return {
111        mark => '', no_spacebar => 'a', lf => 'b', undef => [], prompt => {}, empty => {}, pad => 'd', default => 'e',
112        max_width => -1, max_height => -2, ll => -4, keep => -5, page => -6, order => -7, mouse => 'k', layout => 'e',
113        alignment => [], index => {}, hide_cursor => -1,  clear_screen => [], beep  => 10
114    };
115}
116
117
1181;
119
120__END__
121