You are on page 1of 3

PRACTICAL WORK 1

SET UP :

You can use Code Block to work with this project, but you can also use the makefile.
You need a GCC compiler

Settings/Compiler :
Use Build/Build and Run and don't forget to Clean before to have your modification
taken in account:

Create the tests to test the ratp method to compute the ticket price.

test the methode computePrice(age) of the class Price.

rule implemented: if age <= 12 then ticket price is divided by 2

INSTRUCTIONS

1/ create a first test using

assertEquals : assert_float_equal (float expected, float actual, float epsilon)

and make it fails,


Q1: Why do we need an epsilon?

Response:

2/ create a second test using


assertTrue : assert_true (boolean condition)

and make it fails, check result

Q2: Which assertion is better to use, why?

Response:

Create this 2 function in main.c


static int setup(void **state) { (void) state; printf("setUp"); return 0; }
static int teardown(void **state) { (void) state; printf("tearDown"); return 0; }

What can be the use of these 2 methods ?

Response:

4/ Create all the test you think necessary to validate this rule.

Q4: why do we need to make separate test instead of one test with all the assertion?

Response:

You might also like