diff options
Diffstat (limited to 'cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic')
10 files changed, 405 insertions, 0 deletions
diff --git a/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/metaphonealgorithmSpec.scala b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/metaphonealgorithmSpec.scala new file mode 100755 index 0000000..8b8226d --- /dev/null +++ b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/metaphonealgorithmSpec.scala @@ -0,0 +1,37 @@ +package com.rockymadden.stringmetric.cli.phonetic + +import com.rockymadden.stringmetric.cli.ScalaTest +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class metaphonealgorithmSpec extends ScalaTest { "metaphonealgorithm" should provide { + "main method" when passed { + "valid dashless argument" should executes { + "print phonetic representation" in { + val out = new java.io.ByteArrayOutputStream() + + Console.withOut(out)( + metaphonealgorithm.main(Array("--unitTest", "--debug", "abc")) + ) + + out.toString should equal ("abk\n") + out.reset() + + Console.withOut(out)( + metaphonealgorithm.main(Array("--unitTest", "--debug", "1")) + ) + + out.toString should equal ("not computable\n") + out.reset() + } + } + "no dashless argument" should throws { + "IllegalArgumentException" in { + evaluating { + metaphonealgorithm.main(Array("--unitTest", "--debug")) + } should produce [IllegalArgumentException] + } + } + } +}} diff --git a/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/metaphonemetricSpec.scala b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/metaphonemetricSpec.scala new file mode 100755 index 0000000..ab8d4fb --- /dev/null +++ b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/metaphonemetricSpec.scala @@ -0,0 +1,44 @@ +package com.rockymadden.stringmetric.cli.phonetic + +import com.rockymadden.stringmetric.cli.ScalaTest +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class metaphonemetricSpec extends ScalaTest { "metaphonemetric" should provide { + "main method" when passed { + "valid dashless arguments" should executes { + "print if they are a match" in { + val out = new java.io.ByteArrayOutputStream() + + Console.withOut(out)( + metaphonemetric.main(Array("--unitTest", "--debug", "abc", "abc")) + ) + + out.toString should equal ("true\n") + out.reset() + + Console.withOut(out)( + metaphonemetric.main(Array("--unitTest", "--debug", "abc", "xyz")) + ) + + out.toString should equal ("false\n") + out.reset() + + Console.withOut(out)( + metaphonemetric.main(Array("--unitTest", "--debug", "1", "1")) + ) + + out.toString should equal ("not comparable\n") + out.reset() + } + } + "no dashless arguments" should throws { + "IllegalArgumentException" in { + evaluating { + metaphonemetric.main(Array("--unitTest", "--debug")) + } should produce [IllegalArgumentException] + } + } + } +}} diff --git a/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/nysiisalgorithmSpec.scala b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/nysiisalgorithmSpec.scala new file mode 100755 index 0000000..21ae04a --- /dev/null +++ b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/nysiisalgorithmSpec.scala @@ -0,0 +1,37 @@ +package com.rockymadden.stringmetric.cli.phonetic + +import com.rockymadden.stringmetric.cli.ScalaTest +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class nysiisalgorithmSpec extends ScalaTest { "nysiisalgorithm" should provide { + "main method" when passed { + "valid dashless argument" should executes { + "print phonetic representation" in { + val out = new java.io.ByteArrayOutputStream() + + Console.withOut(out)( + nysiisalgorithm.main(Array("--unitTest", "--debug", "abc")) + ) + + out.toString should equal ("abc\n") + out.reset() + + Console.withOut(out)( + nysiisalgorithm.main(Array("--unitTest", "--debug", "1")) + ) + + out.toString should equal ("not computable\n") + out.reset() + } + } + "no dashless argument" should throws { + "IllegalArgumentException" in { + evaluating { + nysiisalgorithm.main(Array("--unitTest", "--debug")) + } should produce [IllegalArgumentException] + } + } + } +}} diff --git a/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/nysiismetricSpec.scala b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/nysiismetricSpec.scala new file mode 100755 index 0000000..aa28fe4 --- /dev/null +++ b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/nysiismetricSpec.scala @@ -0,0 +1,44 @@ +package com.rockymadden.stringmetric.cli.phonetic + +import com.rockymadden.stringmetric.cli.ScalaTest +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class nysiismetricSpec extends ScalaTest { "nysiismetric" should provide { + "main method" when passed { + "valid dashless arguments" should executes { + "print if they are a match" in { + val out = new java.io.ByteArrayOutputStream() + + Console.withOut(out)( + nysiismetric.main(Array("--unitTest", "--debug", "abc", "abc")) + ) + + out.toString should equal ("true\n") + out.reset() + + Console.withOut(out)( + nysiismetric.main(Array("--unitTest", "--debug", "abc", "xyz")) + ) + + out.toString should equal ("false\n") + out.reset() + + Console.withOut(out)( + nysiismetric.main(Array("--unitTest", "--debug", "1", "1")) + ) + + out.toString should equal ("not comparable\n") + out.reset() + } + } + "no dashless arguments" should throws { + "IllegalArgumentException" in { + evaluating { + nysiismetric.main(Array("--unitTest", "--debug")) + } should produce [IllegalArgumentException] + } + } + } +}} diff --git a/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinednysiisalgorithmSpec.scala b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinednysiisalgorithmSpec.scala new file mode 100755 index 0000000..f2e78d9 --- /dev/null +++ b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinednysiisalgorithmSpec.scala @@ -0,0 +1,37 @@ +package com.rockymadden.stringmetric.cli.phonetic + +import com.rockymadden.stringmetric.cli.ScalaTest +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class refinednysiisalgorithmSpec extends ScalaTest { "refinednysiisalgorithm" should provide { + "main method" when passed { + "valid dashless argument" should executes { + "print phonetic representation" in { + val out = new java.io.ByteArrayOutputStream() + + Console.withOut(out)( + refinednysiisalgorithm.main(Array("--unitTest", "--debug", "abc")) + ) + + out.toString should equal ("abc\n") + out.reset() + + Console.withOut(out)( + refinednysiisalgorithm.main(Array("--unitTest", "--debug", "1")) + ) + + out.toString should equal ("not computable\n") + out.reset() + } + } + "no dashless argument" should throws { + "IllegalArgumentException" in { + evaluating { + refinednysiisalgorithm.main(Array("--unitTest", "--debug")) + } should produce [IllegalArgumentException] + } + } + } +}} diff --git a/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinednysiismetricSpec.scala b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinednysiismetricSpec.scala new file mode 100755 index 0000000..ce9cebd --- /dev/null +++ b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinednysiismetricSpec.scala @@ -0,0 +1,44 @@ +package com.rockymadden.stringmetric.cli.phonetic + +import com.rockymadden.stringmetric.cli.ScalaTest +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class refinednysiismetricSpec extends ScalaTest { "refinednysiismetric" should provide { + "main method" when passed { + "valid dashless arguments" should executes { + "print if they are a match" in { + val out = new java.io.ByteArrayOutputStream() + + Console.withOut(out)( + refinednysiismetric.main(Array("--unitTest", "--debug", "abc", "abc")) + ) + + out.toString should equal ("true\n") + out.reset() + + Console.withOut(out)( + refinednysiismetric.main(Array("--unitTest", "--debug", "abc", "xyz")) + ) + + out.toString should equal ("false\n") + out.reset() + + Console.withOut(out)( + refinednysiismetric.main(Array("--unitTest", "--debug", "1", "1")) + ) + + out.toString should equal ("not comparable\n") + out.reset() + } + } + "no dashless arguments" should throws { + "IllegalArgumentException" in { + evaluating { + refinednysiismetric.main(Array("--unitTest", "--debug")) + } should produce [IllegalArgumentException] + } + } + } +}} diff --git a/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedsoundexalgorithmSpec.scala b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedsoundexalgorithmSpec.scala new file mode 100755 index 0000000..18d46fa --- /dev/null +++ b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedsoundexalgorithmSpec.scala @@ -0,0 +1,37 @@ +package com.rockymadden.stringmetric.cli.phonetic + +import com.rockymadden.stringmetric.cli.ScalaTest +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class refinedsoundexalgorithmSpec extends ScalaTest { "refinedsoundexalgorithm" should provide { + "main method" when passed { + "valid dashless argument" should executes { + "print phonetic representation" in { + val out = new java.io.ByteArrayOutputStream() + + Console.withOut(out)( + refinedsoundexalgorithm.main(Array("--unitTest", "--debug", "abc")) + ) + + out.toString should equal ("a013\n") + out.reset() + + Console.withOut(out)( + refinedsoundexalgorithm.main(Array("--unitTest", "--debug", "1")) + ) + + out.toString should equal ("not computable\n") + out.reset() + } + } + "no dashless argument" should throws { + "IllegalArgumentException" in { + evaluating { + refinedsoundexalgorithm.main(Array("--unitTest", "--debug")) + } should produce [IllegalArgumentException] + } + } + } +}} diff --git a/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedsoundexmetricSpec.scala b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedsoundexmetricSpec.scala new file mode 100755 index 0000000..041fada --- /dev/null +++ b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/refinedsoundexmetricSpec.scala @@ -0,0 +1,44 @@ +package com.rockymadden.stringmetric.cli.phonetic + +import com.rockymadden.stringmetric.cli.ScalaTest +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class refinedsoundexmetricSpec extends ScalaTest { "refinedsoundexmetric" should provide { + "main method" when passed { + "valid dashless arguments" should executes { + "print if they are a match" in { + val out = new java.io.ByteArrayOutputStream() + + Console.withOut(out)( + refinedsoundexmetric.main(Array("--unitTest", "--debug", "abc", "abc")) + ) + + out.toString should equal ("true\n") + out.reset() + + Console.withOut(out)( + refinedsoundexmetric.main(Array("--unitTest", "--debug", "abc", "xyz")) + ) + + out.toString should equal ("false\n") + out.reset() + + Console.withOut(out)( + refinedsoundexmetric.main(Array("--unitTest", "--debug", "1", "1")) + ) + + out.toString should equal ("not comparable\n") + out.reset() + } + } + "no dashless arguments" should throws { + "IllegalArgumentException" in { + evaluating { + refinedsoundexmetric.main(Array("--unitTest", "--debug")) + } should produce [IllegalArgumentException] + } + } + } +}} diff --git a/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/soundexalgorithmSpec.scala b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/soundexalgorithmSpec.scala new file mode 100755 index 0000000..e23b3c3 --- /dev/null +++ b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/soundexalgorithmSpec.scala @@ -0,0 +1,37 @@ +package com.rockymadden.stringmetric.cli.phonetic + +import com.rockymadden.stringmetric.cli.ScalaTest +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class soundexalgorithmSpec extends ScalaTest { "soundexalgorithm" should provide { + "main method" when passed { + "valid dashless argument" should executes { + "print phonetic representation" in { + val out = new java.io.ByteArrayOutputStream() + + Console.withOut(out)( + soundexalgorithm.main(Array("--unitTest", "--debug", "abc")) + ) + + out.toString should equal ("a120\n") + out.reset() + + Console.withOut(out)( + soundexalgorithm.main(Array("--unitTest", "--debug", "1")) + ) + + out.toString should equal ("not computable\n") + out.reset() + } + } + "no dashless argument" should throws { + "IllegalArgumentException" in { + evaluating { + soundexalgorithm.main(Array("--unitTest", "--debug")) + } should produce [IllegalArgumentException] + } + } + } +}} diff --git a/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/soundexmetricSpec.scala b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/soundexmetricSpec.scala new file mode 100755 index 0000000..332b058 --- /dev/null +++ b/cli/src/test/scala/com/rockymadden/stringmetric/cli/phonetic/soundexmetricSpec.scala @@ -0,0 +1,44 @@ +package com.rockymadden.stringmetric.cli.phonetic + +import com.rockymadden.stringmetric.cli.ScalaTest +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class soundexmetricSpec extends ScalaTest { "soundexmetric" should provide { + "main method" when passed { + "valid dashless arguments" should executes { + "print if they are a match" in { + val out = new java.io.ByteArrayOutputStream() + + Console.withOut(out)( + soundexmetric.main(Array("--unitTest", "--debug", "abc", "abc")) + ) + + out.toString should equal ("true\n") + out.reset() + + Console.withOut(out)( + soundexmetric.main(Array("--unitTest", "--debug", "abc", "xyz")) + ) + + out.toString should equal ("false\n") + out.reset() + + Console.withOut(out)( + soundexmetric.main(Array("--unitTest", "--debug", "1", "1")) + ) + + out.toString should equal ("not comparable\n") + out.reset() + } + } + "no dashless arguments" should throws { + "IllegalArgumentException" in { + evaluating { + soundexmetric.main(Array("--unitTest", "--debug")) + } should produce [IllegalArgumentException] + } + } + } +}} |