Merge branch 'master' of feistymeow.org:feisty_meow
[feisty_meow.git] / scripts / testing / test_array_sifter.sh
diff --git a/scripts/testing/test_array_sifter.sh b/scripts/testing/test_array_sifter.sh
new file mode 100644 (file)
index 0000000..b50d081
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+#
+# tests the array sifter methods.
+
+source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
+source "$FEISTY_MEOW_SCRIPTS/core/array_sifter.sh"
+
+#demo 1 & 2 for test presence.
+declare -a my_array=(peanuts sauce fish basil)
+
+test1=basil
+test_presence my_array $test1
+if [ $? != 0 ]; then
+  echo "test1 did not find flag, but should have."
+else
+  echo "test1 found expected flag."
+fi
+
+test2=spoo
+test_presence my_array $test2
+if [ $? != 0 ]; then
+  echo "test2 did not find flag, which is correct."
+else
+  echo "test2 found flag when should not have."
+fi
+
+#############################################
+
+#demo3 for sifting...
+
+declare -a sift_list=(ontrack selenium aggressive)
+declare -a stripping=(selenium)
+declare -a store_list=()
+
+sift_array "sift_list" "stripping" "store_list" 
+if [ ${store_list[0]} == "selenium" ]; then
+  echo "test3 found expected content in storage list."
+else
+  echo "test3 was missing expected content in storage list."
+fi
+echo sift is now ${sift_list[*]}
+if [ "${sift_list[*]}" == "ontrack aggressive" ]; then
+  echo "test3 found expected content in sifting list."
+else
+  echo "test3 was missing expected content in sifting list."
+fi
+
+