simple unit tests for {get,check}bootparam
authorUlrich Dangel <uli@spamt.net>
Wed, 9 Sep 2009 18:30:19 +0000 (20:30 +0200)
committerFrank Terbeck <ft@bewatermyfriend.org>
Wed, 9 Sep 2009 18:44:36 +0000 (20:44 +0200)
tests/shunit2 [new file with mode: 0644]
tests/test_parameters.sh [new file with mode: 0755]

diff --git a/tests/shunit2 b/tests/shunit2
new file mode 100644 (file)
index 0000000..d900a70
--- /dev/null
@@ -0,0 +1,1116 @@
+# $Id: shunit2 277 2008-10-29 21:20:22Z kate.ward@forestent.com $
+# vim:et:ft=sh:sts=2:sw=2
+# vim:foldmethod=marker:foldmarker=/**,*/
+#
+#/**
+# <?xml version="1.0" encoding="UTF-8"?>
+# <s:shelldoc xmlns:s="http://www.forestent.com/projects/shelldoc/xsl/2005.0">
+# <s:header>
+# shUnit 2.1.5
+# Shell Unit Test Framework
+#
+# http://shunit2.googlecode.com/
+#
+# written by Kate Ward &lt;kate.ward@forestent.com&gt;
+# released under the LGPL
+#
+# This module implements a xUnit based unit test framework similar to JUnit.
+# </s:header>
+#*/
+
+SHUNIT_VERSION='2.1.5'
+
+SHUNIT_TRUE=0
+SHUNIT_FALSE=1
+SHUNIT_ERROR=2
+
+_shunit_warn() { echo "shunit2:WARN $@" >&2; }
+_shunit_error() { echo "shunit2:ERROR $@" >&2; }
+_shunit_fatal() { echo "shunit2:FATAL $@" >&2; }
+
+# specific shell checks
+if [ -n "${ZSH_VERSION:-}" ]; then
+  setopt |grep "^shwordsplit$" >/dev/null
+  if [ $? -ne ${SHUNIT_TRUE} ]; then
+    _shunit_fatal 'zsh shwordsplit option is required for proper operation'
+    exit ${SHUNIT_ERROR}
+  fi
+  if [ -z "${SHUNIT_PARENT:-}" ]; then
+    _shunit_fatal "zsh does not pass \$0 through properly. please declare \
+\"SHUNIT_PARENT=\$0\" before calling shUnit2"
+    exit ${SHUNIT_ERROR}
+  fi
+fi
+
+#
+# constants
+#
+
+__SHUNIT_ASSERT_MSG_PREFIX='ASSERT:'
+__SHUNIT_PARENT=${SHUNIT_PARENT:-$0}
+
+# set the constants readonly
+shunit_constants_=`set |grep '^__SHUNIT_' |cut -d= -f1`
+echo "${shunit_constants_}" |grep '^Binary file' >/dev/null \
+    && shunit_constants_=`set |grep -a '^__SHUNIT_' |cut -d= -f1`
+for shunit_constant_ in ${shunit_constants_}; do
+  shunit_ro_opts_=''
+  case ${ZSH_VERSION:-} in
+    '') ;;  # this isn't zsh
+    [123].*) ;;  # early versions (1.x, 2.x, 3.x)
+    *) shunit_ro_opts_='-g' ;;  # all later versions. declare readonly globally
+  esac
+  readonly ${shunit_ro_opts_} ${shunit_constant_}
+done
+unset shunit_constant_ shunit_constants_ shunit_ro_opts_
+
+# variables
+__shunit_skip=${SHUNIT_FALSE}
+__shunit_suite=''
+
+# counts of tests
+__shunit_testSuccess=${SHUNIT_TRUE}
+__shunit_testsTotal=0
+__shunit_testsPassed=0
+__shunit_testsFailed=0
+
+# counts of asserts
+__shunit_assertsTotal=0
+__shunit_assertsPassed=0
+__shunit_assertsFailed=0
+__shunit_assertsSkipped=0
+
+__shunit_lineno=''
+__shunit_reportGenerated=${SHUNIT_FALSE}
+
+# macros
+_SHUNIT_LINENO_='eval __shunit_lineno=""; if [ "${1:-}" = "--lineno" ]; then [ -n "$2" ] && __shunit_lineno="[$2] "; shift 2; fi'
+
+#-----------------------------------------------------------------------------
+# assert functions
+#
+
+#/**