netatalk icon indicating copy to clipboard operation
netatalk copied to clipboard

Create unit tests

Open rdmark opened this issue 1 year ago • 1 comments

We currently have a handful of integration tests for afpd in the test/ subdir, but the coverage is limited, and no code coverage is being tracked.

Ideally, we'd apply something like googletest / googlemock to achieve atomic unit tests with code coverage metrics.

rdmark avatar Feb 27 '24 07:02 rdmark

This wikipedia article lists a staggering number of unit test frameworks for C.

gtest/gmock leans heavily into the object oriented syntax of C++, and treats C headers as C++ which has some side effects, so it might not be the most elegant choice for this project.

The standout C-centric frameworks in my eyes are:

  • CUnit (2022 fork) https://gitlab.com/cunity/cunit
  • cmocka https://github.com/clibs/cmocka
  • Unity https://github.com/ThrowTheSwitch/Unity

cmocka is nice for its built-in mocking. Unity is nice for its native Meson support.

rdmark avatar Aug 11 '24 08:08 rdmark

Went a different direction and embedded the old afptest testsuite into the CI system. While unit testing is still a good idea, I'm happy with the functional test coverage that we have now.

rdmark avatar Oct 31 '24 15:10 rdmark