From 9e8964fbe63e412f4327543126be9105e1fc45a9 Mon Sep 17 00:00:00 2001 From: Rocky Madden Date: Mon, 29 Oct 2012 17:19:43 -0600 Subject: Appended algorithm to names to help diferentiate between metrics and phonetic algorithms. --- .../stringmetric/cli/command/metaphone.scala | 52 ---------------------- .../cli/command/metaphoneAlgorithm.scala | 52 ++++++++++++++++++++++ .../hashtree/stringmetric/cli/command/nysiis.scala | 52 ---------------------- .../stringmetric/cli/command/nysiisAlgorithm.scala | 52 ++++++++++++++++++++++ .../stringmetric/cli/command/refinedSoundex.scala | 52 ---------------------- .../cli/command/refinedSoundexAlgorithm.scala | 52 ++++++++++++++++++++++ .../stringmetric/cli/command/soundex.scala | 52 ---------------------- .../cli/command/soundexAlgorithm.scala | 52 ++++++++++++++++++++++ .../cli/command/metaphoneAlgorithmSpec.scala | 39 ++++++++++++++++ .../stringmetric/cli/command/metaphoneSpec.scala | 39 ---------------- .../cli/command/nysiisAlgorithmSpec.scala | 39 ++++++++++++++++ .../stringmetric/cli/command/nysiisSpec.scala | 39 ---------------- .../cli/command/refinedSoundexAlgorithmSpec.scala | 39 ++++++++++++++++ .../cli/command/refinedSoundexSpec.scala | 39 ---------------- .../cli/command/soundexAlgorithmSpec.scala | 39 ++++++++++++++++ .../stringmetric/cli/command/soundexSpec.scala | 39 ---------------- 16 files changed, 364 insertions(+), 364 deletions(-) delete mode 100755 cli/source/core/scala/org/hashtree/stringmetric/cli/command/metaphone.scala create mode 100755 cli/source/core/scala/org/hashtree/stringmetric/cli/command/metaphoneAlgorithm.scala delete mode 100755 cli/source/core/scala/org/hashtree/stringmetric/cli/command/nysiis.scala create mode 100755 cli/source/core/scala/org/hashtree/stringmetric/cli/command/nysiisAlgorithm.scala delete mode 100755 cli/source/core/scala/org/hashtree/stringmetric/cli/command/refinedSoundex.scala create mode 100755 cli/source/core/scala/org/hashtree/stringmetric/cli/command/refinedSoundexAlgorithm.scala delete mode 100755 cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundex.scala create mode 100755 cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundexAlgorithm.scala create mode 100755 cli/source/test/scala/org/hashtree/stringmetric/cli/command/metaphoneAlgorithmSpec.scala delete mode 100755 cli/source/test/scala/org/hashtree/stringmetric/cli/command/metaphoneSpec.scala create mode 100755 cli/source/test/scala/org/hashtree/stringmetric/cli/command/nysiisAlgorithmSpec.scala delete mode 100755 cli/source/test/scala/org/hashtree/stringmetric/cli/command/nysiisSpec.scala create mode 100755 cli/source/test/scala/org/hashtree/stringmetric/cli/command/refinedSoundexAlgorithmSpec.scala delete mode 100755 cli/source/test/scala/org/hashtree/stringmetric/cli/command/refinedSoundexSpec.scala create mode 100755 cli/source/test/scala/org/hashtree/stringmetric/cli/command/soundexAlgorithmSpec.scala delete mode 100755 cli/source/test/scala/org/hashtree/stringmetric/cli/command/soundexSpec.scala (limited to 'cli/source') diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/metaphone.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/metaphone.scala deleted file mode 100755 index c915a84..0000000 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/metaphone.scala +++ /dev/null @@ -1,52 +0,0 @@ -package org.hashtree.stringmetric.cli.command - -import org.hashtree.stringmetric.StringFilterDelegate -import org.hashtree.stringmetric.cli._ -import org.hashtree.stringmetric.cli.command._ -import org.hashtree.stringmetric.phonetic.Metaphone - -/** - * The Metaphone [[org.hashtree.stringmetric.cli.command.Command]]. Returns the phonetic representation of the - * passed string, per the Metaphone algorithm. - */ -object metaphone extends Command { - override def main(args: Array[String]): Unit = { - val options = OptionMapUtility.toOptionMap(args) - - try { - // Help. - if (options.contains('h) || options.contains('help)) { - help() - exit(options) - // Execute. - } else if (options.contains('dashless) && options('dashless).count(_ == ' ') == 0) { - execute(options) - exit(options) - // Invalid syntax. - } else throw new IllegalArgumentException("Expected valid syntax. See --help.") - } catch { - case e => error(e)(options) - } - } - - override def help(): Unit = { - val ls = sys.props("line.separator") - val tab = " " - - println( - "Returns the phonetic representation of the passed string, per the Metaphone algorithm." + ls + ls + - "Syntax:" + ls + - tab + "metaphone [Options] string..." + ls + ls + - "Options:" + ls + - tab + "-h, --help" + ls + - tab + tab + "Outputs description, syntax, and options." - ) - } - - override def execute(options: OptionMap): Unit = - println( - Metaphone.compute( - options('dashless) - )(new StringFilterDelegate).getOrElse("not computable").toString - ) -} \ No newline at end of file diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/metaphoneAlgorithm.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/metaphoneAlgorithm.scala new file mode 100755 index 0000000..50f2e8f --- /dev/null +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/metaphoneAlgorithm.scala @@ -0,0 +1,52 @@ +package org.hashtree.stringmetric.cli.command + +import org.hashtree.stringmetric.StringFilterDelegate +import org.hashtree.stringmetric.cli._ +import org.hashtree.stringmetric.cli.command._ +import org.hashtree.stringmetric.phonetic.MetaphoneAlgorithm + +/** + * The metaphoneAlgorithm [[org.hashtree.stringmetric.cli.command.Command]]. Returns the phonetic representation of the + * passed string, per the Metaphone algorithm. + */ +object metaphoneAlgorithm extends Command { + override def main(args: Array[String]): Unit = { + val options = OptionMapUtility.toOptionMap(args) + + try { + // Help. + if (options.contains('h) || options.contains('help)) { + help() + exit(options) + // Execute. + } else if (options.contains('dashless) && options('dashless).count(_ == ' ') == 0) { + execute(options) + exit(options) + // Invalid syntax. + } else throw new IllegalArgumentException("Expected valid syntax. See --help.") + } catch { + case e => error(e)(options) + } + } + + override def help(): Unit = { + val ls = sys.props("line.separator") + val tab = " " + + println( + "Returns the phonetic representation of the passed string, per the Metaphone algorithm." + ls + ls + + "Syntax:" + ls + + tab + "metaphoneAlgorithm [Options] string..." + ls + ls + + "Options:" + ls + + tab + "-h, --help" + ls + + tab + tab + "Outputs description, syntax, and options." + ) + } + + override def execute(options: OptionMap): Unit = + println( + MetaphoneAlgorithm.compute( + options('dashless) + )(new StringFilterDelegate).getOrElse("not computable").toString + ) +} \ No newline at end of file diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/nysiis.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/nysiis.scala deleted file mode 100755 index f9f624e..0000000 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/nysiis.scala +++ /dev/null @@ -1,52 +0,0 @@ -package org.hashtree.stringmetric.cli.command - -import org.hashtree.stringmetric.StringFilterDelegate -import org.hashtree.stringmetric.cli._ -import org.hashtree.stringmetric.cli.command._ -import org.hashtree.stringmetric.phonetic.Nysiis - -/** - * The NYSIIS [[org.hashtree.stringmetric.cli.command.Command]]. Returns the phonetic representation of the - * passed string, per the NYSIIS algorithm. - */ -object nysiis extends Command { - override def main(args: Array[String]): Unit = { - val options = OptionMapUtility.toOptionMap(args) - - try { - // Help. - if (options.contains('h) || options.contains('help)) { - help() - exit(options) - // Execute. - } else if (options.contains('dashless) && options('dashless).count(_ == ' ') == 0) { - execute(options) - exit(options) - // Invalid syntax. - } else throw new IllegalArgumentException("Expected valid syntax. See --help.") - } catch { - case e => error(e)(options) - } - } - - override def help(): Unit = { - val ls = sys.props("line.separator") - val tab = " " - - println( - "Returns the phonetic representation of the passed string, per the NYSIIS algorithm." + ls + ls + - "Syntax:" + ls + - tab + "nysiis [Options] string..." + ls + ls + - "Options:" + ls + - tab + "-h, --help" + ls + - tab + tab + "Outputs description, syntax, and options." - ) - } - - override def execute(options: OptionMap): Unit = - println( - Nysiis.compute( - options('dashless) - )(new StringFilterDelegate).getOrElse("not computable").toString - ) -} \ No newline at end of file diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/nysiisAlgorithm.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/nysiisAlgorithm.scala new file mode 100755 index 0000000..b4f4130 --- /dev/null +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/nysiisAlgorithm.scala @@ -0,0 +1,52 @@ +package org.hashtree.stringmetric.cli.command + +import org.hashtree.stringmetric.StringFilterDelegate +import org.hashtree.stringmetric.cli._ +import org.hashtree.stringmetric.cli.command._ +import org.hashtree.stringmetric.phonetic.NysiisAlgorithm + +/** + * The nysiisAlgorithm [[org.hashtree.stringmetric.cli.command.Command]]. Returns the phonetic representation of the + * passed string, per the NYSIIS algorithm. + */ +object nysiisAlgorithm extends Command { + override def main(args: Array[String]): Unit = { + val options = OptionMapUtility.toOptionMap(args) + + try { + // Help. + if (options.contains('h) || options.contains('help)) { + help() + exit(options) + // Execute. + } else if (options.contains('dashless) && options('dashless).count(_ == ' ') == 0) { + execute(options) + exit(options) + // Invalid syntax. + } else throw new IllegalArgumentException("Expected valid syntax. See --help.") + } catch { + case e => error(e)(options) + } + } + + override def help(): Unit = { + val ls = sys.props("line.separator") + val tab = " " + + println( + "Returns the phonetic representation of the passed string, per the NYSIIS algorithm." + ls + ls + + "Syntax:" + ls + + tab + "nysiisAlgorithm [Options] string..." + ls + ls + + "Options:" + ls + + tab + "-h, --help" + ls + + tab + tab + "Outputs description, syntax, and options." + ) + } + + override def execute(options: OptionMap): Unit = + println( + NysiisAlgorithm.compute( + options('dashless) + )(new StringFilterDelegate).getOrElse("not computable").toString + ) +} \ No newline at end of file diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/refinedSoundex.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/refinedSoundex.scala deleted file mode 100755 index f1b4123..0000000 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/refinedSoundex.scala +++ /dev/null @@ -1,52 +0,0 @@ -package org.hashtree.stringmetric.cli.command - -import org.hashtree.stringmetric.StringFilterDelegate -import org.hashtree.stringmetric.cli._ -import org.hashtree.stringmetric.cli.command._ -import org.hashtree.stringmetric.phonetic.RefinedSoundex - -/** - * The refined Soundex [[org.hashtree.stringmetric.cli.command.Command]]. Returns the phonetic representation of the - * passed string, per the refined Soundex algorithm. - */ -object refinedSoundex extends Command { - override def main(args: Array[String]): Unit = { - val options = OptionMapUtility.toOptionMap(args) - - try { - // Help. - if (options.contains('h) || options.contains('help)) { - help() - exit(options) - // Execute. - } else if (options.contains('dashless) && options('dashless).count(_ == ' ') == 0) { - execute(options) - exit(options) - // Invalid syntax. - } else throw new IllegalArgumentException("Expected valid syntax. See --help.") - } catch { - case e => error(e)(options) - } - } - - override def help(): Unit = { - val ls = sys.props("line.separator") - val tab = " " - - println( - "Returns the phonetic representation of the passed string, per the refined Soundex algorithm." + ls + ls + - "Syntax:" + ls + - tab + "refinedSoundex [Options] string..." + ls + ls + - "Options:" + ls + - tab + "-h, --help" + ls + - tab + tab + "Outputs description, syntax, and options." - ) - } - - override def execute(options: OptionMap): Unit = - println( - RefinedSoundex.compute( - options('dashless) - )(new StringFilterDelegate).getOrElse("not computable").toString - ) -} \ No newline at end of file diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/refinedSoundexAlgorithm.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/refinedSoundexAlgorithm.scala new file mode 100755 index 0000000..d935e71 --- /dev/null +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/refinedSoundexAlgorithm.scala @@ -0,0 +1,52 @@ +package org.hashtree.stringmetric.cli.command + +import org.hashtree.stringmetric.StringFilterDelegate +import org.hashtree.stringmetric.cli._ +import org.hashtree.stringmetric.cli.command._ +import org.hashtree.stringmetric.phonetic.RefinedSoundexAlgorithm + +/** + * The refinedSoundexAlgorithm [[org.hashtree.stringmetric.cli.command.Command]]. Returns the phonetic representation of the + * passed string, per the refined Soundex algorithm. + */ +object refinedSoundexAlgorithm extends Command { + override def main(args: Array[String]): Unit = { + val options = OptionMapUtility.toOptionMap(args) + + try { + // Help. + if (options.contains('h) || options.contains('help)) { + help() + exit(options) + // Execute. + } else if (options.contains('dashless) && options('dashless).count(_ == ' ') == 0) { + execute(options) + exit(options) + // Invalid syntax. + } else throw new IllegalArgumentException("Expected valid syntax. See --help.") + } catch { + case e => error(e)(options) + } + } + + override def help(): Unit = { + val ls = sys.props("line.separator") + val tab = " " + + println( + "Returns the phonetic representation of the passed string, per the refined Soundex algorithm." + ls + ls + + "Syntax:" + ls + + tab + "refinedSoundexAlgorithm [Options] string..." + ls + ls + + "Options:" + ls + + tab + "-h, --help" + ls + + tab + tab + "Outputs description, syntax, and options." + ) + } + + override def execute(options: OptionMap): Unit = + println( + RefinedSoundexAlgorithm.compute( + options('dashless) + )(new StringFilterDelegate).getOrElse("not computable").toString + ) +} \ No newline at end of file diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundex.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundex.scala deleted file mode 100755 index 0a2ed0b..0000000 --- a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundex.scala +++ /dev/null @@ -1,52 +0,0 @@ -package org.hashtree.stringmetric.cli.command - -import org.hashtree.stringmetric.StringFilterDelegate -import org.hashtree.stringmetric.cli._ -import org.hashtree.stringmetric.cli.command._ -import org.hashtree.stringmetric.phonetic.Soundex - -/** - * The Soundex [[org.hashtree.stringmetric.cli.command.Command]]. Returns the phonetic representation of the - * passed string, per the Soundex algorithm. - */ -object soundex extends Command { - override def main(args: Array[String]): Unit = { - val options = OptionMapUtility.toOptionMap(args) - - try { - // Help. - if (options.contains('h) || options.contains('help)) { - help() - exit(options) - // Execute. - } else if (options.contains('dashless) && options('dashless).count(_ == ' ') == 0) { - execute(options) - exit(options) - // Invalid syntax. - } else throw new IllegalArgumentException("Expected valid syntax. See --help.") - } catch { - case e => error(e)(options) - } - } - - override def help(): Unit = { - val ls = sys.props("line.separator") - val tab = " " - - println( - "Returns the phonetic representation of the passed string, per the Soundex algorithm." + ls + ls + - "Syntax:" + ls + - tab + "soundex [Options] string..." + ls + ls + - "Options:" + ls + - tab + "-h, --help" + ls + - tab + tab + "Outputs description, syntax, and options." - ) - } - - override def execute(options: OptionMap): Unit = - println( - Soundex.compute( - options('dashless) - )(new StringFilterDelegate).getOrElse("not computable").toString - ) -} \ No newline at end of file diff --git a/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundexAlgorithm.scala b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundexAlgorithm.scala new file mode 100755 index 0000000..ba64498 --- /dev/null +++ b/cli/source/core/scala/org/hashtree/stringmetric/cli/command/soundexAlgorithm.scala @@ -0,0 +1,52 @@ +package org.hashtree.stringmetric.cli.command + +import org.hashtree.stringmetric.StringFilterDelegate +import org.hashtree.stringmetric.cli._ +import org.hashtree.stringmetric.cli.command._ +import org.hashtree.stringmetric.phonetic.SoundexAlgorithm + +/** + * The soundexAlgorithm [[org.hashtree.stringmetric.cli.command.Command]]. Returns the phonetic representation of the + * passed string, per the Soundex algorithm. + */ +object soundexAlgorithm extends Command { + override def main(args: Array[String]): Unit = { + val options = OptionMapUtility.toOptionMap(args) + + try { + // Help. + if (options.contains('h) || options.contains('help)) { + help() + exit(options) + // Execute. + } else if (options.contains('dashless) && options('dashless).count(_ == ' ') == 0) { + execute(options) + exit(options) + // Invalid syntax. + } else throw new IllegalArgumentException("Expected valid syntax. See --help.") + } catch { + case e => error(e)(options) + } + } + + override def help(): Unit = { + val ls = sys.props("line.separator") + val tab = " " + + println( + "Returns the phonetic representation of the passed string, per the Soundex algorithm." + ls + ls + + "Syntax:" + ls + + tab + "soundexAlgorithm [Options] string..." + ls + ls + + "Options:" + ls + + tab + "-h, --help" + ls + + tab + tab + "Outputs description, syntax, and options." + ) + } + + override def execute(options: OptionMap): Unit = + println( + SoundexAlgorithm.compute( + options('dashless) + )(new StringFilterDelegate).getOrElse("not computable").toString + ) +} \ No newline at end of file diff --git a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/metaphoneAlgorithmSpec.scala b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/metaphoneAlgorithmSpec.scala new file mode 100755 index 0000000..5de40e4 --- /dev/null +++ b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/metaphoneAlgorithmSpec.scala @@ -0,0 +1,39 @@ +package org.hashtree.stringmetric.cli.command + +import org.hashtree.stringmetric.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] + } + } + } + } +} \ No newline at end of file diff --git a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/metaphoneSpec.scala b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/metaphoneSpec.scala deleted file mode 100755 index 38b07fb..0000000 --- a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/metaphoneSpec.scala +++ /dev/null @@ -1,39 +0,0 @@ -package org.hashtree.stringmetric.cli.command - -import org.hashtree.stringmetric.ScalaTest -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -final class metaphoneSpec extends ScalaTest { - "metaphone" should provide { - "main method" when passed { - "valid dashless argument" should executes { - "print phonetic representation" in { - val out = new java.io.ByteArrayOutputStream() - - Console.withOut(out)( - metaphone.main(Array("--unitTest", "--debug", "aBc")) - ) - - out.toString should equal ("abk\n") - out.reset() - - Console.withOut(out)( - metaphone.main(Array("--unitTest", "--debug", "1")) - ) - - out.toString should equal ("not computable\n") - out.reset() - } - } - "no dashless argument" should throws { - "IllegalArgumentException" in { - evaluating { - metaphone.main(Array("--unitTest", "--debug")) - } should produce [IllegalArgumentException] - } - } - } - } -} \ No newline at end of file diff --git a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/nysiisAlgorithmSpec.scala b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/nysiisAlgorithmSpec.scala new file mode 100755 index 0000000..957a098 --- /dev/null +++ b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/nysiisAlgorithmSpec.scala @@ -0,0 +1,39 @@ +package org.hashtree.stringmetric.cli.command + +import org.hashtree.stringmetric.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] + } + } + } + } +} \ No newline at end of file diff --git a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/nysiisSpec.scala b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/nysiisSpec.scala deleted file mode 100755 index eddf3da..0000000 --- a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/nysiisSpec.scala +++ /dev/null @@ -1,39 +0,0 @@ -package org.hashtree.stringmetric.cli.command - -import org.hashtree.stringmetric.ScalaTest -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -final class nysiisSpec extends ScalaTest { - "nysiis" should provide { - "main method" when passed { - "valid dashless argument" should executes { - "print phonetic representation" in { - val out = new java.io.ByteArrayOutputStream() - - Console.withOut(out)( - nysiis.main(Array("--unitTest", "--debug", "aBc")) - ) - - out.toString should equal ("abc\n") - out.reset() - - Console.withOut(out)( - nysiis.main(Array("--unitTest", "--debug", "1")) - ) - - out.toString should equal ("not computable\n") - out.reset() - } - } - "no dashless argument" should throws { - "IllegalArgumentException" in { - evaluating { - nysiis.main(Array("--unitTest", "--debug")) - } should produce [IllegalArgumentException] - } - } - } - } -} \ No newline at end of file diff --git a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/refinedSoundexAlgorithmSpec.scala b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/refinedSoundexAlgorithmSpec.scala new file mode 100755 index 0000000..d8c9ce6 --- /dev/null +++ b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/refinedSoundexAlgorithmSpec.scala @@ -0,0 +1,39 @@ +package org.hashtree.stringmetric.cli.command + +import org.hashtree.stringmetric.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] + } + } + } + } +} \ No newline at end of file diff --git a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/refinedSoundexSpec.scala b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/refinedSoundexSpec.scala deleted file mode 100755 index ae338d1..0000000 --- a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/refinedSoundexSpec.scala +++ /dev/null @@ -1,39 +0,0 @@ -package org.hashtree.stringmetric.cli.command - -import org.hashtree.stringmetric.ScalaTest -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -final class refinedSoundexSpec extends ScalaTest { - "refinedSoundex" should provide { - "main method" when passed { - "valid dashless argument" should executes { - "print phonetic representation" in { - val out = new java.io.ByteArrayOutputStream() - - Console.withOut(out)( - refinedSoundex.main(Array("--unitTest", "--debug", "aBc")) - ) - - out.toString should equal ("a013\n") - out.reset() - - Console.withOut(out)( - refinedSoundex.main(Array("--unitTest", "--debug", "1")) - ) - - out.toString should equal ("not computable\n") - out.reset() - } - } - "no dashless argument" should throws { - "IllegalArgumentException" in { - evaluating { - refinedSoundex.main(Array("--unitTest", "--debug")) - } should produce [IllegalArgumentException] - } - } - } - } -} \ No newline at end of file diff --git a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/soundexAlgorithmSpec.scala b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/soundexAlgorithmSpec.scala new file mode 100755 index 0000000..05ba8ae --- /dev/null +++ b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/soundexAlgorithmSpec.scala @@ -0,0 +1,39 @@ +package org.hashtree.stringmetric.cli.command + +import org.hashtree.stringmetric.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] + } + } + } + } +} \ No newline at end of file diff --git a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/soundexSpec.scala b/cli/source/test/scala/org/hashtree/stringmetric/cli/command/soundexSpec.scala deleted file mode 100755 index c25191a..0000000 --- a/cli/source/test/scala/org/hashtree/stringmetric/cli/command/soundexSpec.scala +++ /dev/null @@ -1,39 +0,0 @@ -package org.hashtree.stringmetric.cli.command - -import org.hashtree.stringmetric.ScalaTest -import org.junit.runner.RunWith -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -final class soundexSpec extends ScalaTest { - "soundex" should provide { - "main method" when passed { - "valid dashless argument" should executes { - "print phonetic representation" in { - val out = new java.io.ByteArrayOutputStream() - - Console.withOut(out)( - soundex.main(Array("--unitTest", "--debug", "aBc")) - ) - - out.toString should equal ("a120\n") - out.reset() - - Console.withOut(out)( - soundex.main(Array("--unitTest", "--debug", "1")) - ) - - out.toString should equal ("not computable\n") - out.reset() - } - } - "no dashless argument" should throws { - "IllegalArgumentException" in { - evaluating { - soundex.main(Array("--unitTest", "--debug")) - } should produce [IllegalArgumentException] - } - } - } - } -} \ No newline at end of file -- cgit v1.2.3