165afa2377
I noticed this was taking an argument but not dealing with it. In general the functions were undocumented, so I added some terse usage. Also, the intent of the test-case was to expand the values before using them as the message; make sure this happens by using a temp variable. Change-Id: Ib317ad1e9dd2a5d2232b9c64541fe4a601a2b8da
46 lines
1.0 KiB
Bash
Executable File
46 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Tests for DevStack meta-config functions
|
|
|
|
TOP=$(cd $(dirname "$0")/.. && pwd)
|
|
|
|
# Import common functions
|
|
source $TOP/functions
|
|
source $TOP/tests/unittest.sh
|
|
|
|
function test_trueorfalse {
|
|
local one=1
|
|
local captrue=True
|
|
local lowtrue=true
|
|
local uppertrue=TRUE
|
|
local capyes=Yes
|
|
local lowyes=yes
|
|
local upperyes=YES
|
|
|
|
for default in True False; do
|
|
for name in one captrue lowtrue uppertrue capyes lowyes upperyes; do
|
|
local msg="trueorfalse($default $name)"
|
|
assert_equal "True" $(trueorfalse $default $name) "$msg"
|
|
done
|
|
done
|
|
|
|
local zero=0
|
|
local capfalse=False
|
|
local lowfalse=false
|
|
local upperfalse=FALSE
|
|
local capno=No
|
|
local lowno=no
|
|
local upperno=NO
|
|
|
|
for default in True False; do
|
|
for name in zero capfalse lowfalse upperfalse capno lowno upperno; do
|
|
local msg="trueorfalse($default $name)"
|
|
assert_equal "False" $(trueorfalse $default $name) "$msg"
|
|
done
|
|
done
|
|
}
|
|
|
|
test_trueorfalse
|
|
|
|
report_results
|