I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 4266a10f authored by str4d's avatar str4d
Browse files

Added more tests to VersionComparatorSpec to further cover the implementation

parent 31fc55ec
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,15 @@ class VersionComparatorSpec extends FunSpec with ShouldMatchers { ...@@ -16,6 +16,15 @@ class VersionComparatorSpec extends FunSpec with ShouldMatchers {
it("should find that 0.1.3 is greater than 0.1.2") { it("should find that 0.1.3 is greater than 0.1.2") {
vc.compare("0.1.3", "0.1.2") should equal (1) vc.compare("0.1.3", "0.1.2") should equal (1)
} }
it("should find that 0.1.2.3.4 is greater than 0.1.2") {
vc.compare("0.1.2.3.4", "0.1.2") should equal (1)
}
it("should find that 0.1.2 is less than 0.1.2.3.4") {
vc.compare("0.1.2", "0.1.2.3.4") should equal (-1)
}
it("should find that 0.1.3 is greater than 0.1.2.3.4") {
vc.compare("0.1.3", "0.1.2.3.4") should equal (1)
}
it("should find that 0.1.2 is equal to 0-1-2") { it("should find that 0.1.2 is equal to 0-1-2") {
vc.compare("0.1.2", "0-1-2") should equal (0) vc.compare("0.1.2", "0-1-2") should equal (0)
} }
...@@ -25,5 +34,14 @@ class VersionComparatorSpec extends FunSpec with ShouldMatchers { ...@@ -25,5 +34,14 @@ class VersionComparatorSpec extends FunSpec with ShouldMatchers {
it("should find that 0.1.2-foo is equal to 0.1.2-bar") { it("should find that 0.1.2-foo is equal to 0.1.2-bar") {
vc.compare("0.1.2-foo", "0.1.2-bar") should equal (0) vc.compare("0.1.2-foo", "0.1.2-bar") should equal (0)
} }
it("should find that -0.1.2 is less than -0.1.3") {
vc.compare("-0.1.2", "-0.1.3") should equal (-1)
}
it("should find that 0..2 is greater than 0.1.2") {
vc.compare("0..2", "0.1.2") should equal (1)
}
it("should find that 0.1.2 is less than 0..2") {
vc.compare("0.1.2", "0..2") should equal (-1)
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment