summaryrefslogtreecommitdiff
path: root/core/src/test/scala/com/rockymadden/stringmetric
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/test/scala/com/rockymadden/stringmetric')
-rw-r--r--core/src/test/scala/com/rockymadden/stringmetric/AlgorithmSpec.scala11
-rw-r--r--core/src/test/scala/com/rockymadden/stringmetric/MetricSpec.scala9
2 files changed, 19 insertions, 1 deletions
diff --git a/core/src/test/scala/com/rockymadden/stringmetric/AlgorithmSpec.scala b/core/src/test/scala/com/rockymadden/stringmetric/AlgorithmSpec.scala
index d727145..b95046d 100644
--- a/core/src/test/scala/com/rockymadden/stringmetric/AlgorithmSpec.scala
+++ b/core/src/test/scala/com/rockymadden/stringmetric/AlgorithmSpec.scala
@@ -7,7 +7,7 @@ import org.scalatest.junit.JUnitRunner
final class AlgorithmSpec extends ScalaTest {
import phonetic._
import Algorithm._
- import Transform.StringTransform
+ import Transform._
"StringAlgorithm" should provide {
"compute method and companion object pass through" in {
@@ -25,6 +25,15 @@ final class AlgorithmSpec extends ScalaTest {
}
"StringAlgorithmDecorator" should provide {
+ "withMemoization()" in {
+ val memo = MetaphoneAlgorithm withMemoization
+
+ (0 until 1000000) foreach { i =>
+ memo.compute("abc123")
+ memo.compute("abc456")
+ }
+ }
+
"withTransform()" in {
(MetaphoneAlgorithm withTransform StringTransform.filterAlpha).compute("abc123").get should
equal (MetaphoneAlgorithm.compute("abc").get)
diff --git a/core/src/test/scala/com/rockymadden/stringmetric/MetricSpec.scala b/core/src/test/scala/com/rockymadden/stringmetric/MetricSpec.scala
index 3b9021d..538976d 100644
--- a/core/src/test/scala/com/rockymadden/stringmetric/MetricSpec.scala
+++ b/core/src/test/scala/com/rockymadden/stringmetric/MetricSpec.scala
@@ -44,6 +44,15 @@ final class MetricSpec extends ScalaTest {
}
"StringMetricDecorator" should provide {
+ "withMemoization()" in {
+ val memo = MetaphoneMetric withMemoization
+
+ (0 until 1000000) foreach { i =>
+ memo.compare("abc123", "abc456")
+ memo.compare("abc456", "abc123")
+ }
+ }
+
"withTransform()" in {
(MetaphoneMetric withTransform StringTransform.filterAlpha).compare("abc123", "abc456").get should
equal (true)