summaryrefslogtreecommitdiff
path: root/cli/src/test/scala/com/rockymadden/stringmetric/cli/similarity/jaccardmetricSpec.scala
blob: 41bd3903a3445d607aa02c1115ee90c3a93b3c3f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package com.rockymadden.stringmetric.cli.similarity

object jaccardmetricSpec extends org.specs2.mutable.SpecificationWithJUnit {
	"jaccardmetric main()" should {
		"print if they are a match with valid dashless arguments" in {
			val out = new java.io.ByteArrayOutputStream()

			Console.withOut(out)(jaccardmetric.main(Array("--unitTest", "--debug", "--n=2", "abc", "abc")))
			out.toString must beEqualTo("1.0\n")
			out.reset()

			Console.withOut(out)(jaccardmetric.main(Array("--unitTest", "--debug", "--n=2", "abc", "xyz")))
			out.toString must beEqualTo("0.0\n")
		}
		"throw IllegalArgumentException with no dashless arguments" in {
			jaccardmetric.main(Array("--unitTest", "--debug")) must throwA[IllegalArgumentException]
		}
	}
}