diff options
Diffstat (limited to 'core/src/test/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetricSpec.scala')
-rwxr-xr-x | core/src/test/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetricSpec.scala | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/core/src/test/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetricSpec.scala b/core/src/test/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetricSpec.scala new file mode 100755 index 0000000..05401b0 --- /dev/null +++ b/core/src/test/scala/com/rockymadden/stringmetric/phonetic/MetaphoneMetricSpec.scala @@ -0,0 +1,39 @@ +package com.rockymadden.stringmetric.phonetic + +import com.rockymadden.stringmetric.ScalaTest +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class MetaphoneMetricSpec extends ScalaTest { "MetaphoneMetric" should provide { + "compare method" when passed { + "empty arguments" should returns { + "None" in { + MetaphoneMetric.compare("", "").isDefined should be (false) + MetaphoneMetric.compare("abc", "").isDefined should be (false) + MetaphoneMetric.compare("", "xyz").isDefined should be (false) + } + } + "non-phonetic arguments" should returns { + "None" in { + MetaphoneMetric.compare("123", "123").isDefined should be (false) + MetaphoneMetric.compare("123", "").isDefined should be (false) + MetaphoneMetric.compare("", "123").isDefined should be (false) + } + } + "phonetically similar arguments" should returns { + "Boolean indicating true" in { + MetaphoneMetric.compare("dumb", "dum").get should be (true) + MetaphoneMetric.compare("smith", "smeth").get should be (true) + MetaphoneMetric.compare("merci", "mercy").get should be (true) + } + } + "phonetically dissimilar arguments" should returns { + "Boolean indicating false" in { + MetaphoneMetric.compare("dumb", "gum").get should be (false) + MetaphoneMetric.compare("smith", "kiss").get should be (false) + MetaphoneMetric.compare("merci", "burpy").get should be (false) + } + } + } +}} |