inweb-bootstrap/foundation-test/Tests/Test Cases/_Results_Ideal/semver.txt
Philip Chimento 436901adb6 Fix semver comparison with different numbers of prerelease elements
By my reading of the semantic versioning spec, the sense of the comparison
of the number of prerelease version segments has to be reversed when one
of those numbers is zero.

In other words, zero prerelease segments takes precedence over any nonzero
number, but any nonzero number takes precedence over any lower nonzero
number.

Example given in the specification:
1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta <
  1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.

I had two failing test cases in foundation-test; in one case, the blessed
output seemed to be wrong, whereas the other case made this fix necessary.
2022-04-07 22:34:51 -07:00

41 lines
1.3 KiB
Text

'1' --> 1
'1.2' --> 1.2
'1.2.3' --> 1.2.3
'71.0.45672' --> 71.0.45672
'1.2.3.4' --> null
'9/861022' --> 9.861022
'9/86102' --> null
'9/8610223' --> null
'9/861022.2' --> null
'9/861022/2' --> null
'1.2.3-alpha.0.x45.1789' --> 1.2.3-alpha.0.x45.1789
'1+lobster' --> 1+lobster
'1.2+lobster' --> 1.2+lobster
'1.2.3+lobster' --> 1.2.3+lobster
'1.2.3-beta.2+shellfish' --> 1.2.3-beta.2+shellfish
3 < 5
3 = 3
3 = 3.0
3 = 3.0.0
3.1.41 > 3.1.5
3.1.41 < 3.2.5
3.1.41 = 3.1.41+arm64
3.1.41 > 3.1.41-pre.0.1
3.1.41-alpha.72 > 3.1.41-alpha.8
3.1.41-alpha.72a < 3.1.41-alpha.8a
3.1.41-alpha.72 < 3.1.41-beta.72
3.1.41-alpha.72 < 3.1.41-alpha.72.zeta
1.2.3+lobster.54 = 1.2.3+lobster.100
Compatibility range of 6.4.2-kappa.17 = [6.4.2-kappa.17,7-A)
At-least range of 6.4.2-kappa.17 = [6.4.2-kappa.17,infty)
At-most range of 6.4.2-kappa.17 = (-infty,6.4.2-kappa.17]
[6.4.2-kappa.17,7-A) intersect [3.5.5,4-A) = empty -- changed
[6.4.2-kappa.17,7-A) intersect [6.9.1,7-A) = [6.9.1,7-A) -- changed
[6.9.1,7-A) intersect [6.4.2-kappa.17,7-A) = [6.9.1,7-A)
[6.4.2,infty) intersect [3.5.5,infty) = [6.4.2,infty)
[6.4.2,infty) intersect (-infty,3.5.5] = empty -- changed
(-infty,6.4.2] intersect [3.5.5,infty) = [3.5.5,6.4.2] -- changed
(-infty,6.4.2] intersect (-infty,3.5.5] = (-infty,3.5.5] -- changed