Skip to content

Instantly share code, notes, and snippets.

View TheBarbellCoder's full-sized avatar
😎
Happily Coding

Avinash C. Ravi Shankar TheBarbellCoder

😎
Happily Coding
View GitHub Profile
@TheBarbellCoder
TheBarbellCoder / test_expanded.cpp
Last active July 28, 2020 15:36
Test Case after Macro Expansion
bool test__TestSuite__TestName()
{
bool isTrue{true};
{
isTrue &= (arg1 == arg2);
}
return isTrue;
}
@TheBarbellCoder
TheBarbellCoder / test.hpp
Last active July 20, 2020 13:46
Creash-proof testing
#include <sys/types.h>
#include <sys/wait.h>
#include <iostream>
#include <cstdlib>
#define BEGIN_TEST(TestSuite, TestName) \
bool test__##TestSuite##__##TestName(void) \
{ \
bool ret; \
pid_t pid = fork(); \
@TheBarbellCoder
TheBarbellCoder / test.cpp
Last active July 28, 2020 13:34
Sample test case
#include "test.hpp"
// Function to add two integers
int addIntegers(const int& a, const int& b)
{
return a + b;
}
// Test case to check commutative property of addIntegers
BEGIN_TEST(AddProps, Commutative)
@TheBarbellCoder
TheBarbellCoder / test.hpp
Last active July 20, 2020 13:52
Macro Definitions
#include <iomanip>
#include <iostream>
#define BEGIN_TEST(TestSuite, TestName) \
bool test__##TestSuite##__##TestName(void) \
{ \
bool isTrue{true};
#define END_TEST \
return isTrue; \