From 31fc55eca742518a0be283cce88d332af151af43 Mon Sep 17 00:00:00 2001 From: str4d Date: Sun, 25 Nov 2012 02:44:01 +0000 Subject: [PATCH] Added tests for VersionComparator --- .../net/i2p/util/VersionComparatorSpec.scala | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 core/java/test/scalatest/net/i2p/util/VersionComparatorSpec.scala diff --git a/core/java/test/scalatest/net/i2p/util/VersionComparatorSpec.scala b/core/java/test/scalatest/net/i2p/util/VersionComparatorSpec.scala new file mode 100644 index 000000000..3131a14bb --- /dev/null +++ b/core/java/test/scalatest/net/i2p/util/VersionComparatorSpec.scala @@ -0,0 +1,29 @@ +package net.i2p.util + +import org.scalatest.FunSpec +import org.scalatest.matchers.ShouldMatchers + +class VersionComparatorSpec extends FunSpec with ShouldMatchers { + val vc = new VersionComparator + + describe("A VersionComparator") { + it("should find that 0.1.2 equals 0.1.2") { + vc.compare("0.1.2", "0.1.2") 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.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 is equal to 0-1-2") { + vc.compare("0.1.2", "0-1-2") should equal (0) + } + it("should find that 0.1.2 is equal to 0_1_2") { + vc.compare("0.1.2", "0_1_2") should equal (0) + } + 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) + } + } +}