summaryrefslogtreecommitdiff
path: root/core/src/test/scala/com/rockymadden/stringmetric/AlphabetSpec.scala
diff options
context:
space:
mode:
authorRocky Madden <git@rockymadden.com>2014-01-02 13:47:43 -0700
committerRocky Madden <git@rockymadden.com>2014-01-02 13:47:43 -0700
commit49de854bb464f1be37fbb27f942b9b65e52df751 (patch)
tree6c9a27ac1264648f67eba9c8707fa87d3dc5b3cd /core/src/test/scala/com/rockymadden/stringmetric/AlphabetSpec.scala
parent42b990a1523a68717afcbdbc2cc4968c041451ec (diff)
downloadstringmetric-49de854bb464f1be37fbb27f942b9b65e52df751.tar.gz
stringmetric-49de854bb464f1be37fbb27f942b9b65e52df751.tar.bz2
stringmetric-49de854bb464f1be37fbb27f942b9b65e52df751.zip
Moved from gradle to sbt.
Diffstat (limited to 'core/src/test/scala/com/rockymadden/stringmetric/AlphabetSpec.scala')
-rwxr-xr-xcore/src/test/scala/com/rockymadden/stringmetric/AlphabetSpec.scala95
1 files changed, 95 insertions, 0 deletions
diff --git a/core/src/test/scala/com/rockymadden/stringmetric/AlphabetSpec.scala b/core/src/test/scala/com/rockymadden/stringmetric/AlphabetSpec.scala
new file mode 100755
index 0000000..5a6a1dc
--- /dev/null
+++ b/core/src/test/scala/com/rockymadden/stringmetric/AlphabetSpec.scala
@@ -0,0 +1,95 @@
+package com.rockymadden.stringmetric
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class AlphabetSpec extends ScalaTest { "Alphabet" should provide {
+ import Alphabet.{Alpha, Vowel}
+
+ "an overloaded isSuperset method which accepts Char" when passed {
+ "non-alphabet argument" should returns {
+ "false" in {
+ Alpha isSuperset '0' should be (false)
+ }
+ }
+ "alphabet argument" should returns {
+ "true" in {
+ Alpha isSuperset 'a' should be (true)
+ Alpha isSuperset 'A' should be (true)
+ }
+ }
+ "non-vowel argument" should returns {
+ "false" in {
+ Vowel isSuperset 'y' should be (false)
+ }
+ }
+ "vowel argument" should returns {
+ "true" in {
+ Vowel isSuperset 'a' should be (true)
+ Vowel isSuperset 'A' should be (true)
+ }
+ }
+ }
+ "an overloaded isSuperset method which accepts Array[Char]" when passed {
+ "empty argument" should returns {
+ "false" in {
+ Alpha isSuperset Array.empty[Char] should be (false)
+ }
+ }
+ "non-alphabet argument" should returns {
+ "false" in {
+ Alpha isSuperset "hi!".toCharArray should be (false)
+ Alpha isSuperset "helloworld!".toCharArray should be (false)
+ }
+ }
+ "alphabet argument" should returns {
+ "true" in {
+ Alpha isSuperset "hi".toCharArray should be (true)
+ Alpha isSuperset "helloworld".toCharArray should be (true)
+ Alpha isSuperset "HI".toCharArray should be (true)
+ Alpha isSuperset "HELLOWORLD".toCharArray should be (true)
+ }
+ }
+ "non-vowel argument" should returns {
+ "false" in {
+ Vowel isSuperset "y".toCharArray should be (false)
+ }
+ }
+ "vowel argument" should returns {
+ "true" in {
+ Vowel isSuperset "a".toCharArray should be (true)
+ Vowel isSuperset "A".toCharArray should be (true)
+ }
+ }
+ }
+ "an overloaded isSuperset method which accepts String" when passed {
+ "empty argument" should returns {
+ "false" in {
+ Alpha isSuperset "" should be (false)
+ }
+ }
+ "non-alphabet argument" should returns {
+ "false" in {
+ Alpha isSuperset "helloworld!" should be (false)
+ }
+ }
+ "alphabet argument" should returns {
+ "true" in {
+ Alpha isSuperset "helloworld" should be (true)
+ Alpha isSuperset "HELLOWORLD" should be (true)
+ }
+ }
+ "non-vowel argument" should returns {
+ "false" in {
+ Vowel isSuperset "y" should be (false)
+ }
+ }
+ "vowel argument" should returns {
+ "true" in {
+ Vowel isSuperset "a" should be (true)
+ Vowel isSuperset "A" should be (true)
+ }
+ }
+ }
+}}