summaryrefslogtreecommitdiff
path: root/core/source/test/scala/com/rockymadden/stringmetric/phonetic/RefinedNysiisMetricSpec.scala
blob: 8c6d9c195798321f72d1d276ff0dc4b1f72e1006 (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
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 RefinedNysiisMetricSpec extends ScalaTest { "RefinedNysiisMetric" should provide {
	"compare method" when passed {
		"empty arguments" should returns {
			"None" in {
				RefinedNysiisMetric.compare("", "").isDefined should be (false)
				RefinedNysiisMetric.compare("abc", "").isDefined should be (false)
				RefinedNysiisMetric.compare("", "xyz").isDefined should be (false)
			}
		}
		"non-phonetic arguments" should returns {
			"None" in {
				RefinedNysiisMetric.compare("123", "123").isDefined should be (false)
				RefinedNysiisMetric.compare("123", "").isDefined should be (false)
				RefinedNysiisMetric.compare("", "123").isDefined should be (false)
			}
		}
		"phonetically similar arguments" should returns {
			"Boolean indicating true" in {
				RefinedNysiisMetric.compare("ham", "hum").get should be (true)
			}
		}
		"phonetically dissimilar arguments" should returns {
			"Boolean indicating false" in {
				RefinedNysiisMetric.compare("dumb", "gum").get should be (false)
			}
		}
	}
}}