Function parameters

As part of the function validation, it is also possible to validate the parameters passed from the unit.

  void test_addition(void) {
    EXPECT  ( invalid );
    EXPECT  ( invalid );
    EXPECT_MOCK ( add, check_add );
    VALIDATE(calculate(3,7,'+'), EXPECTED_SUM);
The EXPECT_MOCK macro shown in sample6 above2.1, instructs the framework to expect a function call to add. check_add is a reference to a mock that will verify the arguments being passed to add. This mock function must have the same prototype as the function it validates. The sample function check_add shown below has the same prototype as the function add called by calculate.
  int check_add(int left_operand, int right_operand) {
    return 10;
The function validates that each of the parameters are as expected for this test. Other tests might have other expectations to the parameters, so they will use another mock function. It is possible to have many mock functions, each of which can be used to test parameters for add in different scenarios. The output from the mock function check_add will look something like this2.2

 PASSED verify left_operand
   expected .......... 3 (3)
   actual ............ 3
 PASSED right_operand
   expected .......... 7 (7)
   actual ............ 7



The latest headlines from

TestApe Release 1171 available, Aug 20th 2014

It has been a long time since last official release and the list of bugfixes, features and supported platforms accumulating in the beta has grown substantially. I am happy to annouce that a new release is ready.


TestApe beta version available, Jul 21th 2014

New beta version is now available for download.


TestApe Release 880 available, Dec 3rd 2011

New is this release are support for floating point validations and function mocking. Also, MinGW has been added to the list of supported platforms.


Forum change, Mar 27th 2011

TestApe forum is now hosted on Proboards. Support questions can be posted here or send directly on email. Due to ...


TestApe beta release available, Sep 27th 2011

TestApe can now be used with MinGW GCC on windows. Also supported in this beta are floating point types in validations or when mocking functions


IPad update for WebTTY, May 15th 2011

A small fix for webtty scripts, to allow the usage from Apple IPads. Tab on textarea to bring up IPad keyboard - you may have to scroll webpage beneath keyboard, in order to actually see what you're typing.

TestApe Release 791 available, Apr 2nd 2010

This release contains a new flexible mocking system with default mocks automatically generated for unresolved functions. Installation packages are available for GCC/Linux, GCC/CygWin as well Visual Studio 2009/Windows XP or Vista.