blob: 18609847ab7614dea168d0fc763c99b483a7e848 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package org.hashtree.stringmetric.similarity
import org.hashtree.stringmetric.ScalaTest
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
final class DiceSorensenMetricSpec extends ScalaTest {
"DiceSorensenMetric" should provide {
"compare method" when passed {
"empty arguments" should returns {
"None" in {
DiceSorensenMetric.compare("", "").isDefined should be (false)
DiceSorensenMetric.compare("abc", "").isDefined should be (false)
DiceSorensenMetric.compare("", "xyz").isDefined should be (false)
}
}
"equal arguments" should returns {
"1" in {
DiceSorensenMetric.compare("abc", "abc").get should be (1.0f)
}
}
"unequal arguments" should returns {
"0" in {
DiceSorensenMetric.compare("abc", "xyz").get should be (0.0f)
}
}
"valid arguments" should returns {
"Float indicating distance" in {
DiceSorensenMetric.compare("night", "nacht").get should be (0.25f)
}
}
}
}
}
|