diff options
Diffstat (limited to 'shunit2-2.0.3/src/test/testAsserts')
-rwxr-xr-x | shunit2-2.0.3/src/test/testAsserts | 242 |
1 files changed, 0 insertions, 242 deletions
diff --git a/shunit2-2.0.3/src/test/testAsserts b/shunit2-2.0.3/src/test/testAsserts deleted file mode 100755 index 12a3943..0000000 --- a/shunit2-2.0.3/src/test/testAsserts +++ /dev/null @@ -1,242 +0,0 @@ -#! /bin/sh -# $Id$ -# vim: expandtab -# author: Kate Ward <kate.ward@forestent.com> -# -# Self-testing unit tests for shUnit2 asserts -# - -MSG='This is a test message' - -#----------------------------------------------------------------------------- -# suite tests -# - -commonEqualsSame() -{ - fn=$1 - - msg='same, with message' - rslt=`${fn} "${MSG}" 'x' 'x' 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='same' - rslt=`${fn} 'x' 'x' 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='not same' - rslt=`${fn} 'x' 'y' 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} - - msg='null values' - rslt=`${fn} '' '' 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='too few arguments' - rslt=`${fn} 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} -} - -testAssertEquals() -{ - commonEqualsSame 'assertEquals' -} - -testAssertSame() -{ - commonEqualsSame 'assertSame' -} - -testAssertNotSame() -{ - msg='not same, with message' - rslt=`assertNotSame "${MSG}" 'x' 'y' 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='not same' - rslt=`assertNotSame 'x' 'y' 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='same' - rslt=`assertNotSame 'x' 'x' 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} - - msg='null values' - rslt=`assertNotSame '' '' 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} - - msg='too few arguments' - rslt=`assertNotSame 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} -} - -testAssertNull() -{ - msg='null, with message' - rslt=`assertNull "${MSG}" '' 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='null' - rslt=`assertNull '' 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='not null' - rslt=`assertNull 'x' 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} - - msg='too few arguments' - rslt=`assertNull 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} -} - -testAssertNotNull() -{ - msg='not null, with message' - rslt=`assertNotNull "${MSG}" 'x' 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='not null' - rslt=`assertNotNull 'x' 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='null' - rslt=`assertNotNull '' 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} - - msg='too few arguments' - rslt=`assertNotNull 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} -} - -testAssertTrue() -{ - msg='true, with message' - rslt=`assertTrue "${MSG}" 0 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='true' - rslt=`assertTrue 0 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='true condition' - rslt=`assertTrue "[ 0 -eq 0 ]" 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='false' - rslt=`assertTrue 1 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} - - msg='false condition' - rslt=`assertTrue "[ 0 -eq 1 ]" 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} - - msg='null value' - rslt=`assertTrue '' 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} - - msg='too few arguments' - rslt=`assertTrue 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} -} - -testAssertFalse() -{ - msg='false, with message' - rslt=`assertFalse "${MSG}" 1 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='false' - rslt=`assertFalse 1 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='false condition' - rslt=`assertFalse "[ 0 -eq 1 ]" 2>&1` - rtrn=$? - assertSame "${msg}" '' "${rslt}" - assertTrue "${msg}; failure" ${rtrn} - - msg='true' - rslt=`assertFalse 0 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} - - msg='true condition' - rslt=`assertFalse "[ 0 -eq 0 ]" 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} - - msg='null value' - rslt=`assertFalse '' 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} - - msg='too few arguments' - rslt=`assertFalse 2>&1` - rtrn=$? - assertNotSame "${msg}" '' "${rslt}" - assertFalse "${msg}; failure" ${rtrn} -} - -#----------------------------------------------------------------------------- -# suite functions -# - -# load and run shUnit2 -. ./shunit2 |