Initial commit

This commit is contained in:
Johannes Findeisen 2009-10-15 19:27:15 +02:00
commit 4eef3a1d5a
153 changed files with 178754 additions and 0 deletions

View file

@ -0,0 +1,5 @@
test_import ()
{
${UCI} import < ${REF_DIR}/import.data
assertSameFile ${REF_DIR}/import.result ${CONFIG_DIR}/import
}

View file

@ -0,0 +1,6 @@
test_export ()
{
cp ${REF_DIR}/export.data ${CONFIG_DIR}/export
${UCI} export > ${TMP_DIR}/export.result
assertSameFile ${REF_DIR}/export.result ${TMP_DIR}/export.result
}

View file

@ -0,0 +1,39 @@
test_get_parsing()
{
cp ${REF_DIR}/get_parsing.data ${CONFIG_DIR}/test
assertFailWithNoReturn "${UCI_Q} get test."
assertFailWithNoReturn "${UCI_Q} get test.section."
assertFailWithNoReturn "${UCI_Q} get test.section.opt."
assertFailWithNoReturn "${UCI_Q} get test.section.opt.val."
assertFailWithNoReturn "${UCI_Q} get test.section.opt.val.qsdf.qsd"
assertFailWithNoReturn "${UCI_Q} get test.section.opt.valqsqsd"
}
test_get_section_index_parsing()
{
cp ${REF_DIR}/get_parsing.data ${CONFIG_DIR}/test
assertFailWithNoReturn "${UCI_Q} get test.@"
assertFailWithNoReturn "${UCI_Q} get test.@zer."
assertFailWithNoReturn "${UCI_Q} get test.@."
assertFailWithNoReturn "${UCI_Q} get test.@zer[1]"
assertFailWithNoReturn "${UCI_Q} get test.@.opt"
assertFailWithNoReturn "${UCI_Q} get test.@[28]"
assertFailWithNoReturn "${UCI_Q} get test.@[1]."
assertFailWithNoReturn "${UCI_Q} get test.@[1].val."
}
test_get_option()
{
cp ${REF_DIR}/get.data ${CONFIG_DIR}/test
value=$($UCI get test.section.opt)
assertEquals 'val' "$value"
}
test_get_section()
{
cp ${REF_DIR}/get.data ${CONFIG_DIR}/test
type=$($UCI get test.section)
assertEquals 'type' "$type"
}

View file

@ -0,0 +1,30 @@
test_set_parsing()
{
cp ${REF_DIR}/set_parsing.data ${CONFIG_DIR}/test
assertFailWithNoReturn "${UCI_Q} set test.=val"
assertFailWithNoReturn "${UCI_Q} set test.section.=val"
assertFailWithNoReturn "${UCI_Q} set test.section.opt.=val"
assertFailWithNoReturn "${UCI_Q} set test.section.opt.zflk=val"
}
test_set_named_section()
{
touch ${CONFIG_DIR}/set
${UCI} set set.section=named
assertSameFile ${REF_DIR}/set_named_section.result ${CHANGES_DIR}/set
}
test_set_nonexisting_option()
{
cp ${REF_DIR}/set_nonexisting_option.data ${CONFIG_DIR}/set
${UCI} set set.section.opt=val
assertSameFile ${REF_DIR}/set_nonexisting_option.result ${CHANGES_DIR}/set
}
test_set_existing_option()
{
cp ${REF_DIR}/set_existing_option.data ${CONFIG_DIR}/set
${UCI} set set.section.opt=val
assertSameFile ${REF_DIR}/set_existing_option.result ${CHANGES_DIR}/set
}

View file

@ -0,0 +1,8 @@
test_add_section()
{
touch ${CONFIG_DIR}/add
section_name=$(${UCI} add add type)
assertNotNull "uci add does not return a section name." $section_name
sed 's/section/'$section_name'/' ${REF_DIR}/add_section.result > ${TMP_DIR}/add_section.result
assertSameFile ${TMP_DIR}/add_section.result ${CHANGES_DIR}/add
}

View file

@ -0,0 +1,11 @@
test_get_parsing()
{
cp ${REF_DIR}/show_parsing.data ${CONFIG_DIR}/test
assertFailWithNoReturn "${UCI_Q} show test."
assertFailWithNoReturn "${UCI_Q} show test.section."
assertFailWithNoReturn "${UCI_Q} show test.section.opt."
assertFailWithNoReturn "${UCI_Q} show test.section.opt.val."
assertFailWithNoReturn "${UCI_Q} show test.section.opt.val.qsdf.qsd"
assertFailWithNoReturn "${UCI_Q} show test.section.opt.valqsqsd"
}

View file

@ -0,0 +1,9 @@
test_ucimap_example()
{
rm -rf ./save
( cd ..; ./ucimap-example -s ) > "${TMP_DIR}/ucimap_example.result"
assertSameFile "${TMP_DIR}/ucimap_example.result" "${REF_DIR}/ucimap_example_1.result"
( cd ..; ./ucimap-example -s ) > "${TMP_DIR}/ucimap_example.result"
assertSameFile "${TMP_DIR}/ucimap_example.result" "${REF_DIR}/ucimap_example_2.result"
rm -rf ./save
}