Sponsored Content
Full Discussion: A little help please
Top Forums Shell Programming and Scripting A little help please Post 302145561 by immyakram on Wednesday 14th of November 2007 03:56:46 PM
Old 11-14-2007
Thing is i understand evrything to that point but then when i get onto stuff liek testing with conditions - testing charachter data, testing numeric data and testing for files. Let me give you an example if you explain this little part would be great.

Although test is most often used for decision making, it can also be used on its own as follows

$ str1=abcd
$ test $str1 = abcd
$ echo $?
0


Note: unlike the variable assignment statement in the first line in the preceding example, the test command must have the equal sign surrounded by white space.

In this example, the shell sends three arguments to test. Strings must be equivalent in both length and character by character.

$ str1="abcd "
$ test "$str1" = abcd
$ echo
$?
1
 
wibble-test-genrunner(1)				      General Commands Manual					  wibble-test-genrunner(1)

NAME
wibble-test-genrunner - Code generator for wibble testsuites. SYNOPSIS
wibble-test-genrunner header <file> wibble-test-genrunner main <files> DESCRIPTION
The program generates .cpp files that are then compiled and linked into a test program for running tests from .test.h files. Examples of such .test.h files may be found among wibble headers, eg. /usr/include/wibble/regexp.test.h. In the first form, the program processes a single header file (usually of the form foo.test.h) and produces a corresponding .cpp file to be compiled. In the second form, it takes as <files> all the .test.h headers and produces a single main.cpp which contains the main() function of the test program, which then runs all the tests in all the .test.h files. The generated source code is always written to standard output and it is left up to the user to redirect it to a meaningful location. The program currently has no options other than the two forms above. The program is intended to be run as part of build process of programs or libraries using the wibble testing framework. For convenient use from CMake, there is a test.cmake script under /usr/share/wibble, that takes care of producing all the .cpp files (both per-header and the main one), compiling them and linking them into a single binary which executes the testsuite. AUTHOR
Petr Rockai <me@mornfall.net> wibble-test-genrunner(1)
All times are GMT -4. The time now is 06:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy