xaizek / stic (License: MIT) (since 2018-12-07)
Simple Tests In C with optional automatic test registration in C.
Commit 22343b3505e35c5c91b8d0bd9ec5d87f0c7b7aaf

Add -r to stic to ease stic output testing
This arguments provokes pseudo random test failures.
Author: xaizek
Author date (UTC): 2015-06-23 14:58
Committer name: xaizek
Committer date (UTC): 2015-06-23 16:55
Parent(s): eeac9770270496ed75f6773afffa04c821177932
Signing key:
Tree: 7ae742907fd09289443d3cef308e118baaafadb2
File Lines added Lines deleted
src/stic.c 9 0
File src/stic.c changed (mode: 100644) (index c74cf25..e9354ce)
9 9
10 10 #include <stdarg.h> #include <stdarg.h>
11 11 #include <stdio.h> #include <stdio.h>
12 #include <stdlib.h>
12 13 #include <string.h> #include <string.h>
13 14 #include <wchar.h> #include <wchar.h>
14 15
 
... ... static int sea_tests_passed = 0;
73 74 static int sea_tests_failed = 0; static int sea_tests_failed = 0;
74 75 static int stic_display_only = 0; static int stic_display_only = 0;
75 76 static int stic_verbose = 0; static int stic_verbose = 0;
77 static int stic_random_failures = 0;
76 78 static int stic_machine_readable = 0; static int stic_machine_readable = 0;
77 79 static const char *stic_current_fixture; static const char *stic_current_fixture;
78 80 static const char *stic_current_fixture_path; static const char *stic_current_fixture_path;
 
... ... void stic_simple_test_result_log(int passed, char* reason, const char* function,
159 161 /* TODO: do use function if it differs from test. */ /* TODO: do use function if it differs from test. */
160 162 (void)function; (void)function;
161 163
164 if (stic_random_failures && random() % 8 == 0)
165 {
166 passed = !passed;
167 }
168
162 169 if (!passed) if (!passed)
163 170 { {
164 171 if(stic_machine_readable) if(stic_machine_readable)
 
... ... void stic_show_help( void )
478 485 printf("\t-f:\twill only run fixtures that match <fixturename>\n"); printf("\t-f:\twill only run fixtures that match <fixturename>\n");
479 486 printf("\t-d:\twill just display test names and fixtures without\n"); printf("\t-d:\twill just display test names and fixtures without\n");
480 487 printf("\t-d:\trunning the test\n"); printf("\t-d:\trunning the test\n");
488 printf("\t-r:\tproduce random failures\n");
481 489 printf("\t-v:\twill print a more verbose version of the test run\n"); printf("\t-v:\twill print a more verbose version of the test run\n");
482 490 printf("\t-m:\twill print a machine readable format of the test run, ie :- \n"); printf("\t-m:\twill print a machine readable format of the test run, ie :- \n");
483 491 printf("\t \t<textfixture>,<testname>,<linenumber>,<testresult><EOL>\n"); printf("\t \t<textfixture>,<testname>,<linenumber>,<testresult><EOL>\n");
 
... ... void stic_interpret_commandline(stic_testrunner_t* runner)
520 528 return; return;
521 529 } }
522 530 if(stic_is_string_equal_i(runner->argv[arg], "-d")) runner->action = STIC_DISPLAY_TESTS; if(stic_is_string_equal_i(runner->argv[arg], "-d")) runner->action = STIC_DISPLAY_TESTS;
531 if(stic_is_string_equal_i(runner->argv[arg], "-r")) stic_random_failures = 1;
523 532 if(stic_is_string_equal_i(runner->argv[arg], "-v")) stic_verbose = 1; if(stic_is_string_equal_i(runner->argv[arg], "-v")) stic_verbose = 1;
524 533 if(stic_is_string_equal_i(runner->argv[arg], "-m")) stic_machine_readable = 1; if(stic_is_string_equal_i(runner->argv[arg], "-m")) stic_machine_readable = 1;
525 534 if(stic_parse_commandline_option_with_value(runner,arg,"-t", test_filter)) arg++; if(stic_parse_commandline_option_with_value(runner,arg,"-t", test_filter)) arg++;
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/stic

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/stic

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master