What is crpcut FOR LINUX?


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.


How Download Works

Go to the Softpas website, press the 'Downloads' button, and pick the app you want to download and install—easy and fast!

SoftPas Safety Info
SoftPas

SoftPas is your platform for the latest software and technology news, reviews, and guides. Stay up to date with cutting-edge trends in tech and software development.

Recent

Help

Subscribe to newsletter


© Copyright 2024, SoftPas, All Rights Reserved.