cmocka вызывает функцию настройки только один раз

Я использую cmocka 1.0.1.
Весь мой (не слишком сложный) код такой:

#include <setjmp.h>
#include <stdio.h>
#include "cmocka.h"
static int tc_setup(void **state)
{
printf("Log: tc_setup\n");
return 0;
}

static void tc_foo(void **state)
{
printf("Log: tc_foo\n");
return;
}

int main(void)
{
const struct CMUnitTest tests[] = {
cmocka_unit_test_setup(tc_foo, tc_setup),
cmocka_unit_test_setup(tc_foo, tc_setup)
};
int ret = cmocka_run_group_tests(tests, NULL, NULL);
return ret;
}

Вывод консоли такой:

[==========] Running 2 test(s).
[ RUN      ] tc_foo
Log: tc_setup
Log: tc_foo
[       OK ] tc_foo
[ RUN      ] (null)
Log: tc_foo
Could not run the test - check test fixtures
[  ERROR   ] (null)
[==========] 2 test(s) run.
[  PASSED  ] 1 test(s).

Как видите, перед вторым вызовом tc_foo cmocka не вызывает функцию tc_setup, но ПОЧЕМУ?

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector