summaryrefslogtreecommitdiff
path: root/include/cmocka.h
AgeCommit message (Collapse)AuthorFilesLines
2016-10-03This patch allows cmocka to be run under windows 64-bitNikos Mavrogiannopoulos1-1/+1
In that system while the maximum word size is 64-bits, the 'unsigned long int' type is only 32-bits. Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-09-21Fixed format specifier width mismatchJoseph Ates1-1/+14
On some platforms PRIu64 is not necessarily the width of the LargestIntegralType. A new decimal format specifier for LargestIntegralType was added and replaces the invocations of PRIu64.
2016-09-21cmocka: Use defines for WILL_RETURN valuesAndreas Schneider1-2/+5
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-02-10cmocka: Add will_return_maybe() for ignoring mock returnsJoseph Ates1-3/+32
As both parameter and function call order checking allow for ignoring cases where they are never invoked, the mock return values are at somewhat of a mismatch in that they must always be returned at least once (even in the case of will_return_always()). Therefore, the ability to set the count to -2 on will_return_count was added with a new macro (will_return_maybe) that indicates that that the value field may never be returned and still allow a successful test. Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2015-12-18cmocka: Add support to verify call orderingJoseph Ates1-0/+141
2015-09-30include: Improve documentation for prestate macrosAndreas Schneider1-8/+10
2015-09-23cmocka: Allow to pass initial data to test casesPawel Szewczyk1-4/+21
Sometimes multiple test cases share the same test function, running it on different data. To pass this data to test functions we must define setup function for each data set. It's not very convienient when there are many states to test. This commit introduce more elegant way to pass data to tests. The initial_state field of CMUnitTest structure can be defined by user. It will be either passed to setup function, which makes any preparation needed, or it will be passed directly to test function when setup func is NULL. Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
2015-02-25Fix function types in doxygen docsJakub Hrozek1-2/+2
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-20include: Add macro for assert_ptr_equal().Andreas Schneider1-0/+38
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-20include: Fix building with newer gcc versions.Andreas Schneider1-5/+2
__func__ is not a macro. We just need to define it on Windows for now. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-13include: Use LargestIntegralType instead of uintmax_tAndreas Schneider1-26/+29
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-13include: Fix documentation for mock functionsAndreas Schneider1-7/+7
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-12cmocka: Surround include info with code endcodeKrzysztof Opasiak1-1/+2
Doxygen makes list of includes hard to read when it is not explicitly marked as code. Surround it with code marks to improve readability. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-11include: Define __WORDSIZE if needed.Andreas Schneider1-0/+10
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-11include: Fix pointer casting and add check_expected_ptr()Andreas Schneider1-1/+19
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-10include: Define fix defintion of LargestIntegralTypeAndreas Schneider1-32/+36
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-10docs: Mark the old test runner functions as deprecatedJakub Hrozek1-10/+30
Marks the old test runner functions as @deprecated in the doxygen config Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
2015-02-09cmocka: Add support for skipping a testJakub Hrozek1-0/+11
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
2015-02-09cmocka: Add Test Anything Protocol message outputAndreas Schneider1-1/+2
This adds support to print test reporting in the Test Anything Protocol. See http://testanything.org/tap-specification.html Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-09cmocka: Add support for xunit reportsJakub Hrozek1-0/+1
Pair-Programmed-With: Andreas Schneider <asn@cryptomilk.org> Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se> Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-08cmocka: Add subunit message output typeJakub Hrozek1-0/+1
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
2015-02-08cmocka: Add a function to select the message output typeJakub Hrozek1-0/+17
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
2015-02-08cmocka: Mark run_tests as deprecated.Andreas Schneider1-53/+13
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-08cmocka: Implement a new test runner.Andreas Schneider1-0/+170
Pair-Programmed-With: Jakub Hrozek <jakub.hrozek@posteo.se> Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
2015-02-08cmocka: Add a test_realloc() function.Andreas Schneider1-0/+18
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2014-07-28cmocka: use ISO C99 PRIu64 over LargestIntegralTypePrintfUnsignedFormatEmil Velikov1-9/+0
With commit commit 8642ef21b07(cmocka: introduce LargestIntegralTypePrintfUnsignedFormat modifier) we introduces this superfluous macro in order to work around the differences when printing 64bit unsigned integer values. Rather than reinventing the wheel use the C99's PRIu64 and fall back locally to their platform/compiler specific counterparts if the inttypes.h header does not exist. Thanks to scythe from the #cmocka channel for pointing out. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2014-07-23cmocka: introduce LargestIntegralTypePrintfUnsignedFormat modifierEmil Velikov1-0/+9
The modifier is almost identical to LargestIntegralTypePrintfFormat in terms that it handles 64bit integer values, but unlike the latter it prints them as unsigned value. Behind the scenes it uses %I64u for windows, and %llu otherwise. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2014-05-29cmocka: fix doxygen comment for assert_not_in_range()Michael Adam1-2/+2
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2014-05-29cmocka: fix doxygen comment for assert_in_range()Michael Adam1-2/+2
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2014-05-29cmocka: fix doxygen comment for assert_return_code()Michael Adam1-1/+1
Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2014-05-20doc: Improve documentation for fail_msg().Andreas Schneider1-0/+11
BUG: https://open.cryptomilk.org/issues/29 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2014-04-11doc: Document the group functions.Andreas Schneider1-0/+2
2014-04-11include: Fix count parameter of expect_check() macroSebastian Dröge1-1/+1
It was always using 0, which meant that the values were never ever used. This commit changes it to 1, which is consistent with the other macros. Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2014-04-11cmocka: Define inline if not defined with MSVC.Andreas Schneider1-6/+13
2014-04-11cmocka: Add support for test groups.Andreas Schneider1-0/+18
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
2014-04-10cmocka: Add a dummy function for setup and teardown.Andreas Schneider1-1/+7
We need a matching number for setup and teardown functions else we can run in an assert. So this adds a dummy which doesn't do anything.
2014-04-09doc: Fix some typos.Andreas Schneider1-3/+3
2014-02-21Use prefix for commonly used macro PRINTF_ATTRIBUTELukas Slebodnik1-6/+7
It may cause warning: /usr/include/cmocka.h:50:0: warning: "PRINTF_ATTRIBUTE" redefined [enabled by default] Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2014-02-21Enable warning WundefLukas Slebodnik1-26/+26
It is better to use "#ifdef" for testing macros instead of "#if" In header file, "#ifdef DOXYGEN" was used 30 times and "#if DOXYGEN" 23 times. This patch makes it consistent and enable warning Wundef to prevent this kind of issues. Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2014-02-21Use better formatting string for printing numbersLukas Slebodnik1-2/+2
Numbers were printed as hexadecimal.n eror message, It is good practice to print "0x" before hexadecimal numbers, because it may be confusing without this. Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2013-12-23cmocka: Fix typo in the docs.Andreas Schneider1-2/+4
2013-12-23cmocka: Add assert_return_code().Andreas Schneider1-0/+26
2013-10-27include: Don't stringify twice with will_return_always().Travis Hendrickson1-1/+1
2013-10-27include: Fix unit_test_teardown macro.Andreas Schneider1-1/+0
2013-07-29include: Correctly define unit_test_setup() and unit_test_teardown().Andreas Schneider1-4/+13
Thanks to James Grenning <james@grenning.net>.
2013-07-24include: Don't redefine uintptr_t on Windows.Andreas Schneider1-30/+25
Visual Studio defines _UINTPTR_T_DEFINED if we have uintptr_t.
2013-07-18Add new macro will_return_alwaysPavel Březina1-0/+22
Signed-off-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2013-07-18Add new macro fail_msgPavel Březina1-0/+12
Signed-off-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2013-06-04doc: Add some more documentation for Mock Objects.Andreas Schneider1-0/+36
2013-06-04doc: Document expect_memory().Andreas Schneider1-4/+89