summaryrefslogtreecommitdiff
path: root/core/source/test/scala
diff options
context:
space:
mode:
authorRocky Madden <git@rockymadden.com>2012-11-19 12:24:36 -0700
committerRocky Madden <git@rockymadden.com>2012-11-19 12:24:36 -0700
commite347105de2d80527592533bc060d53de09c7fb78 (patch)
tree9bf89d840219ca68909f9d6e8520dbb348766c1e /core/source/test/scala
parent58269f6db0268e0ad09d9c1d9cb2174535e20acc (diff)
downloadstringmetric-e347105de2d80527592533bc060d53de09c7fb78.tar.gz
stringmetric-e347105de2d80527592533bc060d53de09c7fb78.tar.bz2
stringmetric-e347105de2d80527592533bc060d53de09c7fb78.zip
Expanded methods and created spec.
Diffstat (limited to 'core/source/test/scala')
-rwxr-xr-xcore/source/test/scala/org/hashtree/stringmetric/phonetic/AlphabetSpec.scala125
1 files changed, 125 insertions, 0 deletions
diff --git a/core/source/test/scala/org/hashtree/stringmetric/phonetic/AlphabetSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/phonetic/AlphabetSpec.scala
new file mode 100755
index 0000000..bfd48c6
--- /dev/null
+++ b/core/source/test/scala/org/hashtree/stringmetric/phonetic/AlphabetSpec.scala
@@ -0,0 +1,125 @@
+package org.hashtree.stringmetric.phonetic
+
+import org.hashtree.stringmetric.ScalaTest
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class AlphabetSpec extends ScalaTest {
+ "Alphabet" should provide {
+ "an overloaded is method which accepts a Char" when passed {
+ "non-alphabet argument" should returns {
+ "false" in {
+ Alphabet.is('0') should be (false)
+ }
+ }
+ "alphabet argument" should returns {
+ "true" in {
+ Alphabet.is('a') should be (true)
+ Alphabet.is('A') should be (true)
+ }
+ }
+ }
+ "an overloaded is method which accepts an Array[Char]" when passed {
+ "empty argument" should returns {
+ "false" in {
+ Alphabet.is(Array.empty[Char]) should be (false)
+ }
+ }
+ "non-alphabet argument" should returns {
+ "false" in {
+ Alphabet.is("hi!".toCharArray) should be (false)
+ Alphabet.is("helloworld!".toCharArray) should be (false)
+ }
+ }
+ "alphabet argument" should returns {
+ "true" in {
+ Alphabet.is("hi".toCharArray) should be (true)
+ Alphabet.is("helloworld".toCharArray) should be (true)
+ Alphabet.is("HI".toCharArray) should be (true)
+ Alphabet.is("HELLOWORLD".toCharArray) should be (true)
+ }
+ }
+ }
+ "an overloaded is method which accepts a String" when passed {
+ "empty argument" should returns {
+ "false" in {
+ Alphabet.is("") should be (false)
+ }
+ }
+ "non-alphabet argument" should returns {
+ "false" in {
+ Alphabet.is("helloworld!") should be (false)
+ }
+ }
+ "alphabet argument" should returns {
+ "true" in {
+ Alphabet.is("helloworld") should be (true)
+ Alphabet.is("HELLOWORLD") should be (true)
+ }
+ }
+ }
+ "isSometimesVowel method" when passed {
+ "non-vowel argument" should returns {
+ "false" in {
+ Alphabet.isSometimesVowel('z') should be (false)
+ }
+ }
+ "vowel argument" should returns {
+ "true" in {
+ Alphabet.isSometimesVowel('a') should be (true)
+ Alphabet.isSometimesVowel('A') should be (true)
+ Alphabet.isSometimesVowel('y') should be (true)
+ Alphabet.isSometimesVowel('Y') should be (true)
+ }
+ }
+ }
+ "isVowel method" when passed {
+ "non-vowel argument" should returns {
+ "false" in {
+ Alphabet.isVowel('y') should be (false)
+ }
+ }
+ "vowel argument" should returns {
+ "true" in {
+ Alphabet.isVowel('a') should be (true)
+ Alphabet.isVowel('A') should be (true)
+ }
+ }
+ }
+ "an overloaded startsWith method which accepts an Array[Char]" when passed {
+ "empty argument" should returns {
+ "false" in {
+ Alphabet.startsWith(Array.empty[Char]) should be (false)
+ }
+ }
+ "non-alphabet argument" should returns {
+ "false" in {
+ Alphabet.startsWith("1abc".toCharArray) should be (false)
+ }
+ }
+ "alphabet argument" should returns {
+ "true" in {
+ Alphabet.startsWith("abc".toCharArray) should be (true)
+ }
+ }
+ }
+ "an overloaded startsWith method which accepts a String" when passed {
+ "empty argument" should returns {
+ "false" in {
+ Alphabet.startsWith("") should be (false)
+ }
+ }
+ "non-alphabet argument" should returns {
+ "false" in {
+ Alphabet.startsWith("1abc") should be (false)
+ }
+ }
+ "alphabet argument" should returns {
+ "true" in {
+ Alphabet.startsWith("abc") should be (true)
+ }
+ }
+ }
+ }
+} \ No newline at end of file