-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion-comparison-tests.txt
362 lines (303 loc) · 7.62 KB
/
version-comparison-tests.txt
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# SPDX-FileCopyrightText: 2024 Dmitry Marakasov <[email protected]>
# SPDX-License-Identifier: CC0-1.0
#
# Comprehensive test suite for version string comparison algorithms
#
# The format is intended to be plain text, human readable and more or
# less easily parsable to be used in test suite of any version string
# comparison algorithm/library. It may either be used directly of
# after conversion into another machine readable format (json currently
# supported).
#
# File syntax:
# - Lines starting with # are comments and should be ignored
# - Blank lines should be ignored
# - Lines starting with [ and ending with ] denote sections
# - Other lines are test cases in format "version1" "relation sign"
# "version2" where both versions are double quoted, relation sign is
# one of < (less than), = (equals), and > (greater than), and these
# are delimited with single space characters.
# - Relations may include additional one letter flags from the list:
# p - handle single `p` letter encountered in a version as post-release
# keyword ("p is patch")
# a - handle any unknown letter sequence encountered in a version string
# as post-release keyword ("any is patch")
# l - treat version as minimal possible version is the corresponding
# branch ("lower bound")
# u - treat version as maximal possible version is the corresponding
# branch ("lower bound")
# These flags may be added at the left or at the right of relation sign,
# denoting that they affect corresponding (left hand side or right hand
# side) version string. If new flags are introduced which affect
# comparison as a whole and not specific side, these may be added at
# the any side.
#
# Each case is expected to be symmetric (and should be checked both ways
# by test suite consumers), so there's no need to add explicit "b > a"
# cases for each "a < b".
#
# Test suite consumers may ignore section headers if they don't handle them.
# However, these may be used to exclude specific features (not supported by
# corresponding implementation) from testing.
#
# Test suite consumers may ignore any comparison flags, cases involving
# these flags or corresponding sections.
#
# Version comparison algorithm implementors are welcome to suggest new flags
# and test sections. Not supporing implementations are free to ignore these.
[equality]
"0" = "0"
"0a" = "0a"
"a" = "a"
"a0" = "a0"
"0a1" = "0a1"
"0a1b2" = "0a1b2"
"1alpha1" = "1alpha1"
"foo" = "foo"
"1.2.3" = "1.2.3"
"hello.world" = "hello.world"
[different number of components]
"1" = "1.0"
"1" = "1.0.0"
"1.0" = "1.0.0"
"1.0" = "1.0.0.0.0.0.0.0"
[leading zeroes]
"00100.00100" = "100.100"
"0" = "00000000000000000"
[simple comparisons]
"0.0.0" < "0.0.1"
"0.0.1" < "0.0.2"
"0.0.2" < "0.0.10"
"0.0.2" < "0.1.0"
"0.0.10" < "0.1.0"
"0.1.0" < "0.1.1"
"0.1.1" < "1.0.0"
"1.0.0" < "10.0.0"
"10.0.0" < "100.0.0"
"10.10000.10000" < "11.0.0"
[long numbers]
"20160101" < "20160102"
"999999999999999999" < "1000000000000000000"
[very long numbers]
"99999999999999999999999999999999999998" < "99999999999999999999999999999999999999"
[letter addendum]
"1.0" < "1.0a"
"1.0a" < "1.0b"
"1.0b" < "1.1"
[letter versus number]
"a" < "0"
"1.a" < "1.0"
[single letter component]
"1.0.a" < "1.0.b"
"1.0.b" < "1.0.c"
"1.0.c" < "1.0"
"1.0.c" < "1.0.0"
[letter component split]
"1.0a0" = "1.0.a0"
"1.0beta3" = "1.0.b3"
[case is ignored]
"a" = "A"
"1alpha" = "1ALPHA"
"alpha1" = "ALPHA1"
[strings are shortened to one letter]
"a" = "alpha"
"b" = "beta"
"p" = "prerelease"
[unusial component separators]
"1.0.alpha.2" = "1_0_alpha_2"
"1.0.alpha.2" = "1-0-alpha-2"
"1.0.alpha.2" = "1,0:alpha~2"
[multiple consequentional separators]
"..1....2....3.." = "1.2.3"
".-~1~-.-~2~-." = "1.2"
".,:;~+-_" = "0"
[empty string]
"" = ""
"" = "0"
"" < "1"
[prerelease sequence]
# XXX: is rc/pre ordering defined?
"1.0alpha1" < "1.0alpha2"
"1.0alpha2" < "1.0beta1"
"1.0beta1" < "1.0beta2"
"1.0beta2" < "1.0rc1"
"1.0beta2" < "1.0pre1"
"1.0rc1" < "1.0"
"1.0pre1" < "1.0"
"1.0.alpha1" < "1.0.alpha2"
"1.0.alpha2" < "1.0.beta1"
"1.0.beta1" < "1.0.beta2"
"1.0.beta2" < "1.0.rc1"
"1.0.beta2" < "1.0.pre1"
"1.0.rc1" < "1.0"
"1.0.pre1" < "1.0"
"1.0alpha.1" < "1.0alpha.2"
"1.0alpha.2" < "1.0beta.1"
"1.0beta.1" < "1.0beta.2"
"1.0beta.2" < "1.0rc.1"
"1.0beta.2" < "1.0pre.1"
"1.0rc.1" < "1.0"
"1.0pre.1" < "1.0"
"1.0.alpha.1" < "1.0.alpha.2"
"1.0.alpha.2" < "1.0.beta.1"
"1.0.beta.1" < "1.0.beta.2"
"1.0.beta.2" < "1.0.rc.1"
"1.0.beta.2" < "1.0.pre.1"
"1.0.rc.1" < "1.0"
"1.0.pre.1" < "1.0"
[long word awareness]
# this should not be treated as 1.0a-1
"1.0alpha-1" > "0.9"
"1.0alpha-1" < "1.0"
"1.0alpha-1" < "1.0.1"
"1.0alpha-1" < "1.1"
"1.0beta-1" > "0.9"
"1.0beta-1" < "1.0"
"1.0beta-1" < "1.0.1"
"1.0beta-1" < "1.1"
"1.0pre-1" > "0.9"
"1.0pre-1" < "1.0"
"1.0pre-1" < "1.0.1"
"1.0pre-1" < "1.1"
"1.0prerelease-1" > "0.9"
"1.0prerelease-1" < "1.0"
"1.0prerelease-1" < "1.0.1"
"1.0prerelease-1" < "1.1"
"1.0rc-1" > "0.9"
"1.0rc-1" < "1.0"
"1.0rc-1" < "1.0.1"
"1.0rc-1" < "1.1"
[post-release keyword awareness]
# this should not be treated as 1.0a-1
"1.0patch1" > "0.9"
"1.0patch1" > "1.0"
"1.0patch1" < "1.0.1"
"1.0patch1" < "1.1"
"1.0.patch1" > "0.9"
"1.0.patch1" > "1.0"
"1.0.patch1" < "1.0.1"
"1.0.patch1" < "1.1"
"1.0patch.1" > "0.9"
"1.0patch.1" > "1.0"
"1.0patch.1" < "1.0.1"
"1.0patch.1" < "1.1"
"1.0.patch.1" > "0.9"
"1.0.patch.1" > "1.0"
"1.0.patch.1" < "1.0.1"
"1.0.patch.1" < "1.1"
"1.0post1" > "0.9"
"1.0post1" > "1.0"
"1.0post1" < "1.0.1"
"1.0post1" < "1.1"
"1.0postanythinggoeshere1" > "0.9"
"1.0postanythinggoeshere1" > "1.0"
"1.0postanythinggoeshere1" < "1.0.1"
"1.0postanythinggoeshere1" < "1.1"
"1.0pl1" > "0.9"
"1.0pl1" > "1.0"
"1.0pl1" < "1.0.1"
"1.0pl1" < "1.1"
"1.0errata1" > "0.9"
"1.0errata1" > "1.0"
"1.0errata1" < "1.0.1"
"1.0errata1" < "1.1"
[p is patch flag]
"1.0p1" = "1.0p1"
"1.0p1" p=p "1.0p1"
"1.0p1" p> "1.0p1"
"1.0p1" <p "1.0p1"
"1.0p1" = "1.0P1"
"1.0p1" p=p "1.0P1"
"1.0" > "1.0p1"
"1.0" p> "1.0p1"
"1.0" <p "1.0p1"
"1.0" > "1.0.p1"
"1.0" p> "1.0.p1"
"1.0" <p "1.0.p1"
"1.0" > "1.0.p.1"
"1.0" p> "1.0.p.1"
"1.0" <p "1.0.p.1"
# this case is not affected
"1.0" < "1.0p.1"
"1.0" p< "1.0p.1"
"1.0" <p "1.0p.1"
[any is patch flag]
"1.0a1" = "1.0a1"
"1.0a1" a=a "1.0a1"
"1.0a1" a> "1.0a1"
"1.0a1" <a "1.0a1"
"1.0" > "1.0a1"
"1.0" a> "1.0a1"
"1.0" <a "1.0a1"
"1.0" > "1.0.a1"
"1.0" a> "1.0.a1"
"1.0" <a "1.0.a1"
"1.0" > "1.0.a.1"
"1.0" a> "1.0.a.1"
"1.0" <a "1.0.a.1"
# this case is not affected
"1.0" < "1.0a.1"
"1.0" a< "1.0a.1"
"1.0" <a "1.0a.1"
[p/patch compatibility]
"1.0p1" = "1.0pre1"
"1.0p1" < "1.0patch1"
"1.0p1" < "1.0post1"
"1.0p1" p>p "1.0pre1"
"1.0p1" p=p "1.0patch1"
"1.0p1" p=p "1.0post1"
[prerelease words without numbers]
"1.0alpha" < "1.0"
"1.0.alpha" < "1.0"
"1.0beta" < "1.0"
"1.0.beta" < "1.0"
"1.0rc" < "1.0"
"1.0.rc" < "1.0"
"1.0pre" < "1.0"
"1.0.pre" < "1.0"
"1.0prerelese" < "1.0"
"1.0.prerelese" < "1.0"
"1.0patch" > "1.0"
"1.0.patch" > "1.0"
[release bounds]
"0.99999" < "1.0"
"1.0alpha" < "1.0"
"1.0alpha0" < "1.0"
"1.0" = "1.0"
"1.0patch" > "1.0"
"1.0patch0" > "1.0"
"1.0.1" > "1.0"
"1.1" > "1.0"
"0.99999" <l "1.0"
"1.0alpha" >l "1.0"
"1.0alpha0" >l "1.0"
"1.0" >l "1.0"
"1.0patch" >l "1.0"
"1.0patch0" >l "1.0"
"1.0a" >l "1.0"
"1.0.1" >l "1.0"
"1.1" >l "1.0"
"0.99999" <u "1.0"
"1.0alpha" <u "1.0"
"1.0alpha0" <u "1.0"
"1.0" <u "1.0"
"1.0patch" <u "1.0"
"1.0patch0" <u "1.0"
"1.0a" <u "1.0"
"1.0.1" <u "1.0"
"1.1" >u "1.0"
"1.0" l=l "1.0"
"1.0" u=u "1.0"
"1.0" l<u "1.0"
"1.0" u<l "1.1"
"0" u>u "0.0"
"0" l<l "0.0"
[uniform component splitting]
"1.0alpha1" = "1.0alpha1"
"1.0alpha1" = "1.0.alpha1"
"1.0alpha1" = "1.0alpha.1"
"1.0alpha1" = "1.0.alpha.1"
"1.0patch1" = "1.0patch1"
"1.0patch1" = "1.0.patch1"
"1.0patch1" = "1.0patch.1"
"1.0patch1" = "1.0.patch.1"