summaryrefslogtreecommitdiff
path: root/core/source/test/scala/com/rockymadden/stringmetric/filter/IgnoreAsciiLetterCaseFilterSpec.scala
blob: a04a0aedc23b2430edfbb1e997f464d60d1ecc6e (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
38
39
40
41
package com.rockymadden.stringmetric.filter

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

@RunWith(classOf[JUnitRunner])
final class IgnoreAsciiLetterCaseFilterSpec extends ScalaTest {
	import IgnoreAsciiLetterCaseFilterSpec.Filter

	"IgnoreAsciiLetterCaseFilter" should provide {
		"overloaded filter method" when passed {
			"String with mixed case" should returns {
				"String with the same case" in {
					Filter.filter("HelloWorld") should (equal ("helloworld") or equal ("HELLOWORLD"))
					Filter.filter("Hello World") should (equal ("hello world") or equal ("HELLO WORLD"))
					Filter.filter("H e l l o W o r l d") should
						(equal ("h e l l o w o r l d") or equal ("H E L L O W O R L D"))
					Filter.filter("H  e  l  l  o  W  o  r  l  d") should
						(equal ("h  e  l  l  o  w  o  r  l  d") or equal ("H  E  L  L  O  W  O  R  L  D"))
				}
			}
			"character array with mixed case" should returns {
				"character array with the same case" in {
					Filter.filter("HelloWorld".toCharArray) should
						(equal ("helloworld".toCharArray) or equal ("HELLOWORLD".toCharArray))
					Filter.filter("Hello World".toCharArray) should
						(equal ("hello world".toCharArray) or equal ("HELLO WORLD".toCharArray))
					Filter.filter("H e l l o W o r l d".toCharArray) should
						(equal ("h e l l o w o r l d".toCharArray) or equal ("H E L L O W O R L D".toCharArray))
					Filter.filter("H  e  l  l  o  W  o  r  l  d".toCharArray) should
						(equal ("h  e  l  l  o  w  o  r  l  d".toCharArray) or equal ("H  E  L  L  O  W  O  R  L  D".toCharArray))
				}
			}
		}
	}
}

object IgnoreAsciiLetterCaseFilterSpec {
	private final val Filter = new StringFilterDelegate with IgnoreAsciiLetterCaseFilter
}