summaryrefslogtreecommitdiff
path: root/core/source/test/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmSpec.scala
diff options
context:
space:
mode:
Diffstat (limited to 'core/source/test/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmSpec.scala')
-rwxr-xr-xcore/source/test/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmSpec.scala177
1 files changed, 82 insertions, 95 deletions
diff --git a/core/source/test/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmSpec.scala b/core/source/test/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmSpec.scala
index 254bf06..cc6dc37 100755
--- a/core/source/test/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmSpec.scala
+++ b/core/source/test/scala/com/rockymadden/stringmetric/phonetic/RefinedSoundexAlgorithmSpec.scala
@@ -6,170 +6,157 @@ import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
final class RefinedSoundexAlgorithmSpec extends ScalaTest {
- import RefinedSoundexAlgorithmSpec.Algorithm
-
"RefinedSoundexAlgorithm" should provide {
"compute method" when passed {
"empty argument" should returns {
"None" in {
- Algorithm.compute("").isDefined should be (false)
+ RefinedSoundexAlgorithm.compute("").isDefined should be (false)
}
}
"non-phonetic argument" should returns {
"None" in {
- Algorithm.compute("123").isDefined should be (false)
+ RefinedSoundexAlgorithm.compute("123").isDefined should be (false)
}
}
"phonetic argument" should returns {
"Some" in {
// a
- Algorithm.compute("a").get should equal ("a0")
- Algorithm.compute("aa").get should equal ("a0")
+ RefinedSoundexAlgorithm.compute("a").get should equal ("a0")
+ RefinedSoundexAlgorithm.compute("aa").get should equal ("a0")
// b
- Algorithm.compute("b").get should equal ("b1")
- Algorithm.compute("bb").get should equal ("b1")
+ RefinedSoundexAlgorithm.compute("b").get should equal ("b1")
+ RefinedSoundexAlgorithm.compute("bb").get should equal ("b1")
// c
- Algorithm.compute("c").get should equal ("c3")
- Algorithm.compute("cc").get should equal ("c3")
+ RefinedSoundexAlgorithm.compute("c").get should equal ("c3")
+ RefinedSoundexAlgorithm.compute("cc").get should equal ("c3")
// d
- Algorithm.compute("d").get should equal ("d6")
- Algorithm.compute("dd").get should equal ("d6")
+ RefinedSoundexAlgorithm.compute("d").get should equal ("d6")
+ RefinedSoundexAlgorithm.compute("dd").get should equal ("d6")
// e
- Algorithm.compute("e").get should equal ("e0")
- Algorithm.compute("ee").get should equal ("e0")
+ RefinedSoundexAlgorithm.compute("e").get should equal ("e0")
+ RefinedSoundexAlgorithm.compute("ee").get should equal ("e0")
// f
- Algorithm.compute("f").get should equal ("f2")
- Algorithm.compute("ff").get should equal ("f2")
+ RefinedSoundexAlgorithm.compute("f").get should equal ("f2")
+ RefinedSoundexAlgorithm.compute("ff").get should equal ("f2")
// g
- Algorithm.compute("g").get should equal ("g4")
- Algorithm.compute("gg").get should equal ("g4")
+ RefinedSoundexAlgorithm.compute("g").get should equal ("g4")
+ RefinedSoundexAlgorithm.compute("gg").get should equal ("g4")
// h
- Algorithm.compute("h").get should equal ("h0")
- Algorithm.compute("hh").get should equal ("h0")
+ RefinedSoundexAlgorithm.compute("h").get should equal ("h0")
+ RefinedSoundexAlgorithm.compute("hh").get should equal ("h0")
// i
- Algorithm.compute("i").get should equal ("i0")
- Algorithm.compute("ii").get should equal ("i0")
+ RefinedSoundexAlgorithm.compute("i").get should equal ("i0")
+ RefinedSoundexAlgorithm.compute("ii").get should equal ("i0")
// j
- Algorithm.compute("j").get should equal ("j4")
- Algorithm.compute("jj").get should equal ("j4")
+ RefinedSoundexAlgorithm.compute("j").get should equal ("j4")
+ RefinedSoundexAlgorithm.compute("jj").get should equal ("j4")
// k
- Algorithm.compute("k").get should equal ("k3")
- Algorithm.compute("kk").get should equal ("k3")
+ RefinedSoundexAlgorithm.compute("k").get should equal ("k3")
+ RefinedSoundexAlgorithm.compute("kk").get should equal ("k3")
// l
- Algorithm.compute("l").get should equal ("l7")
- Algorithm.compute("ll").get should equal ("l7")
+ RefinedSoundexAlgorithm.compute("l").get should equal ("l7")
+ RefinedSoundexAlgorithm.compute("ll").get should equal ("l7")
// m
- Algorithm.compute("m").get should equal ("m8")
- Algorithm.compute("mm").get should equal ("m8")
+ RefinedSoundexAlgorithm.compute("m").get should equal ("m8")
+ RefinedSoundexAlgorithm.compute("mm").get should equal ("m8")
// n
- Algorithm.compute("n").get should equal ("n8")
- Algorithm.compute("nn").get should equal ("n8")
+ RefinedSoundexAlgorithm.compute("n").get should equal ("n8")
+ RefinedSoundexAlgorithm.compute("nn").get should equal ("n8")
// o
- Algorithm.compute("o").get should equal ("o0")
- Algorithm.compute("oo").get should equal ("o0")
+ RefinedSoundexAlgorithm.compute("o").get should equal ("o0")
+ RefinedSoundexAlgorithm.compute("oo").get should equal ("o0")
// p
- Algorithm.compute("p").get should equal ("p1")
- Algorithm.compute("pp").get should equal ("p1")
+ RefinedSoundexAlgorithm.compute("p").get should equal ("p1")
+ RefinedSoundexAlgorithm.compute("pp").get should equal ("p1")
// q
- Algorithm.compute("q").get should equal ("q5")
- Algorithm.compute("qq").get should equal ("q5")
+ RefinedSoundexAlgorithm.compute("q").get should equal ("q5")
+ RefinedSoundexAlgorithm.compute("qq").get should equal ("q5")
// r
- Algorithm.compute("r").get should equal ("r9")
- Algorithm.compute("rr").get should equal ("r9")
+ RefinedSoundexAlgorithm.compute("r").get should equal ("r9")
+ RefinedSoundexAlgorithm.compute("rr").get should equal ("r9")
// s
- Algorithm.compute("s").get should equal ("s3")
- Algorithm.compute("ss").get should equal ("s3")
+ RefinedSoundexAlgorithm.compute("s").get should equal ("s3")
+ RefinedSoundexAlgorithm.compute("ss").get should equal ("s3")
// t
- Algorithm.compute("t").get should equal ("t6")
- Algorithm.compute("tt").get should equal ("t6")
+ RefinedSoundexAlgorithm.compute("t").get should equal ("t6")
+ RefinedSoundexAlgorithm.compute("tt").get should equal ("t6")
// u
- Algorithm.compute("u").get should equal ("u0")
- Algorithm.compute("uu").get should equal ("u0")
+ RefinedSoundexAlgorithm.compute("u").get should equal ("u0")
+ RefinedSoundexAlgorithm.compute("uu").get should equal ("u0")
// v
- Algorithm.compute("v").get should equal ("v2")
- Algorithm.compute("vv").get should equal ("v2")
+ RefinedSoundexAlgorithm.compute("v").get should equal ("v2")
+ RefinedSoundexAlgorithm.compute("vv").get should equal ("v2")
// w
- Algorithm.compute("w").get should equal ("w0")
- Algorithm.compute("ww").get should equal ("w0")
+ RefinedSoundexAlgorithm.compute("w").get should equal ("w0")
+ RefinedSoundexAlgorithm.compute("ww").get should equal ("w0")
// x
- Algorithm.compute("x").get should equal ("x5")
- Algorithm.compute("xx").get should equal ("x5")
+ RefinedSoundexAlgorithm.compute("x").get should equal ("x5")
+ RefinedSoundexAlgorithm.compute("xx").get should equal ("x5")
// y
- Algorithm.compute("y").get should equal ("y0")
- Algorithm.compute("yy").get should equal ("y0")
+ RefinedSoundexAlgorithm.compute("y").get should equal ("y0")
+ RefinedSoundexAlgorithm.compute("yy").get should equal ("y0")
// z
- Algorithm.compute("z").get should equal ("z5")
- Algorithm.compute("zz").get should equal ("z5")
+ RefinedSoundexAlgorithm.compute("z").get should equal ("z5")
+ RefinedSoundexAlgorithm.compute("zz").get should equal ("z5")
// Starting with letter then numbers.
- Algorithm.compute("x123456").get should equal ("x5")
- Algorithm.compute("a123456").get should equal ("a0")
- Algorithm.compute("f123456").get should equal ("f2")
+ RefinedSoundexAlgorithm.compute("x123456").get should equal ("x5")
+ RefinedSoundexAlgorithm.compute("a123456").get should equal ("a0")
+ RefinedSoundexAlgorithm.compute("f123456").get should equal ("f2")
// Miscellaneous.
- Algorithm.compute("braz").get should equal ("b1905")
- Algorithm.compute("broz").get should equal ("b1905")
- Algorithm.compute("caren").get should equal ("c30908")
- Algorithm.compute("carren").get should equal ("c30908")
- Algorithm.compute("coram").get should equal ("c30908")
- Algorithm.compute("corran").get should equal ("c30908")
- Algorithm.compute("curreen").get should equal ("c30908")
- Algorithm.compute("curwen").get should equal ("c30908")
- Algorithm.compute("hairs").get should equal ("h093")
- Algorithm.compute("hark").get should equal ("h093")
- Algorithm.compute("hars").get should equal ("h093")
- Algorithm.compute("hayers").get should equal ("h093")
- Algorithm.compute("heers").get should equal ("h093")
- Algorithm.compute("hiers").get should equal ("h093")
- Algorithm.compute("lambard").get should equal ("l7081096")
- Algorithm.compute("lambart").get should equal ("l7081096")
- Algorithm.compute("lambert").get should equal ("l7081096")
- Algorithm.compute("lambird").get should equal ("l7081096")
- Algorithm.compute("lampaert").get should equal ("l7081096")
- Algorithm.compute("lampart").get should equal ("l7081096")
- Algorithm.compute("lamport").get should equal ("l7081096")
- Algorithm.compute("limbert").get should equal ("l7081096")
- Algorithm.compute("lombard").get should equal ("l7081096")
- Algorithm.compute("nolton").get should equal ("n807608")
- Algorithm.compute("noulton").get should equal ("n807608")
+ RefinedSoundexAlgorithm.compute("braz").get should equal ("b1905")
+ RefinedSoundexAlgorithm.compute("broz").get should equal ("b1905")
+ RefinedSoundexAlgorithm.compute("caren").get should equal ("c30908")
+ RefinedSoundexAlgorithm.compute("carren").get should equal ("c30908")
+ RefinedSoundexAlgorithm.compute("coram").get should equal ("c30908")
+ RefinedSoundexAlgorithm.compute("corran").get should equal ("c30908")
+ RefinedSoundexAlgorithm.compute("curreen").get should equal ("c30908")
+ RefinedSoundexAlgorithm.compute("curwen").get should equal ("c30908")
+ RefinedSoundexAlgorithm.compute("hairs").get should equal ("h093")
+ RefinedSoundexAlgorithm.compute("hark").get should equal ("h093")
+ RefinedSoundexAlgorithm.compute("hars").get should equal ("h093")
+ RefinedSoundexAlgorithm.compute("hayers").get should equal ("h093")
+ RefinedSoundexAlgorithm.compute("heers").get should equal ("h093")
+ RefinedSoundexAlgorithm.compute("hiers").get should equal ("h093")
+ RefinedSoundexAlgorithm.compute("lambard").get should equal ("l7081096")
+ RefinedSoundexAlgorithm.compute("lambart").get should equal ("l7081096")
+ RefinedSoundexAlgorithm.compute("lambert").get should equal ("l7081096")
+ RefinedSoundexAlgorithm.compute("lambird").get should equal ("l7081096")
+ RefinedSoundexAlgorithm.compute("lampaert").get should equal ("l7081096")
+ RefinedSoundexAlgorithm.compute("lampart").get should equal ("l7081096")
+ RefinedSoundexAlgorithm.compute("lamport").get should equal ("l7081096")
+ RefinedSoundexAlgorithm.compute("limbert").get should equal ("l7081096")
+ RefinedSoundexAlgorithm.compute("lombard").get should equal ("l7081096")
+ RefinedSoundexAlgorithm.compute("nolton").get should equal ("n807608")
+ RefinedSoundexAlgorithm.compute("noulton").get should equal ("n807608")
}
}
}
}
- "RefinedSoundexAlgorithm companion object" should provide {
- "pass-through compute method" should returns {
- "same value as class" in {
- RefinedSoundexAlgorithm.compute("braz").get should equal ("b1905")
- }
- }
- }
-}
-
-object RefinedSoundexAlgorithmSpec {
- final private val Algorithm = RefinedSoundexAlgorithm()
}