diff options
author | Rocky Madden <git@rockymadden.com> | 2012-10-15 21:53:21 -0600 |
---|---|---|
committer | Rocky Madden <git@rockymadden.com> | 2012-10-15 21:53:21 -0600 |
commit | 0db51ce1fe68371efb9010810ce93d93f48c50d0 (patch) | |
tree | 9ceb35a45800672d168de3438cb0bbdfc94a7c03 /core/source/test | |
parent | fca3092370731e8cae29a4e52ebc33488e9ec3a1 (diff) | |
download | stringmetric-0db51ce1fe68371efb9010810ce93d93f48c50d0.tar.gz stringmetric-0db51ce1fe68371efb9010810ce93d93f48c50d0.tar.bz2 stringmetric-0db51ce1fe68371efb9010810ce93d93f48c50d0.zip |
Created HammingMetric, spec, and command.
Diffstat (limited to 'core/source/test')
-rwxr-xr-x | core/source/test/scala/org/hashtree/stringmetric/HammingMetricSpec.scala | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/core/source/test/scala/org/hashtree/stringmetric/HammingMetricSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/HammingMetricSpec.scala new file mode 100755 index 0000000..641bbde --- /dev/null +++ b/core/source/test/scala/org/hashtree/stringmetric/HammingMetricSpec.scala @@ -0,0 +1,25 @@ +package org.hashtree.stringmetric + +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class HammingMetricSpec extends ScalaTest { + "HammingMetric" should provide { + "compare method" when passed { + "valid arguments" should returns { + "Int indicating distance" in { + HammingMetric.compare("", "").isDefined should be (false) + HammingMetric.compare("abc", "").isDefined should be (false) + HammingMetric.compare("", "xyz").isDefined should be (false) + + HammingMetric.compare("abc", "abc").get should be (0) + HammingMetric.compare("abc", "xyz").get should be (3) + HammingMetric.compare("toned", "roses").get should be (3) + HammingMetric.compare("1011101", "1001001").get should be (2) + HammingMetric.compare("2173896", "2233796").get should be (3) + } + } + } + } +}
\ No newline at end of file |