SemanticVersion
class is the class to use a semantic version.
This class is supporting a following spec.
- The version is following the format of
x.y.z[-prerelease[.n[.m]][+build[.i[.j]]]
.- Meaning
x
: Major version.y
: Minor versoin.z
: Patch version.prerelease
: Identifier string of pre-release.n.m
: Pre-release number.build
: Identifier string of build.n.m
: Build number.
- Example
1.0.0
1.0.0-alpha.1
1.0.0-beta.1.0
1.0.0-beta.1.0+build.1
1.0.0-beta.1.0+build.2.3.0
- Meaning
- Rule of comparing versions for pre-release.
- Pre-release means an older version.
- For example,
1.0.0
is newwer than1.0.0-alpha.1
.
- For example,
- Pre-release string is compared by alphabetical.
- For example,
1.0.0-beta.1
is newwer than1.0.0-alpha.1
.
- For example,
- Pre-release number is compared when the version and the pre-release string is the same.
- For example,
1.0.0-beta.2
is newwer than1.0.0-beta.1
.
- For example,
- Pre-release means an older version.
- Rule of comparing versions for build.
- Build string and number is not used in comparison.
- For example,
1.0.0-beta.1+build.1
is same as1.0.0-beta.1
. 1.0.0-beta.1+build.1
is also same as1.0.0-beta.1+build.2
.
- For example,
- Build string and number is not used in comparison.
To use SemanticVersion class, use using
directive first.
using SemanticVersion;
To instantiate it, use new
operator as well as a normal class.
using SemanticVersion;
var version = new SemanticVersion("1.0.0");
You can compare between instances of SemanticVersion class. The following operators are supported.
Operator | Meaning |
---|---|
== |
true if lhs and rhs are the same. |
!= |
true if lhs and rhs are not the same. |
> |
true if the version of lhs is greater than the version of rhs. |
< |
true if the version of lhs is less than the version of rhs. |
>= |
true if the version of lhs is greater than or equals to the version of rhs. |
<= |
true if the version of lhs is less than or equals to the version of rhs. |
Here is the example below.
using SemanticVersion;
var version1 = new SemanticVersion("1.4.10");
var version2 = new SemanticVersion("2.1.0");
System.println(version1 == version2); // => false
System.println(version1 != version2); // => true
System.println(version1 > version2); // => false
System.println(version1 < version2); // => true
System.println(version1 >= version2); // => false
System.println(version1 <= version2); // => true
You can also check if the version is matching to the pattern you specified.
In the pattern, you can use *
which means any number.
Moreover, you can specify the operator to compare such as >
.
For example, it is 1.1.*
, >1.1.*
, <=2
, and so on.
*
can be used from the right side, so you can not use it like 1.*.10
.
And .*
can be omitted like 1.1
which means 1.1.*
.
Here is the example below.
using SemanticVersion;
var version = new SemanticVersion("1.1.10");
System.println(version.match("1.1.10")); // => true
System.println(version.match("1.1.*")); // => true
System.println(version.match("1.2.*")); // => false
System.println(version.match(">1.1")); // => false
System.println(version.match(">=1.1")); // => true
System.println(version.match(">1.1.2")); // => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "1.0.0";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.0 match ("1.0.0") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "1.0.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.0 match ("1.0.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.0 match ("1.*.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "2.0.0";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.0 match ("2.0.0") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "2.0.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.0 match ("2.0.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "2.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.0 match ("2.*.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "1.0.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.0 match ("1.0.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.1");
var pattern = "1.0.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.1 match ("1.0.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.99");
var pattern = "1.0.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.99 match ("1.0.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.99");
var pattern = "1.0.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.99 match ("1.0.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "1.1.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.0 match ("1.1.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.1");
var pattern = "1.1.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.1 match ("1.1.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.99");
var pattern = "1.1.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.99 match ("1.1.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.99");
var pattern = "1.1.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.99 match ("1.1.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.0 match ("1.*.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.1");
var pattern = "1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.1 match ("1.*.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.99");
var pattern = "1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.99 match ("1.*.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.99");
var pattern = "1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.99 match ("1.*.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("11.1.99");
var pattern = "1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
11.1.99 match ("1.*.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = ">1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.0 match (">1.*.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = ">=1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.0 match (">=1.*.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = ">1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.0 match (">1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = ">=1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.0 match (">=1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = ">1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.0 match (">1.1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = ">=1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.0 match (">=1.1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = ">1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.0 match (">1.1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = ">=1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.0 match (">=1.1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.1");
var pattern = ">1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.1 match (">1.1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.1");
var pattern = ">=1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.1 match (">=1.1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = ">1.1.2";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.10 match (">1.1.2") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = ">=1.1.2";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.10 match (">=1.1.2") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.10.10");
var pattern = ">1.2.99";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.10.10 match (">1.2.99") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.10.10");
var pattern = ">=1.2.99";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.10.10 match (">=1.2.99") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "<1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.0 match ("<1.*.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "<=1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.0 match ("<=1.*.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "<1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.0 match ("<1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "<=1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.0 match ("<=1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "<1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.0 match ("<1.1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "<=1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.0 match ("<=1.1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "<1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.0 match ("<1.1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "<=1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.0 match ("<=1.1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.1");
var pattern = "<1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.1 match ("<1.1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.1");
var pattern = "<=1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.1 match ("<=1.1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.2");
var pattern = "<1.1.10";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.2 match ("<1.1.10") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.2");
var pattern = "<=1.1.10";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.2 match ("<=1.1.10") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.2.99");
var pattern = "<1.10.10";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.2.99 match ("<1.10.10") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.2.99");
var pattern = "<=1.10.20";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.2.99 match ("<=1.10.20") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "==1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.0 match ("==1.*.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "==1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.0.0 match ("==1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "==1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.0 match ("==1.*.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "==1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.0 match ("==1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "==1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.0 match ("==1.*.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "==1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.0 match ("==1.1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "==1.1.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.0 match ("==1.1.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "==1.1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.0 match ("==1.1.1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "==1.1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.10 match ("==1.1.1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "==1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.10 match ("==1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "==1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.10 match ("==1.*.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "==1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.10 match ("==1.1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "==1.1.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.10 match ("==1.1.*") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "==1.1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.10 match ("==1.1.1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "==1.1.10";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.10 match ("==1.1.10") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "!=1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.0 match ("!=1.*.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var pattern = "!=1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.0.0 match ("!=1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "!=1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.0 match ("!=1.*.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "!=1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.0 match ("!=1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "!=1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.0 match ("!=1.*.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "!=1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.0 match ("!=1.1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "!=1.1.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.0 match ("!=1.1.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var pattern = "!=1.1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.0 match ("!=1.1.1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "!=1.1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.10 match ("!=1.1.1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "!=1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.10 match ("!=1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "!=1.*.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.10 match ("!=1.*.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "!=1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.10 match ("!=1.1") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "!=1.1.*";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.10 match ("!=1.1.*") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "!=1.1.1";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.10 match ("!=1.1.1") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10");
var pattern = "!=1.1.10";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.10 match ("!=1.1.10") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10-alpha.1");
var pattern = ">1.1.10";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.10-alpha.1 match (">1.1.10") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10-alpha.1");
var pattern = ">=1.1.10";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, False);
1.1.10-alpha.1 match (">=1.1.10") => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10-alpha.1");
var pattern = "<1.1.10";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.10-alpha.1 match ("<1.1.10") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.10-alpha.1");
var pattern = "<=1.1.10";
SemanticVersionTest("match", lhs.version(), '("%{pattern}")', { => lhs.match(pattern) }, True);
1.1.10-alpha.1 match ("<=1.1.10") => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.0.0");
SemanticVersionTest("==", lhs.version(), rhs.version(), { => lhs == rhs }, True);
1.0.0 == 1.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest("==", lhs.version(), rhs.version(), { => lhs == rhs }, False);
1.0.0 == 2.0.0 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest("==", lhs.version(), rhs.version(), { => lhs == rhs }, False);
1.1.0 == 2.0.0 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.1.0");
SemanticVersionTest("==", lhs.version(), rhs.version(), { => lhs == rhs }, False);
1.0.0 == 1.1.0 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.0.1");
SemanticVersionTest("==", lhs.version(), rhs.version(), { => lhs == rhs }, False);
1.0.0 == 1.0.1 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.0.0");
SemanticVersionTest("!=", lhs.version(), rhs.version(), { => lhs != rhs }, False);
1.0.0 != 1.0.0 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest("!=", lhs.version(), rhs.version(), { => lhs != rhs }, True);
1.0.0 != 2.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest("!=", lhs.version(), rhs.version(), { => lhs != rhs }, True);
1.1.0 != 2.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.1");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest("!=", lhs.version(), rhs.version(), { => lhs != rhs }, True);
1.0.1 != 2.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.1.0");
SemanticVersionTest("!=", lhs.version(), rhs.version(), { => lhs != rhs }, True);
1.0.0 != 1.1.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.0.1");
SemanticVersionTest("!=", lhs.version(), rhs.version(), { => lhs != rhs }, True);
1.0.0 != 1.0.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("2.0.0");
var rhs = new SemanticVersion("1.0.0");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, True);
2.0.0 > 1.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, False);
1.1.0 > 2.0.0 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.1");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, False);
1.0.1 > 2.0.0 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var rhs = new SemanticVersion("1.0.0");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, True);
1.1.0 > 1.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.1");
var rhs = new SemanticVersion("1.0.0");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, True);
1.0.1 > 1.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("0.9.101");
var rhs = new SemanticVersion("0.9.100");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, True);
0.9.101 > 0.9.100 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("10.0.2");
var rhs = new SemanticVersion("10.0.1");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, True);
10.0.2 > 10.0.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.0.1");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, False);
1.0.0 > 1.0.1 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.0.0");
SemanticVersionTest(">=", lhs.version(), rhs.version(), { => lhs >= rhs }, True);
1.0.0 >= 1.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.1");
var rhs = new SemanticVersion("1.0.0");
SemanticVersionTest(">=", lhs.version(), rhs.version(), { => lhs >= rhs }, True);
1.0.1 >= 1.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.0.1");
SemanticVersionTest(">=", lhs.version(), rhs.version(), { => lhs >= rhs }, False);
1.0.0 >= 1.0.1 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest(">=", lhs.version(), rhs.version(), { => lhs >= rhs }, False);
1.1.0 >= 2.0.0 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.1");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest(">=", lhs.version(), rhs.version(), { => lhs >= rhs }, False);
1.0.1 >= 2.0.0 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0 < 2.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.1.0 < 2.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.1");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.1 < 2.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.1.0");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0 < 1.1.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.0.1");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0 < 1.0.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("0.9.100");
var rhs = new SemanticVersion("0.9.101");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
0.9.100 < 0.9.101 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("10.0.1");
var rhs = new SemanticVersion("10.0.2");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
10.0.1 < 10.0.2 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.1");
var rhs = new SemanticVersion("1.0.0");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, False);
1.0.1 < 1.0.0 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.0.0");
SemanticVersionTest("<=", lhs.version(), rhs.version(), { => lhs <= rhs }, True);
1.0.0 <= 1.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.0.1");
SemanticVersionTest("<=", lhs.version(), rhs.version(), { => lhs <= rhs }, True);
1.0.0 <= 1.0.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.1");
var rhs = new SemanticVersion("1.0.0");
SemanticVersionTest("<=", lhs.version(), rhs.version(), { => lhs <= rhs }, False);
1.0.1 <= 1.0.0 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.1.0");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest("<=", lhs.version(), rhs.version(), { => lhs <= rhs }, True);
1.1.0 <= 2.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.1");
var rhs = new SemanticVersion("2.0.0");
SemanticVersionTest("<=", lhs.version(), rhs.version(), { => lhs <= rhs }, True);
1.0.1 <= 2.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.0.0-alpha");
SemanticVersionTest("==", lhs.version(), rhs.version(), { => lhs == rhs }, False);
1.0.0 == 1.0.0-alpha => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest("==", lhs.version(), rhs.version(), { => lhs == rhs }, False);
1.0.0-alpha == 1.0.0-alpha.1 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest("==", lhs.version(), rhs.version(), { => lhs == rhs }, True);
1.0.0-alpha.1 == 1.0.0-alpha.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1");
var rhs = new SemanticVersion("1.0.0-alpha.1+build.1");
SemanticVersionTest("==", lhs.version(), rhs.version(), { => lhs == rhs }, True);
1.0.0-alpha.1 == 1.0.0-alpha.1+build.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.0.0-alpha");
SemanticVersionTest("!=", lhs.version(), rhs.version(), { => lhs != rhs }, True);
1.0.0 != 1.0.0-alpha => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest("!=", lhs.version(), rhs.version(), { => lhs != rhs }, True);
1.0.0-alpha != 1.0.0-alpha.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest("!=", lhs.version(), rhs.version(), { => lhs != rhs }, False);
1.0.0-alpha.1 != 1.0.0-alpha.1 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1");
var rhs = new SemanticVersion("1.0.0-alpha.1+build.1");
SemanticVersionTest("!=", lhs.version(), rhs.version(), { => lhs != rhs }, False);
1.0.0-alpha.1 != 1.0.0-alpha.1+build.1 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-beta.1");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, True);
1.0.0-beta.1 > 1.0.0-alpha.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0");
var rhs = new SemanticVersion("1.0.0-alpha");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, True);
1.0.0 > 1.0.0-alpha => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1");
var rhs = new SemanticVersion("1.0.0-alpha");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, True);
1.0.0-alpha.1 > 1.0.0-alpha => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.2");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, True);
1.0.0-alpha.2 > 1.0.0-alpha.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.beta");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, True);
1.0.0-alpha.beta > 1.0.0-alpha.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.2");
var rhs = new SemanticVersion("1.0.0-alpha.1+build.1");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, True);
1.0.0-alpha.2 > 1.0.0-alpha.1+build.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest(">", lhs.version(), rhs.version(), { => lhs > rhs }, False);
1.0.0-alpha.1 > 1.0.0-alpha.1 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1");
var rhs = new SemanticVersion("1.0.0-alpha.2");
SemanticVersionTest(">=", lhs.version(), rhs.version(), { => lhs >= rhs }, False);
1.0.0-alpha.1 >= 1.0.0-alpha.2 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest(">=", lhs.version(), rhs.version(), { => lhs >= rhs }, True);
1.0.0-alpha.1 >= 1.0.0-alpha.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.2");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest(">=", lhs.version(), rhs.version(), { => lhs >= rhs }, True);
1.0.0-alpha.2 >= 1.0.0-alpha.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.2");
var rhs = new SemanticVersion("1.0.0-alpha.1+build.1");
SemanticVersionTest(">=", lhs.version(), rhs.version(), { => lhs >= rhs }, True);
1.0.0-alpha.2 >= 1.0.0-alpha.1+build.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, False);
1.0.0-alpha.1 < 1.0.0-alpha.1 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.2");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, False);
1.0.0-alpha.2 < 1.0.0-alpha.1 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha");
var rhs = new SemanticVersion("1.0.0");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0-alpha < 1.0.0 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0-alpha < 1.0.0-alpha.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1");
var rhs = new SemanticVersion("1.0.0-alpha.2");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0-alpha.1 < 1.0.0-alpha.2 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1+build.1");
var rhs = new SemanticVersion("1.0.0-alpha.2");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0-alpha.1+build.1 < 1.0.0-alpha.2 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.2");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest("<=", lhs.version(), rhs.version(), { => lhs <= rhs }, False);
1.0.0-alpha.2 <= 1.0.0-alpha.1 => false : expected => false
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest("<=", lhs.version(), rhs.version(), { => lhs <= rhs }, True);
1.0.0-alpha.1 <= 1.0.0-alpha.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1");
var rhs = new SemanticVersion("1.0.0-alpha.2");
SemanticVersionTest("<=", lhs.version(), rhs.version(), { => lhs <= rhs }, True);
1.0.0-alpha.1 <= 1.0.0-alpha.2 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1+build.1");
var rhs = new SemanticVersion("1.0.0-alpha.2");
SemanticVersionTest("<=", lhs.version(), rhs.version(), { => lhs <= rhs }, True);
1.0.0-alpha.1+build.1 <= 1.0.0-alpha.2 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha");
var rhs = new SemanticVersion("1.0.0-alpha.1");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0-alpha < 1.0.0-alpha.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.1");
var rhs = new SemanticVersion("1.0.0-alpha.beta");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0-alpha.1 < 1.0.0-alpha.beta => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-alpha.beta");
var rhs = new SemanticVersion("1.0.0-beta");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0-alpha.beta < 1.0.0-beta => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-beta");
var rhs = new SemanticVersion("1.0.0-beta.2");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0-beta < 1.0.0-beta.2 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-beta.2");
var rhs = new SemanticVersion("1.0.0-beta.11");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0-beta.2 < 1.0.0-beta.11 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-beta.11");
var rhs = new SemanticVersion("1.0.0-rc.1");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0-beta.11 < 1.0.0-rc.1 => true : expected => true
using SemanticVersion;
var lhs = new SemanticVersion("1.0.0-rc.1");
var rhs = new SemanticVersion("1.0.0");
SemanticVersionTest("<", lhs.version(), rhs.version(), { => lhs < rhs }, True);
1.0.0-rc.1 < 1.0.0 => true : expected => true