summaryrefslogtreecommitdiff
path: root/libmailutils/tests/msgset.at
blob: a591afdc124d7b10c3e9864435b8258b222164d4 (plain)
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
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2011 Free Software Foundation, Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# GNU Mailutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.

AT_BANNER([Message sets])

dnl ------------------------------------------------------------------
dnl MSGSET([NAME], [KW = `'], [OP], [STDOUT = `'], [STDERR = `'])
dnl
m4_pushdef([MSGSET],[
AT_SETUP([$1])
AT_KEYWORDS([msgset $2])
AT_CHECK([msgset $3],[0],[$4],[$5])
AT_CLEANUP
])
dnl ------------------------------------------------------------------

MSGSET([Aggregation: simple],[msgset-aggr-simple msgset-aggr],
[-msgset='1,5:11,20:24,80:90,22:30,50:60,4:12,41:50,70:81'],
[1,4:12,20:30,41:60,70:90
])

MSGSET([Aggregation: open range (1)],
[msgset-aggr-open-1 msgset-aggr-open msgset-aggr],
[-msgset='12:*,1'],
[1,12:*
])

MSGSET([Aggregation: coalescing open ranges],
[msgset-aggr-open-2 msgset-aggr-open msgset-aggr],
[-msgset='12:*,1,15:*,8:*'],
[1,8:*
])

MSGSET([Aggregation: open range (3)],
[msgset-aggr-open-3 msgset-aggr-open msgset-aggr],
[-msgset='1,12:*,12:13'],
[1,12:*
])

MSGSET([Aggregation: open range (4)],
[msgset-aggr-open-4 msgset-aggr-open msgset-aggr],
[-msgset='1,12:*,13:40'],
[1,12:*
])

MSGSET([Aggregation: open range (5)],
[msgset-aggr-open-5 msgset-aggr-open msgset-aggr],
[-msgset='10:*,3,5:9'],
[3,5:*
])

MSGSET([Create simple set],[msgset-simple msgset-add],
[-add=1:10],
[1:10
])

MSGSET([Create complex set],[msgset-complex msgset-add],
[-add=1 -add=2 -add=3 -add=4 -add=10:20 -add=15:35 -add=36:40],
[1:4,10:40
])

MSGSET([Subtract: no match],[msgset-sub msgset-sub-1],
[-msgset=20:40 -sub=1:10],
[20:40
])

MSGSET([Subtract: exact match],[msgset-sub msgset-sub-2],
[-msgset=1,4:9,11 -sub=4:9],
[1,11
])

MSGSET([Subtract: contained range],[msgset-sub msgset-sub-3],
[-msgset=1:40 -sub=5:15
],
[1:4,16:40
])

MSGSET([Subtract: contained range (left border case)],
[msgset-sub msgset-sub-3 msgset-sub-3-0],
[-msgset=1:40 -sub=1:20],
[21:40
])

MSGSET([Subtract: contained range (right border case)],
[msgset-sub msgset-sub-3 msgset-sub-3-1],
[-msgset=1:40 -sub=30:40],
[1:29
])

MSGSET([Subtract: initial subrange],[msgset-sub msgset-sub-4],
[-msgset=1:40,50:60,80:200 -sub=55:65],
[1:40,50:54,80:200
])

MSGSET([Subtract: trailing subrange],[msgset-sub msgset-sub-5],
[-msgset=1:40,50:60,80:200 -sub=45:55],
[1:40,56:60,80:200
])

MSGSET([Subtract: overlapping subrange],[msgset-sub msgset-sub-6],
[-msgset=1:40,50:60,80:200 -sub=41:70],
[1:40,80:200
])

MSGSET([Subtract: 4, 5 and 6 combined],
[msgset-sub msgset-sub-4 msgset-sub-5 msgset-sub-6 msgset-sub-456],
[-msgset=1:40,50:60,80:200 -sub=30:100],
[1:29,101:200
])

MSGSET([open range],[msgset-inf],
[-msgset='1:*'],
[1:*
])

MSGSET([add to open range],[msgset-inf-add msgset-add],
[-msgset='10:*' -add=3 -add=5:9],
[3,5:*
])

MSGSET([subtract from open range],[msgset-inf-sub msgset-sub],
[-msgset='3,10:*' -sub=5:11],
[3,12:*
])

MSGSET([subtract from open range an equal range],[msgset-inf-sub-1 msgset-sub],
[-msgset='3,10:*' -sub=10:*],
[3
])

MSGSET([subtract from open range a broader range],
[msgset-inf-sub-2 msgset-sub],
[-msgset='3,10:*' -sub=20:*],
[3,10:*
])

MSGSET([subtract from open range a narrower range],
[msgset-inf-sub-3 msgset-sub],
[-msgset='3,10:*' -sub=5:*],
[3
])

MSGSET([subtract an open range with matching left boundary],
[msgset-inf-sub-4 msgset-sub],
[-msgset='3,10:20' -sub=10:*],
[3
])

MSGSET([subtract an open range with greater left boundary],
[msgset-inf-sub-4 msgset-sub],
[-msgset='3,10:20' -sub=11:*],
[3,10:20
])

MSGSET([subtract an open range with smaller left boundary],
[msgset-inf-sub-4 msgset-sub],
[-msgset='3,10:20' -sub=8:*],
[3
])

dnl ------------------------------------------------------------------
m4_popdef([MSGSET])

Return to:

Send suggestions and report system problems to the System administrator.