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 / unittest.cpp
Last active November 12, 2022 19:08
Running tests in separate processes
// File: unittest.cpp
void UnitTest::runTests()
{
// variables to count the number of passed and failed tests
static int passed{0};
static int failed{0};
if(testList.empty())
{
std::cout << "No tests registered!!" << std::endl;
@TheBarbellCoder
TheBarbellCoder / test_project.cpp
Last active May 3, 2022 06:23
Sample test program
// test.hpp
#include "unittest.hpp"
DeclareTest(module, test1)
DeclareTest(module, test2)
...
//test.cpp
#include "test.hpp"
@TheBarbellCoder
TheBarbellCoder / test_main.cpp
Last active November 12, 2022 07:03
Test Project
// File: test_main.cpp
#include "test_project.hpp"
int main(){
RegisterTest(module, test1)
RegisterTest(module, test2)
RunTests()
return 0;
@TheBarbellCoder
TheBarbellCoder / test_dummy.cpp
Created November 12, 2022 07:17
Sample test declaration and definiton
// File: test_dummy.cpp
#include "test_dummy.hpp"
DefineTest(dummy, dummycase){
// Write your test code here
// ...
}