26173f193fdb6c31a2f81a2d473b0903e651b45f
[feisty_meow.git] / scripts / testing / test_array_sifter.sh
1 #!/bin/bash
2 #
3 # tests the array sifter methods.
4
5 source $FEISTY_MEOW_SCRIPTS/core/array_sifter.sh
6
7 #demo 1 & 2 for test presence.
8 declare -a my_array=(peanuts sauce fish basil)
9
10 test1=basil
11 test_presence my_array $test1
12 if [ $? != 0 ]; then
13   echo "test1 did not find flag, but should have."
14 else
15   echo "test1 found expected flag."
16 fi
17
18 test2=spoo
19 test_presence my_array $test2
20 if [ $? != 0 ]; then
21   echo "test2 did not find flag, which is correct."
22 else
23   echo "test2 found flag when should not have."
24 fi
25
26 #############################################
27
28 #demo3 for sifting...
29
30 declare -a sift_list=(ontrack selenium aggressive)
31 declare -a stripping=(selenium)
32 declare -a store_list=()
33
34 sift_array "sift_list" "stripping" "store_list" 
35 if [ ${store_list[0]} == "selenium" ]; then
36   echo "test3 found expected content in storage list."
37 else
38   echo "test3 was missing expected content in storage list."
39 fi
40 echo sift is now ${sift_list[*]}
41 if [ "${sift_list[*]}" == "ontrack aggressive" ]; then
42   echo "test3 found expected content in sifting list."
43 else
44   echo "test3 was missing expected content in sifting list."
45 fi
46
47