From 4266a10ffbad5c04d7ddabdb3ac3b028fbb86205 Mon Sep 17 00:00:00 2001 From: str4d Date: Mon, 26 Nov 2012 00:29:02 +0000 Subject: [PATCH] Added more tests to VersionComparatorSpec to further cover the implementation --- .../net/i2p/util/VersionComparatorSpec.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/java/test/scalatest/net/i2p/util/VersionComparatorSpec.scala b/core/java/test/scalatest/net/i2p/util/VersionComparatorSpec.scala index 3131a14bb..cfa50ccaa 100644 --- a/core/java/test/scalatest/net/i2p/util/VersionComparatorSpec.scala +++ b/core/java/test/scalatest/net/i2p/util/VersionComparatorSpec.scala @@ -16,6 +16,15 @@ class VersionComparatorSpec extends FunSpec with ShouldMatchers { it("should find that 0.1.3 is greater than 0.1.2") { 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") { vc.compare("0.1.2", "0-1-2") should equal (0) } @@ -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") { 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) + } } }