Closed ferrerax closed 4 years ago
S'escull mUnit com a framework per fer els tests. Aquí hi ha una mica de docu
munit_assert_int(foo, ==, bar);
Com aquestes n'hi ha un munt (https://nemequ.github.io/munit/#assertions).MunitResult my_test(const MunitParameter params[], void* user_data_or_fixture);
MunitTest tests[] = {
//Aqui a sota hi ha un test (una funció).
{
"/my-test", /* nom del test */
my_test, /* test (nom de la funció) */
NULL, /* setup (funció que s'executarà abans del test. Veure docu per saber més) */
NULL, /* tear_down (funció que s'executarà després del test, veure docu per saber més)*/
MUNIT_TEST_OPTION_NONE, /* options */
NULL /* parameters */
},
/* Mark the end of the array with an entry where the test
* function is NULL */
{ NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
};
static const MunitSuite suite = {
"/my-tests", /* nom de la suite */
tests, /* array de tests */
NULL, /* suites imbrincades. Si es vol saber més mirar docu */
1, /* iterations */
MUNIT_SUITE_OPTION_NONE /* No serveix de res, esta per versions futures*/
};
int
munit_suite_main(const MunitSuite* suite,
void* user_data,
int argc,
const char* argv[]);
Carpeta tests/test.c es on es faran els tests. ALLÀ HI HA UN EXEMPLE DE TOT AIXÒ
Doncs, per cada test_case hi ha d'haver un array de tests i una suite
S'ha escollit MicroUnit. Hi ha comentaris amb docu basica i enllaços a la docu oficial.