summaryrefslogtreecommitdiff
path: root/core/src/test/scala/com/rockymadden/stringmetric/phonetic/NysiisMetricSpec.scala
blob: 7e521016a8fb6161b594c9c7ff7370bbab57b848 (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
package com.rockymadden.stringmetric.phonetic

import com.rockymadden.stringmetric.ScalaTest
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner

@RunWith(classOf[JUnitRunner])
final class NysiisMetricSpec extends ScalaTest {
	"NysiisMetric" should provide {
		"compare method" when passed {
			"empty arguments" should returns {
				"None" in {
					NysiisMetric.compare("", "").isDefined should be (false)
					NysiisMetric.compare("abc", "").isDefined should be (false)
					NysiisMetric.compare("", "xyz").isDefined should be (false)
				}
			}
			"non-phonetic arguments" should returns {
				"None" in {
					NysiisMetric.compare("123", "123").isDefined should be (false)
					NysiisMetric.compare("123", "").isDefined should be (false)
					NysiisMetric.compare("", "123").isDefined should be (false)
				}
			}
			"phonetically similar arguments" should returns {
				"Boolean indicating true" in {
					NysiisMetric.compare("ham", "hum").get should be (true)
				}
			}
			"phonetically dissimilar arguments" should returns {
				"Boolean indicating false" in {
					NysiisMetric.compare("dumb", "gum").get should be (false)
				}
			}
		}
	}
}