PCUT is a very simple framework for unit testing of C code. Unlike many other frameworks where you need to specify manually which functions belong to a particular test, PCUT provides several smart macros that hides this and lets you focus on the most important part of testing only: that is, coding the test cases.
Tests for the standard atoi() function may look like this:
#include < pcut/pcut.h >
#include < stdlib.h >
PCUT_INIT
PCUT_TEST(atoi_zero) {
PCUT_ASSERT_INT_EQUALS(0, atoi("0"));
}
PCUT_TEST(atoi_positive) {
PCUT_ASSERT_INT_EQUALS(42, atoi("42"));
}
PCUT_TEST(atoi_negative) {
PCUT_ASSERT_INT_EQUALS(-273, atoi("-273"));
}
PCUT_MAIN()
Commercial Use
Modify
Distribute
Place Warranty
Hold Liable
Use Trademarks
Include Copyright
Include License
These details are provided for information only. No information here is legal advice and should not be used as such.
There are no reported vulnerabilities
30 Day SummaryAug 10 2024 — Sep 9 2024
|
12 Month SummarySep 9 2023 — Sep 9 2024
|