1
require "vnd.dovecot.testsuite";
4
require "comparator-i;ascii-numeric";
10
test_set "message" text:
11
From: stephan@rename-it.nl
12
To: nico@vestingbar.nl
56
test "Value \"\" eq 40 (vs)" {
57
if header :value "eq" :comparator "i;ascii-numeric" "comment" "40" {
58
test_fail ":value matched empty string with i;ascii-numeric";
61
if header :value "gt" :comparator "i;ascii-numeric" "x-spam-score" "" {
62
test_fail ":value 300 exceeded empty string with i;ascii-numeric";
65
if header :value "gt" :comparator "i;ascii-numeric" "x-spam-score" "" {
66
test_fail ":count exceeded empty string with i;ascii-numeric";
74
test "Value 300 eq 2" {
75
if header :value "eq" :comparator "i;ascii-numeric" "x-spam-score" "2" {
76
test_fail "should not have matched";
80
test "Value 300 lt 2" {
81
if header :value "lt" :comparator "i;ascii-numeric" "x-spam-score" "2" {
82
test_fail "should not have matched";
86
test "Value 300 le 300" {
87
if not header :value "le" :comparator "i;ascii-numeric" "x-spam-score" "300" {
88
test_fail "should have matched";
92
test "Value 300 le 302" {
93
if not header :value "le" :comparator "i;ascii-numeric" "x-spam-score" "302" {
94
test_fail "should have matched";
98
test "Value 302 le 00302" {
99
if not header :value "le" :comparator "i;ascii-numeric" "x-spam-score" "00302" {
100
test_fail "should have matched";
104
test "Value {1000,20} le 300" {
105
if not header :value "le" :comparator "i;ascii-numeric" "x-nonsense" "300" {
106
test_fail "should have matched";
110
test "Value {1000,20} lt 3" {
111
if header :value "lt" :comparator "i;ascii-numeric" "x-nonsense" "3" {
112
test_fail "should not have matched";
116
test "Value {1000,20} gt 3000" {
117
if header :value "gt" :comparator "i;ascii-numeric" "x-nonsense" "3000" {
118
test_fail "should not have matched";
122
test "Value {1000,20} gt {3000,30}" {
123
if not header :value "gt" :comparator "i;ascii-numeric" "x-nonsense" ["3000","30"] {
124
test_fail "should have matched";
128
test "Value {1000,20} lt {3, 19})" {
129
if header :value "lt" :comparator "i;ascii-numeric" "x-nonsense" ["3","19"] {
130
test_fail "should not have matched";
134
test "Value {1000,20} gt {3000,1001}" {
135
if header :value "gt" :comparator "i;ascii-numeric" "x-nonsense" ["3000","1001"] {
136
test_fail "should not have matched";
140
test "Value abcdzyz gt aaaaaaa" {
141
if not header :value "gt" :comparator "i;octet" "x-alpha" "aaaaaaa" {
142
test_fail "should have matched";
150
test "Count 2 ne 2" {
151
if header :count "ne" :comparator "i;ascii-numeric" "cc" "2" {
152
test_fail "should not have matched";
156
test "Count 2 ge 2" {
157
if not header :count "ge" :comparator "i;ascii-numeric" "cc" "2" {
158
test_fail "should have matched";
162
test "Count 2 ge 002" {
163
if not header :count "ge" :comparator "i;ascii-numeric" "cc" "002" {
164
test_fail "should have matched";
168
test "Count 26 lt {4,5,6,10,20}" {
169
if header :count "lt" :comparator "i;ascii-numeric" "x-count" ["4","5","6","10","20"] {
170
test_fail "should not have matched";
174
test "Count 26 lt {4,5,6,10,20,100}" {
175
if not header :count "lt" :comparator "i;ascii-numeric" "x-count" ["4","5","6","10","20","100"] {
176
test_fail "should have matched";