aboutsummaryrefslogtreecommitdiff
path: root/source/1.0/src/shflags_test_private.sh
diff options
context:
space:
mode:
authorkate.ward <kate.ward@forestent.com>2013-01-05 13:57:46 +0000
committerkate.ward <kate.ward@forestent.com>2013-01-05 13:57:46 +0000
commitb075920c3109938f9b4a6ec8715031fcc9ee74f6 (patch)
tree0fc9eb32b0afa1c810e4f57ee72e1ab546cccc60 /source/1.0/src/shflags_test_private.sh
parentda1f85666887139f0473809fe09756c9fcc1ee30 (diff)
downloadshflags-b075920c3109938f9b4a6ec8715031fcc9ee74f6.tar.gz
added built-in and expr functions to do math
Diffstat (limited to 'source/1.0/src/shflags_test_private.sh')
-rwxr-xr-xsource/1.0/src/shflags_test_private.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/1.0/src/shflags_test_private.sh b/source/1.0/src/shflags_test_private.sh
index f353bb3..7065940 100755
--- a/source/1.0/src/shflags_test_private.sh
+++ b/source/1.0/src/shflags_test_private.sh
@@ -179,6 +179,33 @@ testValidIntExpr()
_testValidInt _flags_validIntExpr
}
+_testMath()
+{
+ fx=$1
+
+ assertEquals 2 `${fx} 1 + 1`
+ assertEquals 2 `${fx} '1 + 1'`
+
+ assertNotEquals 3 `${fx} 1 + 1`
+ assertNotEquals 3 `${fx} '1 + 1'`
+}
+
+testMathBuiltin()
+{
+ # Are we running a shell that can handle a built-in version? The Solaris
+ # Bourne shell for one does not support what we need.
+ if [ "${__FLAGS_FX_VALID_INT}" != '_flags_validIntBuiltin' ]; then
+ echo 'SKIPPED: this shell does not support the necessary builtins'
+ return
+ fi
+ _testMath _flags_mathBuiltin
+}
+
+testMathExpr()
+{
+ _testMath _flags_mathExpr
+}
+
#------------------------------------------------------------------------------
# suite functions
#