<pre>Type "cintltest -h" to see the usage:</pre><pre><![if !supportEmptyParas]> <![endif]><o:p></o:p></pre><pre>### Syntax:</pre><pre>### Usage: [ -l ] [ -v ] [ -verbose] [-a] [ -all] [-n] \n [ -no_err_msg] [ -h ] [ /path/to/test ]</pre><pre>### -l To get a list of test names</pre><pre>### -all To run all the test</pre><pre>### -a To run all the test(same a -all)</pre><pre>### -verbose To turn ON verbosity</pre><pre>### -v To turn ON verbosity(same as -verbose)</pre><pre>### -h To print this message</pre><pre>### -n To turn OFF printing error messages</pre><pre>### -no_err_msg (same as -n)</pre><pre>### -[/subtest] To run a subtest</pre><pre>### For example to run just the utility tests type: cintltest /tsutil)</pre><pre>### To run just the locale test type: cintltst /tsutil/loctst</pre><pre>###<spanstyle="mso-spacerun: yes"> </span></pre>
<pre><![if !supportEmptyParas]> <![endif]><o:p></o:p></pre><pre>#include "stdlib.h"</pre><pre>#include "ctest.h"</pre><pre>#include "stdio.h"</pre><pre>#include "string.h"</pre><pre><![if !supportEmptyParas]> <![endif]><o:p></o:p></pre><pre>/**</pre><pre>* Some sample dummy tests.</pre><pre>* the statics simply show how often the test is called.</pre><pre>*/</pre><pre>void mytest()</pre><pre>{</pre><pre><spanstyle="mso-spacerun: yes"> </span>static i = 0;</pre><pre><spanstyle="mso-spacerun: yes"> </span>log_info("I am a test[%d]\n", i++);</pre><pre>}</pre><pre><![if !supportEmptyParas]> <![endif]><o:p></o:p></pre><pre>void mytest_err()</pre><pre>{</pre><pre><spanstyle="mso-spacerun: yes"> </span>static i = 0;</pre><pre><spanstyle="mso-spacerun: yes"> </span>log_err("I am a test containing an error[%d]\n", i++);</pre><pre><spanstyle="mso-spacerun: yes"> </span>log_err("I am a test containing an error[%d]\n", i++);</pre><pre>}</pre><pre><![if !supportEmptyParas]> <![endif]><o:p></o:p></pre><pre>void mytest_verbose()</pre><pre>{</pre><pre><spanstyle="mso-spacerun: yes"> </span>/* will only show if verbose is on (-v) */</pre><pre><spanstyle="mso-spacerun: yes"> </span>log_verbose("I am a verbose test, blabbing about nothing at all.\n");</pre><pre>}</pre><pre><![if !supportEmptyParas]> <![endif]><o:p></o:p></pre><pre>/**</pre><pre>* Add your tests from this function</pre><pre>*/</pre><pre><![if !supportEmptyParas]> <![endif]><o:p></o:p></pre><pre>void add_tests( TestNode** root )</pre><pre>{</pre><pre><spanstyle="mso-spacerun: yes"> </span>addTest(root, &mytest, "/apple/bravo" );</pre><pre><spanstyle="mso-spacerun: yes"> </span>addTest(root, &mytest, "/a/b/c/d/mytest");</pre><pre><spanstyle="mso-spacerun: yes"> </span>addTest(root, &mytest_err, "/d/e/f/h/junk");</pre><pre><spanstyle="mso-spacerun: yes"> </span>addTest(root, &mytest, "/a/b/c/d/another");</pre><pre><spanstyle="mso-spacerun: yes"> </span>addTest(root, &mytest, "/a/b/c/etest");</pre><pre><spanstyle="mso-spacerun: yes"> </span>addTest(root, &mytest_err, "/a/b/c");</pre><pre><spanstyle="mso-spacerun: yes"> </span>addTest(root, &mytest, "/bertrand/andre/damiba");</pre><pre><spanstyle="mso-spacerun: yes"> </span>addTest(root, &mytest_err, "/bertrand/andre/OJSimpson");</pre><pre><spanstyle="mso-spacerun: yes"> </span>addTest(root, &mytest, "/bertrand/andre/juice/oj");</pre><pre><spanstyle="mso-spacerun: yes"> </span>addTest(root, &mytest, "/bertrand/andre/juice/prune");</pre><pre><spanstyle="mso-spacerun: yes"> </span>addTest(root, &mytest_verbose, "/verbose");</pre><pre><![if !supportEmptyParas]> <![endif]><o:p></o:p></pre><pre>}</pre><pre><![if !supportEmptyParas]> <![endif]><o:p></o:p></pre><pre>int main(int argc, const char *argv[])</pre><pre>{</pre><pre><spanstyle="mso-spacerun: yes"> </span>TestNode *root = NULL;</pre><pre><![if !supportEmptyParas]> <![endif]><o:p></o:p></pre><pre><spanstyle="mso-spacerun: yes"> </span>add_tests(&root); /* address of root ptr- will be filled in */</pre><pre><![if !supportEmptyParas]> <![endif]><o:p></o:p></pre><pre><spanstyle="mso-spacerun: yes"> </span>/* Run the tests. An int is returned suitable for the OS status code.</pre><pre><spanstyle="mso-spacerun: yes"> </span>(0 for success, neg for parameter errors, positive for the # of</pre><pre><spanstyle="mso-spacerun: yes"> </span>failed tests) */</pre><pre><spansty