Each time an input parameter is changed the test is executed one more time.
The TestApe will invoke the test until the list of values is exhausted.
With the previous example in mind, the macro PARAMETER_VALUE can be used to
extract the values as shown in sample16 below2.1
void test_addition(void) {
EXPECT ( invalid );
EXPECT ( invalid );
EXPECT ( add );
VALIDATE(calculate(PARAMETER_VALUE,PARAMETER_VALUE,'+'), 2*PARAMETER_VALUE);
}
void testmain(void) {
PARAMETER_RANGE(10,20);
EXECUTE(test_addition);
}
As the input is changed, most likely so too are the validations and the list of
expected function calls. This can also be implemented by the use of PARAMETER_VALUE.
An example (sample17) is shown below.2.1
void test_addition(void) {
EXPECT ( invalid );
SIMULATE ( invalid, PARAMETER_VALUE );
if (!PARAMETER_VALUE)
EXPECT_VALIDATE ( add, check_add );
if (!PARAMETER_VALUE)
VALIDATE(calculate(3,7,'+'), EXPECTED_SUM);
else
VALIDATE(calculate(3,7,'+'), ERROR);
}
void testmain(void) {
PARAMETER(TRUE);
PARAMETER(FALSE);
EXECUTE(test_addition);
}
The value being tested can also be passed to one of the mocks, e.g. the
function check_add shown below
void test_addition(void) {
EXPECT ( invalid );
EXPECT ( invalid );
EXPECT_SIMULATE ( add, check_add , PARAMETER_VALUE);
VALIDATE(calculate(3,7,'+'), PARAMETER_VALUE);
}
The mock can pick up the value as described in [*] or it can just pick up the value
by referencing PARAMETER_VALUE directly. PARAMETER_VALUE will remain in scope
for the test and mock functions throughout the duration of the test.
New is this release are support for floating point validations and function mocking. Also, MinGW has been added to the list of supported platforms.
moreTestApe forum is now hosted on Proboards. Support questions can be posted here or send directly on email. Due to ...
moreTestApe can now be used with MinGW GCC on windows. Also supported in this beta are floating point types in validations or when mocking functions
moreA 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.
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.
moreNew beta version is now available for download. This is the last beta before official release. The release supports an extensive mocking system.
moreThere is a change for the forum hosted on this site. The previous phpBB forum is closed for now. All forum threads will be migrated to a new simple blog. ...
more