File: basic.svtest

package info (click to toggle)
dovecot 1%3A2.2.13-11
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 38,472 kB
  • sloc: ansic: 341,153; sh: 16,920; makefile: 5,385; cpp: 1,474; perl: 265; xml: 44; python: 34; pascal: 27
file content (178 lines) | stat: -rw-r--r-- 3,735 bytes parent folder | download | duplicates (12)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
require "vnd.dovecot.testsuite";

require "relational";
require "comparator-i;ascii-numeric";

/*
 * Test message
 */

test_set "message" text:
From: stephan@example.org
To: nico@frop.example.org
Cc: frop@example.org
CC: timo@example.org
X-Spam-Score: 300
X-Nonsense: 1000
X-Nonsense: 20
X-Alpha: abcdzyx
X-Count: a
X-Count: b
X-Count: c
X-Count: d
X-Count: e
X-Count: f
X-Count: g
X-Count: h
X-Count: i
X-Count: j
X-Count: k
X-Count: l
X-Count: m
X-Count: n
X-Count: o
X-Count: p
X-Count: q
X-Count: r
X-Count: s
X-Count: t
X-Count: u
X-Count: v
X-Count: w
X-Count: x
X-Count: y
X-Count: z
Subject: Test
Comment:

Test!
.
;

/*
 * Empty strings
 */

test "Value \"\" eq 40 (vs)" {
	if header :value "eq" :comparator "i;ascii-numeric" "comment" "40" {
		test_fail ":value matched empty string with i;ascii-numeric";
	}

	if header :value "gt" :comparator "i;ascii-numeric" "x-spam-score" "" {
		test_fail ":value 300 exceeded empty string with i;ascii-numeric";
	}

	if header :value "gt" :comparator "i;ascii-numeric" "x-spam-score" "" {
		test_fail ":count exceeded empty string with i;ascii-numeric";
	}
}

/*
 * Match type :value
 */

test "Value 300 eq 2" {
	if header :value "eq" :comparator "i;ascii-numeric" "x-spam-score" "2" {
		test_fail "should not have matched";
	}
}

test "Value 300 lt 2" {
	if header :value "lt" :comparator "i;ascii-numeric" "x-spam-score" "2" {
		test_fail "should not have matched";
	}
}

test "Value 300 le 300" {
	if not header :value "le" :comparator "i;ascii-numeric" "x-spam-score" "300" {
		test_fail "should have matched";
	}
}

test "Value 300 le 302" {
	if not header :value "le" :comparator "i;ascii-numeric" "x-spam-score" "302" {
		test_fail "should have matched";
	}
}

test "Value 302 le 00302" {
	if not header :value "le" :comparator "i;ascii-numeric" "x-spam-score" "00302" {
		test_fail "should have matched";
	}
}

test "Value {1000,20} le 300" {
	if not header :value "le" :comparator "i;ascii-numeric" "x-nonsense" "300" {
		test_fail "should have matched";
	}
}

test "Value {1000,20} lt 3" {
	if header :value "lt" :comparator "i;ascii-numeric" "x-nonsense" "3" {
		test_fail "should not have matched";
	}
}

test "Value {1000,20} gt 3000" {
	if header :value "gt" :comparator "i;ascii-numeric" "x-nonsense" "3000" {
		test_fail "should not have matched";
	}
}

test "Value {1000,20} gt {3000,30}" {
	if not header :value "gt" :comparator "i;ascii-numeric" "x-nonsense" ["3000","30"] {
		test_fail "should have matched";
	}
}

test "Value {1000,20} lt {3, 19})" {
	if header :value "lt" :comparator "i;ascii-numeric" "x-nonsense" ["3","19"] {
		test_fail "should not have matched";
	}
}

test "Value {1000,20} gt {3000,1001}" {
	if header :value "gt" :comparator "i;ascii-numeric" "x-nonsense" ["3000","1001"] {
		test_fail "should not have matched";
	}
}

test "Value abcdzyz gt aaaaaaa" {
	if not header :value "gt" :comparator "i;octet" "x-alpha" "aaaaaaa" {
		test_fail "should have matched";
	}
}

/*
 * Match type :count
 */

test "Count 2 ne 2" {
	if header :count "ne" :comparator "i;ascii-numeric" "cc" "2" {
		test_fail "should not have matched";
	}
}

test "Count 2 ge 2" {
	if not header :count "ge" :comparator "i;ascii-numeric" "cc" "2" {
		test_fail "should have matched";
	}
}

test "Count 2 ge 002" {
	if not header :count "ge" :comparator "i;ascii-numeric" "cc" "002" {
		test_fail "should have matched";
	}
}

test "Count 26 lt {4,5,6,10,20}" {
	if header :count "lt" :comparator "i;ascii-numeric" "x-count" ["4","5","6","10","20"] {
		test_fail "should not have matched";
	}
}

test "Count 26 lt {4,5,6,10,20,100}" {
	if not header :count "lt" :comparator "i;ascii-numeric" "x-count" ["4","5","6","10","20","100"] {
		test_fail "should have matched";
	}
}