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

Feature/unitest run all #1

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft

Conversation

kam193
Copy link
Owner

@kam193 kam193 commented Aug 3, 2020

This is a draft of possible simplifications for writing unit tests.

RUN_ALL macro runs all tests.

The unit test is registered during declaration of UNIT_TEST by special macro _UNIT_TEST_INITIALIZER which use __attribute__((constructor)) mark to run registration before running main.

Limitations:

  • It's possible it will not work with some compilators (e.g. clang require something others), but I found that generally __attribute__((constructor)) should be available (this is gcc extension). But anyway, this is for simplify UT creations, not for general development
  • Size for list of tests must be declared statically (but it is a problem to overallocate memory for test?)

Other possible improvements:

  • don't use UNIT_TEST_REGISTER, merge it with UNIT_TEST

@kam193 kam193 marked this pull request as draft August 3, 2020 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant