summaryrefslogtreecommitdiff
path: root/cli/src/test/scala/com/rockymadden/stringmetric/cli/similarity/hammingmetricSpec.scala
blob: 736e46b952a0b7eb0a26fb0b0d093c2388c1076e (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 hammingmetricSpec extends org.specs2.mutable.SpecificationWithJUnit {
	"hammingmetric main()" should {
		"print if they are a match with valid dashless arguments" in {
			val out = new java.io.ByteArrayOutputStream()

			Console.withOut(out)(hammingmetric.main(Array("--unitTest", "--debug", "abc", "abc")))
			out.toString must beEqualTo("0\n")
			out.reset()

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