summaryrefslogtreecommitdiff
path: root/core/source/test/scala/org/hashtree/stringmetric/JaroWinklerMetricSpec.scala
diff options
context:
space:
mode:
authorRocky Madden <git@rockymadden.com>2012-10-06 23:19:20 -0600
committerRocky Madden <git@rockymadden.com>2012-10-06 23:19:20 -0600
commitdadd1221ec7c1301b3cc2dfc178dba2091e1f9b8 (patch)
treece698016721cdc2636d66742d705b232ad1c9fe9 /core/source/test/scala/org/hashtree/stringmetric/JaroWinklerMetricSpec.scala
downloadstringmetric-dadd1221ec7c1301b3cc2dfc178dba2091e1f9b8.tar.gz
stringmetric-dadd1221ec7c1301b3cc2dfc178dba2091e1f9b8.tar.bz2
stringmetric-dadd1221ec7c1301b3cc2dfc178dba2091e1f9b8.zip
Created repository.v0.0.0
Diffstat (limited to 'core/source/test/scala/org/hashtree/stringmetric/JaroWinklerMetricSpec.scala')
-rwxr-xr-xcore/source/test/scala/org/hashtree/stringmetric/JaroWinklerMetricSpec.scala54
1 files changed, 54 insertions, 0 deletions
diff --git a/core/source/test/scala/org/hashtree/stringmetric/JaroWinklerMetricSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/JaroWinklerMetricSpec.scala
new file mode 100755
index 0000000..6e044a0
--- /dev/null
+++ b/core/source/test/scala/org/hashtree/stringmetric/JaroWinklerMetricSpec.scala
@@ -0,0 +1,54 @@
+package org.hashtree.stringmetric
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class JaroWinklerMetricSpec extends ScalaTest {
+ "JaroWinklerMetric" should provide {
+ "compare method" when passed {
+ "valid arguments" should returns {
+ "Float indicating distance" in {
+ JaroWinklerMetric.compare("abc", "abc") should be (1.0f)
+ JaroWinklerMetric.compare("abc", "xyz") should be (0.0f)
+ JaroWinklerMetric.compare("abc", "") should be (0.0f)
+ JaroWinklerMetric.compare("", "xyz") should be (0.0f)
+ JaroWinklerMetric.compare("", "") should be (0.0f)
+ JaroWinklerMetric.compare("a", "a") should be (1.0f)
+
+ JaroWinklerMetric.compare("aa", "a") should be (0.84999996f)
+ JaroWinklerMetric.compare("a", "aa") should be (0.84999996f)
+
+ JaroWinklerMetric.compare("veryveryverylong", "v") should be (0.71875f)
+ JaroWinklerMetric.compare("v", "veryveryverylong") should be (0.71875f)
+
+ JaroWinklerMetric.compare("martha", "marhta") should be (0.96111107f)
+ JaroWinklerMetric.compare("dwayne", "duane") should be (0.84000003f)
+ JaroWinklerMetric.compare("dixon", "dicksonx") should be (0.81333333f)
+ JaroWinklerMetric.compare("abcvwxyz", "cabvwxyz") should be (0.9583333f)
+ JaroWinklerMetric.compare("jones", "johnson") should be (0.8323809f)
+ JaroWinklerMetric.compare("henka", "henkan") should be (0.96666664f)
+ JaroWinklerMetric.compare("fvie", "ten") should be (0.0f)
+
+ JaroWinklerMetric.compare("zac ephron", "zac efron") should be >
+ JaroWinklerMetric.compare("zac ephron", "kai ephron")
+ JaroWinklerMetric.compare("brittney spears", "britney spears") should be >
+ JaroWinklerMetric.compare("brittney spears", "brittney startzman")
+
+ JaroWinklerMetric.compare("m a r t h a", "m a r h t a") should be (0.96111107f)
+ JaroWinklerMetric.compare("d w a y n e", "d u a n e") should be (0.84000003f)
+ JaroWinklerMetric.compare("d i x o n", "d i c k s o n x") should be (0.81333333f)
+ JaroWinklerMetric.compare("a b c v w x y z", "c a b v w x y z") should be (0.9583333f)
+ JaroWinklerMetric.compare("j o n e s", "j o h n s o n") should be (0.8323809f)
+ JaroWinklerMetric.compare("h e n k a", "h e n k a n") should be (0.96666664f)
+ JaroWinklerMetric.compare("f v i e", "t e n") should be (0.0f)
+
+ JaroWinklerMetric.compare("z a c e p h r o n", "z a c e f r o n") should be >
+ JaroWinklerMetric.compare("z a c e p h r o n", "k a i e p h r o n")
+ JaroWinklerMetric.compare("b r i t t n e y s p e a r s", "b r i t n e y s p e a r s") should be >
+ JaroWinklerMetric.compare("b r i t t n e y s p e a r s", "b r i t t n e y s t a r t z m a n")
+ }
+ }
+ }
+ }
+} \ No newline at end of file