Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple C/C++ files containing tests #71

Open
shanebishop opened this issue Jun 26, 2023 Discussed in #54 · 0 comments
Open

Add support for multiple C/C++ files containing tests #71

shanebishop opened this issue Jun 26, 2023 Discussed in #54 · 0 comments

Comments

@shanebishop
Copy link

shanebishop commented Jun 26, 2023

Discussed in #54

Originally posted by stefano-p July 21, 2021

I was evaluating this framework and found that is seems not possible to build multiple c test files. So do I have to put all tests in one single module?

This file alone ( test_all.c) compiles and run correctly.

test_all.c

#define CESTER_NO_MAIN
#include <exotic/cester.h>

CESTER_TEST(test1, test_instance,
            cester_assert_equal(NULL, NULL);
)

CESTER_TEST(test_two, test_instance,
    cester_assert_ptr_equal(test_instance, NULL);    
)

CESTER_TEST(test_three, test_instance,
    cester_assert_short_eq(1, 1);    
)

CESTER_BODY(
int main(int argc, char** argv) {
        return CESTER_RUN_ALL_TESTS(argc, argv);
}
)

But as I add a new one (test_my_module1.c) I get some strange linker errors saying that there are:

  • multiple definition of `superTestInstance';
  • multiple definition of `default_color';
  • multiple definition of `hConsole';

I also had to define CESTER_NO_MAIN and CESTER_NO_SIGNAL in order to lower the number of "multiple definition" errors.

test_my_module1.c

#define CESTER_NO_MAIN
#define CESTER_NO_SIGNAL
#include <exotic/cester.h>

CESTER_TEST(test4, test_instance,
            cester_assert_equal(NULL, NULL);
)

Is it possible to spread tests across multiple c files? How?

Please add support for for multiple C/C++ files containing assertions/tests. Ideally it should be possible to build the tests with a single command, and then run the tests with a single command.

@shanebishop shanebishop changed the title Add support for multiple C/C++ files containing assertions Add support for multiple C/C++ files containing tests Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant