diff options
Diffstat (limited to 'core/src/test/scala/com/rockymadden/stringmetric/AlgorithmSpec.scala')
-rw-r--r-- | core/src/test/scala/com/rockymadden/stringmetric/AlgorithmSpec.scala | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/core/src/test/scala/com/rockymadden/stringmetric/AlgorithmSpec.scala b/core/src/test/scala/com/rockymadden/stringmetric/AlgorithmSpec.scala new file mode 100644 index 0000000..d727145 --- /dev/null +++ b/core/src/test/scala/com/rockymadden/stringmetric/AlgorithmSpec.scala @@ -0,0 +1,34 @@ +package com.rockymadden.stringmetric + +import org.junit.runner.RunWith +import org.scalatest.junit.JUnitRunner + +@RunWith(classOf[JUnitRunner]) +final class AlgorithmSpec extends ScalaTest { + import phonetic._ + import Algorithm._ + import Transform.StringTransform + + "StringAlgorithm" should provide { + "compute method and companion object pass through" in { + StringAlgorithm.computeWithMetaphone("testone").get should + equal (MetaphoneAlgorithm.compute("testone".toCharArray).get) + StringAlgorithm.computeWithNysiis("testone").get should + equal (NysiisAlgorithm.compute("testone".toCharArray).get) + StringAlgorithm.computeWithRefinedNysiis("testone").get should + equal (RefinedNysiisAlgorithm.compute("testone".toCharArray).get) + StringAlgorithm.computeWithRefinedSoundex("testone").get should + equal (RefinedSoundexAlgorithm.compute("testone".toCharArray).get) + StringAlgorithm.computeWithSoundex("testone").get should + equal (SoundexAlgorithm.compute("testone".toCharArray).get) + } + } + + "StringAlgorithmDecorator" should provide { + "withTransform()" in { + (MetaphoneAlgorithm withTransform StringTransform.filterAlpha).compute("abc123").get should + equal (MetaphoneAlgorithm.compute("abc").get) + } + } +} + |