summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRocky Madden <git@rockymadden.com>2012-11-01 09:36:32 -0600
committerRocky Madden <git@rockymadden.com>2012-11-01 09:36:32 -0600
commit9a87202dacd7576359e28137f1eab5c83a84b9c5 (patch)
tree327a46341e2ba80909913af3ae97d8b620fcc26e /core
parentf7a2586e71eac928f1a6c4817f6d6ee99669a249 (diff)
downloadstringmetric-9a87202dacd7576359e28137f1eab5c83a84b9c5.tar.gz
stringmetric-9a87202dacd7576359e28137f1eab5c83a84b9c5.tar.bz2
stringmetric-9a87202dacd7576359e28137f1eab5c83a84b9c5.zip
Created numerous string filters.
Diffstat (limited to 'core')
-rwxr-xr-xcore/source/core/scala/org/hashtree/stringmetric/AsciiControlOnlyStringFilter.scala13
-rwxr-xr-xcore/source/core/scala/org/hashtree/stringmetric/AsciiControlStringFilter.scala13
-rwxr-xr-xcore/source/core/scala/org/hashtree/stringmetric/AsciiLetterCaseStringFilter.scala3
-rwxr-xr-xcore/source/core/scala/org/hashtree/stringmetric/AsciiLetterNumberOnlyStringFilter.scala13
-rwxr-xr-xcore/source/core/scala/org/hashtree/stringmetric/AsciiLetterNumberStringFilter.scala13
-rwxr-xr-xcore/source/core/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringFilter.scala5
-rwxr-xr-xcore/source/core/scala/org/hashtree/stringmetric/AsciiLetterStringFilter.scala13
-rwxr-xr-xcore/source/core/scala/org/hashtree/stringmetric/AsciiNumberOnlyStringFilter.scala13
-rwxr-xr-xcore/source/core/scala/org/hashtree/stringmetric/AsciiNumberStringFilter.scala13
-rwxr-xr-xcore/source/core/scala/org/hashtree/stringmetric/AsciiSymbolOnlyStringFilter.scala13
-rwxr-xr-xcore/source/core/scala/org/hashtree/stringmetric/AsciiSymbolStringFilter.scala13
-rwxr-xr-xcore/source/test/scala/org/hashtree/stringmetric/AsciiControlOnlyStringFilterSpec.scala24
-rwxr-xr-xcore/source/test/scala/org/hashtree/stringmetric/AsciiControlStringFilterSpec.scala24
-rwxr-xr-xcore/source/test/scala/org/hashtree/stringmetric/AsciiLetterNumberOnlyStringFilterSpec.scala26
-rwxr-xr-xcore/source/test/scala/org/hashtree/stringmetric/AsciiLetterNumberStringFilterSpec.scala24
-rwxr-xr-xcore/source/test/scala/org/hashtree/stringmetric/AsciiLetterStringFilterSpec.scala24
-rwxr-xr-xcore/source/test/scala/org/hashtree/stringmetric/AsciiNumberOnlyStringFilterSpec.scala24
-rwxr-xr-xcore/source/test/scala/org/hashtree/stringmetric/AsciiNumberStringFilterSpec.scala24
-rwxr-xr-xcore/source/test/scala/org/hashtree/stringmetric/AsciiSymbolOnlyStringFilterSpec.scala24
-rwxr-xr-xcore/source/test/scala/org/hashtree/stringmetric/AsciiSymbolStringFilterSpec.scala24
20 files changed, 338 insertions, 5 deletions
diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiControlOnlyStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiControlOnlyStringFilter.scala
new file mode 100755
index 0000000..893047f
--- /dev/null
+++ b/core/source/core/scala/org/hashtree/stringmetric/AsciiControlOnlyStringFilter.scala
@@ -0,0 +1,13 @@
+package org.hashtree.stringmetric
+
+/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures only ASCII control characters matter. */
+trait AsciiControlOnlyStringFilter extends StringFilter {
+ abstract override def filter(charArray: Array[Char]): Array[Char] =
+ super.filter(
+ charArray.filter { c =>
+ (c <= 31 || c == 127)
+ }
+ )
+
+ abstract override def filter(string: String): String = filter(string.toCharArray).mkString
+} \ No newline at end of file
diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiControlStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiControlStringFilter.scala
new file mode 100755
index 0000000..5320fcc
--- /dev/null
+++ b/core/source/core/scala/org/hashtree/stringmetric/AsciiControlStringFilter.scala
@@ -0,0 +1,13 @@
+package org.hashtree.stringmetric
+
+/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures ASCII controls do not matter. */
+trait AsciiControlStringFilter extends StringFilter {
+ abstract override def filter(charArray: Array[Char]): Array[Char] =
+ super.filter(
+ charArray.filter { c =>
+ !(c <= 31 || c == 127)
+ }
+ )
+
+ abstract override def filter(string: String): String = filter(string.toCharArray).mkString
+} \ No newline at end of file
diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterCaseStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterCaseStringFilter.scala
index 02da3ae..02e30e3 100755
--- a/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterCaseStringFilter.scala
+++ b/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterCaseStringFilter.scala
@@ -2,13 +2,12 @@ package org.hashtree.stringmetric
/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures ASCII letter case-sensitivity does not matter. */
trait AsciiLetterCaseStringFilter extends StringFilter {
- abstract override def filter(charArray: Array[Char]): Array[Char] = {
+ abstract override def filter(charArray: Array[Char]): Array[Char] =
super.filter(
charArray.map { c =>
if (c >= 65 && c <= 90) (c + 32).toChar else c
}
)
- }
abstract override def filter(string: String): String = filter(string.toCharArray).mkString
} \ No newline at end of file
diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterNumberOnlyStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterNumberOnlyStringFilter.scala
new file mode 100755
index 0000000..fad1d7f
--- /dev/null
+++ b/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterNumberOnlyStringFilter.scala
@@ -0,0 +1,13 @@
+package org.hashtree.stringmetric
+
+/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures only ASCII letters and numbers matter. */
+trait AsciiLetterNumberOnlyStringFilter extends StringFilter {
+ abstract override def filter(charArray: Array[Char]): Array[Char] =
+ super.filter(
+ charArray.filter { c =>
+ ((c >= 48 && c <= 57 ) || (c >= 65 && c <= 90 ) || (c >= 97 && c <= 122))
+ }
+ )
+
+ abstract override def filter(string: String): String = filter(string.toCharArray).mkString
+} \ No newline at end of file
diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterNumberStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterNumberStringFilter.scala
new file mode 100755
index 0000000..e741b74
--- /dev/null
+++ b/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterNumberStringFilter.scala
@@ -0,0 +1,13 @@
+package org.hashtree.stringmetric
+
+/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures ASCII letters and numbers do not matter. */
+trait AsciiLetterNumberStringFilter extends StringFilter {
+ abstract override def filter(charArray: Array[Char]): Array[Char] =
+ super.filter(
+ charArray.filter { c =>
+ !((c >= 48 && c <= 57 ) || (c >= 65 && c <= 90 ) || (c >= 97 && c <= 122))
+ }
+ )
+
+ abstract override def filter(string: String): String = filter(string.toCharArray).mkString
+} \ No newline at end of file
diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringFilter.scala
index ebbc1de..3ec29a2 100755
--- a/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringFilter.scala
+++ b/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterOnlyStringFilter.scala
@@ -2,13 +2,12 @@ package org.hashtree.stringmetric
/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures only ASCII letters matter. */
trait AsciiLetterOnlyStringFilter extends StringFilter {
- abstract override def filter(charArray: Array[Char]): Array[Char] = {
+ abstract override def filter(charArray: Array[Char]): Array[Char] =
super.filter(
charArray.filter { c =>
- (c >= 65 && c <= 90 ) || (c >= 97 && c <= 122)
+ ((c >= 65 && c <= 90 ) || (c >= 97 && c <= 122))
}
)
- }
abstract override def filter(string: String): String = filter(string.toCharArray).mkString
} \ No newline at end of file
diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterStringFilter.scala
new file mode 100755
index 0000000..ca2d013
--- /dev/null
+++ b/core/source/core/scala/org/hashtree/stringmetric/AsciiLetterStringFilter.scala
@@ -0,0 +1,13 @@
+package org.hashtree.stringmetric
+
+/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures ASCII letters do not matter. */
+trait AsciiLetterStringFilter extends StringFilter {
+ abstract override def filter(charArray: Array[Char]): Array[Char] =
+ super.filter(
+ charArray.filter { c =>
+ !((c >= 65 && c <= 90 ) || (c >= 97 && c <= 122))
+ }
+ )
+
+ abstract override def filter(string: String): String = filter(string.toCharArray).mkString
+} \ No newline at end of file
diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiNumberOnlyStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiNumberOnlyStringFilter.scala
new file mode 100755
index 0000000..9b133f6
--- /dev/null
+++ b/core/source/core/scala/org/hashtree/stringmetric/AsciiNumberOnlyStringFilter.scala
@@ -0,0 +1,13 @@
+package org.hashtree.stringmetric
+
+/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures only ASCII numbers matter. */
+trait AsciiNumberOnlyStringFilter extends StringFilter {
+ abstract override def filter(charArray: Array[Char]): Array[Char] =
+ super.filter(
+ charArray.filter { c =>
+ (c >= 48 && c <= 57 )
+ }
+ )
+
+ abstract override def filter(string: String): String = filter(string.toCharArray).mkString
+} \ No newline at end of file
diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiNumberStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiNumberStringFilter.scala
new file mode 100755
index 0000000..f460d31
--- /dev/null
+++ b/core/source/core/scala/org/hashtree/stringmetric/AsciiNumberStringFilter.scala
@@ -0,0 +1,13 @@
+package org.hashtree.stringmetric
+
+/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures ASCII numbers do not matter. */
+trait AsciiNumberStringFilter extends StringFilter {
+ abstract override def filter(charArray: Array[Char]): Array[Char] =
+ super.filter(
+ charArray.filter { c =>
+ !(c >= 48 && c <= 57)
+ }
+ )
+
+ abstract override def filter(string: String): String = filter(string.toCharArray).mkString
+} \ No newline at end of file
diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiSymbolOnlyStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiSymbolOnlyStringFilter.scala
new file mode 100755
index 0000000..e81da87
--- /dev/null
+++ b/core/source/core/scala/org/hashtree/stringmetric/AsciiSymbolOnlyStringFilter.scala
@@ -0,0 +1,13 @@
+package org.hashtree.stringmetric
+
+/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures only ASCII symbols matter. */
+trait AsciiSymbolOnlyStringFilter extends StringFilter {
+ abstract override def filter(charArray: Array[Char]): Array[Char] =
+ super.filter(
+ charArray.filter { c =>
+ ((c >= 32 && c <= 47) || (c >= 58 && c <= 64) || (c >= 91 && c <= 96) || (c >= 123 && c <= 126))
+ }
+ )
+
+ abstract override def filter(string: String): String = filter(string.toCharArray).mkString
+} \ No newline at end of file
diff --git a/core/source/core/scala/org/hashtree/stringmetric/AsciiSymbolStringFilter.scala b/core/source/core/scala/org/hashtree/stringmetric/AsciiSymbolStringFilter.scala
new file mode 100755
index 0000000..0506bca
--- /dev/null
+++ b/core/source/core/scala/org/hashtree/stringmetric/AsciiSymbolStringFilter.scala
@@ -0,0 +1,13 @@
+package org.hashtree.stringmetric
+
+/** A decorator [[org.hashtree.stringmetric.StringFilter]]. Ensures ASCII symbols do not matter. */
+trait AsciiSymbolStringFilter extends StringFilter {
+ abstract override def filter(charArray: Array[Char]): Array[Char] =
+ super.filter(
+ charArray.filter { c =>
+ !((c >= 32 && c <= 47) || (c >= 58 && c <= 64) || (c >= 91 && c <= 96) || (c >= 123 && c <= 126))
+ }
+ )
+
+ abstract override def filter(string: String): String = filter(string.toCharArray).mkString
+} \ No newline at end of file
diff --git a/core/source/test/scala/org/hashtree/stringmetric/AsciiControlOnlyStringFilterSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/AsciiControlOnlyStringFilterSpec.scala
new file mode 100755
index 0000000..91ef72f
--- /dev/null
+++ b/core/source/test/scala/org/hashtree/stringmetric/AsciiControlOnlyStringFilterSpec.scala
@@ -0,0 +1,24 @@
+package org.hashtree.stringmetric
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class AsciiControlOnlyStringFilterSpec extends ScalaTest {
+ private final val Filter = new StringFilterDelegate with AsciiControlOnlyStringFilter
+
+ "AsciiControlOnlyStringFilter" should provide {
+ "overloaded filter method" when passed {
+ "String with mixed characters" should returns {
+ "String with non-controls removed" in {
+ Filter.filter("!@#$% ^&*()abc") should equal (" ")
+ }
+ }
+ "character array with mixed characters" should returns {
+ "character array with non-controls removed" in {
+ Filter.filter("!@#$% ^&*()abc".toCharArray) should equal (" ".toCharArray)
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/core/source/test/scala/org/hashtree/stringmetric/AsciiControlStringFilterSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/AsciiControlStringFilterSpec.scala
new file mode 100755
index 0000000..fe0f501
--- /dev/null
+++ b/core/source/test/scala/org/hashtree/stringmetric/AsciiControlStringFilterSpec.scala
@@ -0,0 +1,24 @@
+package org.hashtree.stringmetric
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class AsciiControlStringFilterSpec extends ScalaTest {
+ private final val Filter = new StringFilterDelegate with AsciiControlStringFilter
+
+ "AsciiControlStringFilter" should provide {
+ "overloaded filter method" when passed {
+ "String with controls" should returns {
+ "String with controls removed" in {
+ Filter.filter(" HelloWorld") should equal ("HelloWorld")
+ }
+ }
+ "character array with controls" should returns {
+ "character array with controls removed" in {
+ Filter.filter(" HelloWorld".toCharArray) should equal ("HelloWorld".toCharArray)
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterNumberOnlyStringFilterSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterNumberOnlyStringFilterSpec.scala
new file mode 100755
index 0000000..fb77932
--- /dev/null
+++ b/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterNumberOnlyStringFilterSpec.scala
@@ -0,0 +1,26 @@
+package org.hashtree.stringmetric
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class AsciiLetterNumberOnlyStringFilterSpec extends ScalaTest {
+ private final val Filter = new StringFilterDelegate with AsciiLetterNumberOnlyStringFilter
+
+ "AsciiLetterNumberOnlyStringFilter" should provide {
+ "overloaded filter method" when passed {
+ "String with mixed characters" should returns {
+ "String with non-letters and non-numbers removed" in {
+ Filter.filter("!@#$%^&*()abc") should equal ("abc")
+ Filter.filter("!@#$%^&*()abc123") should equal ("abc123")
+ }
+ }
+ "character array with mixed characters" should returns {
+ "character array with non-letters and non-numbers removed" in {
+ Filter.filter("!@#$%^&*()abc".toCharArray) should equal ("abc".toCharArray)
+ Filter.filter("!@#$%^&*()abc123".toCharArray) should equal ("abc123".toCharArray)
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterNumberStringFilterSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterNumberStringFilterSpec.scala
new file mode 100755
index 0000000..e1ab9c3
--- /dev/null
+++ b/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterNumberStringFilterSpec.scala
@@ -0,0 +1,24 @@
+package org.hashtree.stringmetric
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class AsciiLetterNumberStringFilterSpec extends ScalaTest {
+ private final val Filter = new StringFilterDelegate with AsciiLetterNumberStringFilter
+
+ "AsciiLetterNumberStringFilter" should provide {
+ "overloaded filter method" when passed {
+ "String with letters and numbers" should returns {
+ "String with letters and numbers removed" in {
+ Filter.filter(" Hello123World!") should equal (" !")
+ }
+ }
+ "character array with letters and numbers" should returns {
+ "character array with letters and numbers removed" in {
+ Filter.filter(" Hello123World!".toCharArray) should equal (" !".toCharArray)
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterStringFilterSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterStringFilterSpec.scala
new file mode 100755
index 0000000..8ce70af
--- /dev/null
+++ b/core/source/test/scala/org/hashtree/stringmetric/AsciiLetterStringFilterSpec.scala
@@ -0,0 +1,24 @@
+package org.hashtree.stringmetric
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class AsciiLetterStringFilterSpec extends ScalaTest {
+ private final val Filter = new StringFilterDelegate with AsciiLetterStringFilter
+
+ "AsciiLetterStringFilter" should provide {
+ "overloaded filter method" when passed {
+ "String with letters" should returns {
+ "String with letters removed" in {
+ Filter.filter(" Hello123World!") should equal (" 123!")
+ }
+ }
+ "character array with letters" should returns {
+ "character array with letters removed" in {
+ Filter.filter(" Hello123World!".toCharArray) should equal (" 123!".toCharArray)
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/core/source/test/scala/org/hashtree/stringmetric/AsciiNumberOnlyStringFilterSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/AsciiNumberOnlyStringFilterSpec.scala
new file mode 100755
index 0000000..c2becdc
--- /dev/null
+++ b/core/source/test/scala/org/hashtree/stringmetric/AsciiNumberOnlyStringFilterSpec.scala
@@ -0,0 +1,24 @@
+package org.hashtree.stringmetric
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class AsciiNumberOnlyStringFilterSpec extends ScalaTest {
+ private final val Filter = new StringFilterDelegate with AsciiNumberOnlyStringFilter
+
+ "AsciiNumberOnlyStringFilter" should provide {
+ "overloaded filter method" when passed {
+ "String with mixed characters" should returns {
+ "String with non-numbers removed" in {
+ Filter.filter("!@#$%^&*()abc123") should equal ("123")
+ }
+ }
+ "character array with mixed characters" should returns {
+ "character array with non-numbers removed" in {
+ Filter.filter("!@#$%^&*()abc123".toCharArray) should equal ("123".toCharArray)
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/core/source/test/scala/org/hashtree/stringmetric/AsciiNumberStringFilterSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/AsciiNumberStringFilterSpec.scala
new file mode 100755
index 0000000..70b6605
--- /dev/null
+++ b/core/source/test/scala/org/hashtree/stringmetric/AsciiNumberStringFilterSpec.scala
@@ -0,0 +1,24 @@
+package org.hashtree.stringmetric
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class AsciiNumberStringFilterSpec extends ScalaTest {
+ private final val Filter = new StringFilterDelegate with AsciiNumberStringFilter
+
+ "AsciiNumberStringFilter" should provide {
+ "overloaded filter method" when passed {
+ "String with numbers" should returns {
+ "String with numbers removed" in {
+ Filter.filter(" Hello123World!") should equal (" HelloWorld!")
+ }
+ }
+ "character array with numbers" should returns {
+ "character array with numbers removed" in {
+ Filter.filter(" Hello123World!".toCharArray) should equal (" HelloWorld!".toCharArray)
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/core/source/test/scala/org/hashtree/stringmetric/AsciiSymbolOnlyStringFilterSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/AsciiSymbolOnlyStringFilterSpec.scala
new file mode 100755
index 0000000..429c486
--- /dev/null
+++ b/core/source/test/scala/org/hashtree/stringmetric/AsciiSymbolOnlyStringFilterSpec.scala
@@ -0,0 +1,24 @@
+package org.hashtree.stringmetric
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class AsciiSymbolOnlyStringFilterSpec extends ScalaTest {
+ private final val Filter = new StringFilterDelegate with AsciiSymbolOnlyStringFilter
+
+ "AsciiSymbolOnlyStringFilter" should provide {
+ "overloaded filter method" when passed {
+ "String with mixed characters" should returns {
+ "String with non-symbols removed" in {
+ Filter.filter("!@#$%^&*()abc123") should equal ("!@#$%^&*()")
+ }
+ }
+ "character array with mixed characters" should returns {
+ "character array with non-symbols removed" in {
+ Filter.filter("!@#$%^&*()abc123".toCharArray) should equal ("!@#$%^&*()".toCharArray)
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/core/source/test/scala/org/hashtree/stringmetric/AsciiSymbolStringFilterSpec.scala b/core/source/test/scala/org/hashtree/stringmetric/AsciiSymbolStringFilterSpec.scala
new file mode 100755
index 0000000..6c2c5df
--- /dev/null
+++ b/core/source/test/scala/org/hashtree/stringmetric/AsciiSymbolStringFilterSpec.scala
@@ -0,0 +1,24 @@
+package org.hashtree.stringmetric
+
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+
+@RunWith(classOf[JUnitRunner])
+final class AsciiSymbolStringFilterSpec extends ScalaTest {
+ private final val Filter = new StringFilterDelegate with AsciiSymbolStringFilter
+
+ "AsciiSymbolStringFilter" should provide {
+ "overloaded filter method" when passed {
+ "String with symbols" should returns {
+ "String with symbols removed" in {
+ Filter.filter("[HelloWorld]") should equal ("HelloWorld")
+ }
+ }
+ "character array with symbols" should returns {
+ "character array with symbols removed" in {
+ Filter.filter("[HelloWorld]".toCharArray) should equal ("HelloWorld".toCharArray)
+ }
+ }
+ }
+ }
+} \ No newline at end of file