Skip to content
Snippets Groups Projects
Commit 6296e4b2 authored by Antoni Kiedos's avatar Antoni Kiedos
Browse files

0.2.0-alpha.0.

parent 38191676
Branches main
No related tags found
No related merge requests found
## Future releases ## Future releases
- More `ASSERT_*` macros - More `ASSERT_*` macros
- Deprecate `END_TEST` and get rid of `add_test` and change `TEST` impl - Deprecate `END_TEST` and get rid of `add_test` and change `TEST` impl
## 0.2.0-alpha.0
- added `CHAR_PTR_ASSERT_EQ` for comparing `char*` (via `std::strcmp`)
## 0.1.2 ## 0.1.2
- fixed bug in ASSERT_EQ - fixed bug in ASSERT_EQ
## 0.1.1 ## 0.1.1
......
No preview for this file type
...@@ -3,10 +3,24 @@ ...@@ -3,10 +3,24 @@
#include<iostream> #include<iostream>
// In near future:
// TEST(name, fname_var)
// ...
// END_TEST
// ?
#define TEST(name, fname_var)\ #define TEST(name, fname_var)\
litefprocut::add_test(fname_var, #name, [argv](const std::string& content) litefprocut::add_test(fname_var, #name, [argv](const std::string& content)
#define END_TEST \ #define END_TEST \
); );
#define CHAR_PTR_ASSERT_EQ(lhs, rhs)\
if(std::strcmp(lhs, rhs) != 0)\
{\
std::cerr << "\e[31mAssertion failed:\n\e[0m";\
std::cerr << "\e[31m\tExpected: " << rhs << "\n\e[0m";\
std::cerr << "\e[31m\tActual: " << lhs << "\n\e[0m";\
++litefprocut::this_test.failed;\
}\
else ++litefprocut::this_test.passed;
#define ASSERT_EQ(lhs, rhs)\ #define ASSERT_EQ(lhs, rhs)\
if((lhs) != (rhs))\ if((lhs) != (rhs))\
{\ {\
......
...@@ -3,10 +3,24 @@ ...@@ -3,10 +3,24 @@
#include<iostream> #include<iostream>
// In near future:
// TEST(name, fname_var)
// ...
// END_TEST
// ?
#define TEST(name, fname_var)\ #define TEST(name, fname_var)\
litefprocut::add_test(fname_var, #name, [argv](const std::string& content) litefprocut::add_test(fname_var, #name, [argv](const std::string& content)
#define END_TEST \ #define END_TEST \
); );
#define CHAR_PTR_ASSERT_EQ(lhs, rhs)\
if(std::strcmp(lhs, rhs) != 0)\
{\
std::cerr << "\e[31mAssertion failed:\n\e[0m";\
std::cerr << "\e[31m\tExpected: " << rhs << "\n\e[0m";\
std::cerr << "\e[31m\tActual: " << lhs << "\n\e[0m";\
++litefprocut::this_test.failed;\
}\
else ++litefprocut::this_test.passed;
#define ASSERT_EQ(lhs, rhs)\ #define ASSERT_EQ(lhs, rhs)\
if((lhs) != (rhs))\ if((lhs) != (rhs))\
{\ {\
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment