diff options
author | shmibs <shmibs@gmail.com> | 2014-08-01 09:29:25 -0700 |
---|---|---|
committer | shmibs <shmibs@gmail.com> | 2014-08-01 09:29:25 -0700 |
commit | 941b0aeffe6afad6ca9645641fe15d14bfca275c (patch) | |
tree | 369dadfa4be2e6f81fde25ea31427fe174140a4e | |
parent | 33dbc90fa2c314f2ad951b80e4b91cb6e45c9c07 (diff) | |
download | simple-test-941b0aeffe6afad6ca9645641fe15d14bfca275c.tar.gz |
Update README.md
-rw-r--r-- | README.md | 33 |
1 files changed, 32 insertions, 1 deletions
@@ -3,7 +3,38 @@ simple-test simple unit testing for C implemented as a single header file +brief summary +------------- +Your tests should be written as a single .c file separate from +the body of text containing your functionality to be tested. +Write the tests, include simple-test.h, point your compiler at +the necessary files, and you're done! see this +[documentation (pdf)](https://github.com/shmibs/simple-test/blob/master/README.pdf?raw=true) +for more details (because github markdown is annoying and doesn't +let me colour things). + +defined macros +-------------- +NAME|DESCRIPTION +---:|:---------- +**BEGIN_TEST**|must appear before all tests and after all global variable declarations +**END_TEST**|must appear at the end of your test program +**CLEANUP(statements)**|this defines a list of statements to run when the test exits, either successfully or on a failure. it isn't necessary for a test to run, but, if it does appear, it must be after the declaration of all variables to which it makes reference. +**RETURN()**|place at the end of a test which uses CLEANUP to ensure it is called before the test exits. i couldn't find any way around this without using more than just one header file, so i hope it isn't too annoying. +**STATE(description)**|show a prettily-formatted description of the program's state during a test. takes printf-style arguments. +**EXPECT_ZERO(summary, arg)**|fail if `arg` does not resolve to 0 +**EXPECT_ONE(summary, arg)**|fail if `arg` does not resolve to 1 +**EXPECT_GREATER_THAN_ZERO(summary, arg)**|fail if `arg` does not resolve to a value greater than 0. this will be replaced with more generic integer comparisons soon. +**EXPECT_INT(summary, arg1, arg2)**|fail if `arg2` does not match the expected integer value `arg1` +**EXPECT_EQUAL_INT(summary, arg1, arg2)**|fail if `arg1` and `arg2` are not equal +**EXPECT_UNEQUAL_INT(summary, arg1, arg2)**|fail if `arg1` and `arg2` are equal +**EXPECT_STR(summary, arg1, arg2)**|fail if string `arg2` does not match the expected string value `arg1` +**EXPECT_EQUAL_STR(summary, arg1, arg2)**|fail if `arg1` and `arg2` are not equivalent strings +**EXPECT_UNEQUAL_STR(summary, arg1, arg2)**|fail if `arg1` and `arg2` are equivalent strings + + + **WARNING: this will work fine in gcc, but it uses the non-standard macro \__COUNTER__ and nested functions.** -[documentation (pdf)](https://github.com/shmibs/simple-test/blob/master/README.pdf?raw=true) + |