blob: e900f835576e09c9db6491e71a966459725bf82d (
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
36
37
38
|
package com.rockymadden.stringmetric
import com.rockymadden.stringmetric.filter.AsciiNumberFilter
import com.rockymadden.stringmetric.phonetic.MetaphoneAlgorithm
import com.rockymadden.stringmetric.similarity.DiceSorensenMetric
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
final class FilterDecoratedSpec extends ScalaTest {
import FilterDecoratedSpec.{Algorithm, Metric}
"Filter decorated metrics" should provide {
"compare method" when passed {
"filterable arguments" should returns {
"filtered results" in {
Metric.compare("123", "456")(1).isDefined should be (false)
Metric.compare("ni123ght", "na456cht")(1).get should be (0.6)
}
}
}
}
"Filter decorated algorithms" should provide {
"compute method" when passed {
"filterable argument" should returns {
"filtered results" in {
Algorithm.compute("456").isDefined should be (false)
Algorithm.compute("du123mb456").get should equal ("tm")
}
}
}
}
}
object FilterDecoratedSpec {
private final val Algorithm = new MetaphoneAlgorithm with AsciiNumberFilter
private final val Metric = new DiceSorensenMetric with AsciiNumberFilter
}
|