Description
crpcut
crpcut (pronounced "crap cut") is the Compartmented Robust Posix C++ Unit Tester. It's super handy for writing tests that other unit-test frameworks just can't handle.
Testing Made Easy
Let’s look at a quick example of testing parts of std::string
:
#include < crpcut.hpp >
#include < string >
Setting Up Your Tests
This is a simple structure for most tests:
struct apastr // fixture for most tests
{
apastr() : s("apa") {}
std::string s;
};
Create Test Suites
You can group similar tests into test suites. Here’s how you might set up some basic tests:
TESTSUITE(basics)
{
TEST(default_constr_and_destr)
{
std::string s;
ASSERT_TRUE(s.empty());
ASSERT_EQ(s.length(), 0);
}
TEST(constr_from_char_array, apastr,
depends_on(default_constr_and_destr))
{
ASSERT_EQ(s.length(), 3UL);
}TEST(at, apastr,
depends_on(default_constr_and_destr))
{
ASSERT_EQ(s.at(1), 'p');
}
Error Handling in Tests
If something goes wrong, crpcut makes it easy to catch errors. You can set your expectations and check them easily.
TESTSUITE(errors, DEPENDS_ON(ALL_TESTS(basics))) { ... }
The Power of Compartmentalization
A cool feature is that each test runs in its own process and has its own working directory. This means if one test fails, it won’t mess with the others. It really helps keep things clean!
Robustness Counts
The suite will keep running even if one test crashes. You can also set time limits on tests; if they take too long, crpcut will stop them automatically!
No Memory Leaks Here!
The main process doesn’t use dynamic memory when starting a test case. So if you're using tools like valgrind, you'll catch any memory leaks easily.
Parallel Testing for Speed
If your computer has multiple cores, crpcut lets you run several test cases at once! This can save you time.
Catching Leftover Files
If there are files left over after a test finishes, that test is marked as failed. The working directory stays untouched so you can check it out later.
User Reviews for crpcut FOR LINUX 7
-
crpcut FOR LINUX provides a robust and compartmentalized approach to unit testing, offering easy test writing and process isolation. Impressive!
-
Crpcut is a game changer for C++ unit testing! Its compartmentalization and robust design make testing a breeze.
-
I love how crpcut allows me to focus on test logic without worrying about the environment. A must-have tool!
-
This app has transformed my testing process. The ability to run tests in isolation is fantastic for reliability.
-
Crpcut’s features like test case dependencies and parallel execution have significantly improved my workflow!
-
I highly recommend crpcut! It’s easy to use, and the error handling is top-notch. Testing has never been easier.
-
With crpcut, I can confidently write tests without fear of interference from others. Truly an excellent testing framework!