tasty revision to load feisty for full use
[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/launch_feisty_meow.sh"
6 source "$FEISTY_MEOW_SCRIPTS/core/array_sifter.sh"
7
8 #demo 1 & 2 for test presence.
9 declare -a my_array=(peanuts sauce fish basil)
10
11 test1=basil
12 test_presence my_array $test1
13 if [ $? != 0 ]; then
14   echo "test1 did not find flag, but should have."
15 else
16   echo "test1 found expected flag."
17 fi
18
19 test2=spoo
20 test_presence my_array $test2
21 if [ $? != 0 ]; then
22   echo "test2 did not find flag, which is correct."
23 else
24   echo "test2 found flag when should not have."
25 fi
26
27 #############################################
28
29 #demo3 for sifting...
30
31 declare -a sift_list=(ontrack selenium aggressive)
32 declare -a stripping=(selenium)
33 declare -a store_list=()
34
35 sift_array "sift_list" "stripping" "store_list" 
36 if [ ${store_list[0]} == "selenium" ]; then
37   echo "test3 found expected content in storage list."
38 else
39   echo "test3 was missing expected content in storage list."
40 fi
41 echo sift is now ${sift_list[*]}
42 if [ "${sift_list[*]}" == "ontrack aggressive" ]; then
43   echo "test3 found expected content in sifting list."
44 else
45   echo "test3 was missing expected content in sifting list."
46 fi
47
48