Hello,
Say, I have a boolean function which returns a true or false without any parameters.
bool SomeFunction( void ) { int size = 200; if( size < 0 ) return false; if( size > 200 ) return false; if( size == 200 ) return true
; }
For the above function, I have 3 paths or 3 conditions. How could I test the above SomeFunction() using CUnit assertions? Please help.
Thanks!
hi Mnksh, as far as I can see the function has just one path since size is fixed to 200. a compiler would throw away the rest.
thats why there is no need to test this function in different ways, just
CU_ASSERT_EQUAL(SomeFunction,true);
cya
Log in to post a comment.
Hello,
Say, I have a boolean function which returns a true or false without any
parameters.
;
}
For the above function, I have 3 paths or 3 conditions. How could I test the
above SomeFunction() using CUnit assertions? Please help.
Thanks!
hi Mnksh,
as far as I can see the function has just one path since size is fixed to 200. a compiler would throw away the rest.
thats why there is no need to test this function in different ways, just
CU_ASSERT_EQUAL(SomeFunction,true);
cya