/[suikacvs]/messaging/manakai/t/util-formatter-boolean.t
Suika

Contents of /messaging/manakai/t/util-formatter-boolean.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download) (as text)
Sat Jan 17 08:27:53 2004 UTC (21 years, 3 months ago) by wakaba
Branch: MAIN
CVS Tags: before-dis2-200411, manakai-release-0-3-2, manakai-release-0-3-1, manakai-release-0-4-0, manakai-200612, HEAD
Branch point for: experimental-xml-parser-200401
File MIME type: application/x-troff
New test

1 wakaba 1.1 #!/usr/bin/perl -w
2     use strict;
3    
4     use Message::Util::Formatter::Boolean;
5     use Test;
6    
7     my $fmt = new Message::Util::Formatter::Boolean;
8    
9     plan tests => 69;
10    
11     ok $fmt->replace (q{}), undef, q(Empty format);
12     ok $fmt->replace (q{1}), 1, q(Bare text (true));
13     ok $fmt->replace (q{0}), 0, q(Bare text (false));
14     ok $fmt->replace (q{00}), 1, q(Bare text (true));
15     ok $fmt->replace (q{-0}), 1, q(Bare text (true));
16     ok $fmt->replace (q{ }), 1, q(Bare text (true));
17    
18     ok $fmt->replace (q{%and;}), undef, q(Empty %and);
19     ok $fmt->replace (q{%and; }), undef, q(Empty %and with bare text (true));
20     ok $fmt->replace (q{%and (1);}), 1, q(One item %and);
21     ok $fmt->replace (q{%and (0);}), 0, q(One item %and);
22     ok $fmt->replace (q{%and (1); }), 1, q(One item %and w/ bare text);
23     ok $fmt->replace (q{%and (0); }), 0, q(One item %and w/ bare text);
24     ok $fmt->replace (q{ %and (1);}), 1, q(One item %and w/ bare text);
25     ok $fmt->replace (q{ %and (0);}), 0, q(One item %and w/ bare text);
26     ok $fmt->replace (q{ %and (1); }), 1, q(One item %and w/ bare text);
27     ok $fmt->replace (q{ %and (0); }), 0, q(One item %and w/ bare text);
28     ok $fmt->replace (q{%and (1, 2);}), 1, q(%and w/ two items);
29     ok $fmt->replace (q{%and (1, 0);}), 0, q(%and w/ two items);
30     ok $fmt->replace (q{%and (0, 2);}), 0, q(%and w/ two items);
31     ok $fmt->replace (q{%and (0, 0);}), 0, q(%and w/ two items);
32     ok $fmt->replace (q{%and (-1, 2, 1);}), 1, q(%and w/ three items);
33     ok $fmt->replace (q{%and (1, 2, 0);}), 0, q(%and w/ three items);
34     ok $fmt->replace (q{%and (-1, 0, 1);}), 0, q(%and w/ three items);
35     ok $fmt->replace (q{%and (-1, 0, 0);}), 0, q(%and w/ three items);
36     ok $fmt->replace (q{%and (0, 2, 1);}), 0, q(%and w/ three items);
37     ok $fmt->replace (q{%and (0, 2, 0);}), 0, q(%and w/ three items);
38     ok $fmt->replace (q{%and (0, 0, 1);}), 0, q(%and w/ three items);
39     ok $fmt->replace (q{%and (0, 0, 0);}), 0, q(%and w/ three items);
40    
41     ok $fmt->replace (q{%or;}), undef, q(Empty %or);
42     ok $fmt->replace (q{%or (1);}), 1, q(One item %or);
43     ok $fmt->replace (q{%or (0);}), 0, q(One item %or);
44     ok $fmt->replace (q{%or (1); }), 1, q(One item %or w/ bare text);
45     ok $fmt->replace (q{%or (0); }), 0, q(One item %or w/ bare text);
46     ok $fmt->replace (q{ %or (1);}), 1, q(One item %or w/ bare text);
47     ok $fmt->replace (q{ %or (0);}), 0, q(One item %or w/ bare text);
48     ok $fmt->replace (q{ %or (1); }), 1, q(One item %or w/ bare text);
49     ok $fmt->replace (q{ %or (0); }), 0, q(One item %or w/ bare text);
50     ok $fmt->replace (q{%or (1, 2);}), 1, q(%and w/ two items);
51     ok $fmt->replace (q{%or (1, 0);}), 1, q(%or w/ two items);
52     ok $fmt->replace (q{%or (0, 2);}), 1, q(%or w/ two items);
53     ok $fmt->replace (q{%or (0, 0);}), 0, q(%or w/ two items);
54     ok $fmt->replace (q{%or (-1, 2, 1);}), 1, q(%or w/ three items);
55     ok $fmt->replace (q{%or (1, 2, 0);}), 1, q(%or w/ three items);
56     ok $fmt->replace (q{%or (-1, 0, 1);}), 1, q(%or w/ three items);
57     ok $fmt->replace (q{%or (-1, 0, 0);}), 1, q(%or w/ three items);
58     ok $fmt->replace (q{%or (0, 2, 1);}), 1, q(%or w/ three items);
59     ok $fmt->replace (q{%or (0, 2, 0);}), 1, q(%or w/ three items);
60     ok $fmt->replace (q{%or (0, 0, 1);}), 1, q(%or w/ three items);
61     ok $fmt->replace (q{%or (0, 0, 0);}), 0, q(%or w/ three items);
62    
63    
64     ok $fmt->replace (q{%or ({%and (1);}p, 1);}), 1;
65     ok $fmt->replace (q{%or ({%and (1);}p, {%and (1);}p);}), 1;
66     ok $fmt->replace (q{%or ({%and (1);}p, {%and (0);}p);}), 1;
67     ok $fmt->replace (q{%or ({%and (0);}p, {%and (1);}p);}), 1;
68     ok $fmt->replace (q{%or ({%and (0);}p, {%and (0);}p);}), 0;
69     ok $fmt->replace (q{%and ({%or (1);}p, 1);}), 1;
70     ok $fmt->replace (q{%and ({%or (1);}p, {%or (1);}p);}), 1;
71     ok $fmt->replace (q{%and ({%or (1);}p, {%or (0);}p);}), 0;
72     ok $fmt->replace (q{%and ({%or (0);}p, {%or (1);}p);}), 0;
73     ok $fmt->replace (q{%and ({%or (0);}p, {%or (0);}p);}), 0;
74     ok $fmt->replace (q{%and ({%or ({%and (1, 1);}p);}p, {%or (1);}p);}), 1;
75     ok $fmt->replace (q{%and ({%or ({%and (1, 0);}p);}p, {%or (1);}p);}), 0;
76    
77     ok $fmt->replace (q{%not;}), undef;
78     ok $fmt->replace (q{%not (1);}), 0;
79     ok $fmt->replace (q{%not (0);}), 1;
80     ok $fmt->replace (q{%not ({ });}), 0;
81     ok $fmt->replace (q{%not ({%and (1, 1);}p);}), 0;
82     ok $fmt->replace (q{%not ({%and (1, 0);}p);}), 1;
83     ok $fmt->replace (q{%not ({%or (1, 0);}p);}), 0;
84     ok $fmt->replace (q{%not ({%or (0, 0);}p);}), 1;
85    
86    
87    
88    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24