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

Fixed bug in ASSERT_EQ and bumped to v0.1.2.

parent f0c1b5a6
No related branches found
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.1.2
- fixed bug in ASSERT_EQ
## 0.1.1 ## 0.1.1
- fixed bug in `litefprocut::init` - fixed bug in `litefprocut::init`
## 0.1.0 ## 0.1.0
......
No preview for this file type
...@@ -11,8 +11,8 @@ litefprocut::add_test(fname_var, #name, [argv](const std::string& content) ...@@ -11,8 +11,8 @@ litefprocut::add_test(fname_var, #name, [argv](const std::string& content)
if((lhs) != (rhs))\ if((lhs) != (rhs))\
{\ {\
std::cerr << "\e[31mAssertion failed:\n\e[0m";\ std::cerr << "\e[31mAssertion failed:\n\e[0m";\
std::cerr << "\e[31m\tExpected: " << rhs << "\n\e[0m";\ std::cerr << "\e[31m\tExpected: " << (rhs) << "\n\e[0m";\
std::cerr << "\e[31m\tActual: " << lhs << "\n\e[0m";\ std::cerr << "\e[31m\tActual: " << (lhs) << "\n\e[0m";\
++litefprocut::this_test.failed;\ ++litefprocut::this_test.failed;\
}\ }\
else ++litefprocut::this_test.passed; else ++litefprocut::this_test.passed;
...@@ -23,7 +23,11 @@ if(!(expr))\ ...@@ -23,7 +23,11 @@ if(!(expr))\
++litefprocut::this_test.failed;\ ++litefprocut::this_test.failed;\
}\ }\
else ++litefprocut::this_test.passed; else ++litefprocut::this_test.passed;
#define CONDITIONAL(macro, cond, ...)\
if(cond)\
{\
macro(__VA_ARGS__)\
}
// std::ifstream& litefprocut_##name##_ifs{#fname};\ // std::ifstream& litefprocut_##name##_ifs{#fname};\
// std::string litefprocut_##name##_content{};\ // std::string litefprocut_##name##_content{};\
// std::string litefprocut_##name##_aux{}\ // std::string litefprocut_##name##_aux{}\
......
# TEST(name, fname_var) # TEST(name, fname_var)
`name` - name of the test (literally, not within `"`) `name` - name of the test (literally, not within `"`)
`fname_var` - variable holding processed file name (i.e. `argv[<something>]`) `fname_var` - variable holding processed file name (i.e. `argv[<something>]`)
# ASSERT_EQ(lhs, rhs) # ASSERT_EQ(lhs, rhs)
Asserts if `lhs == rhs`. Asserts if `lhs == rhs`.
# ASSERT_TRUE(expr) # ASSERT_TRUE(expr)
Asserts if `expr` is true. Asserts if `expr` is true.
# `void litefprocut::init(const int& argc, char** argv, const std::size_t& n)` # `void litefprocut::init(const int& argc, char** argv, const std::size_t& n)`
Checks if `argc < n + 1` and marks given tests as skipped. Checks if `argc < n + 1` and marks given tests as skipped.
# `void litefprocut::run_all_tests()` # `void litefprocut::run_all_tests()`
Runs all tests in suite Runs all tests in suite
# `void litefprocut::add_test(const std::string& fname, const std::string& name, std::function<void(const std::string&)> test_func)` # `void litefprocut::add_test(const std::string& fname, const std::string& name, std::function<void(const std::string&)> test_func)`
Adds test to the `this_suite` object. Can be used directly, but without `TEST` macro in such a case. Adds test to the `this_suite` object. Can be used directly, but without `TEST` macro in such a case.
\ No newline at end of file
...@@ -11,8 +11,8 @@ litefprocut::add_test(fname_var, #name, [argv](const std::string& content) ...@@ -11,8 +11,8 @@ litefprocut::add_test(fname_var, #name, [argv](const std::string& content)
if((lhs) != (rhs))\ if((lhs) != (rhs))\
{\ {\
std::cerr << "\e[31mAssertion failed:\n\e[0m";\ std::cerr << "\e[31mAssertion failed:\n\e[0m";\
std::cerr << "\e[31m\tExpected: " << rhs << "\n\e[0m";\ std::cerr << "\e[31m\tExpected: " << (rhs) << "\n\e[0m";\
std::cerr << "\e[31m\tActual: " << lhs << "\n\e[0m";\ std::cerr << "\e[31m\tActual: " << (lhs) << "\n\e[0m";\
++litefprocut::this_test.failed;\ ++litefprocut::this_test.failed;\
}\ }\
else ++litefprocut::this_test.passed; else ++litefprocut::this_test.passed;
...@@ -23,7 +23,11 @@ if(!(expr))\ ...@@ -23,7 +23,11 @@ if(!(expr))\
++litefprocut::this_test.failed;\ ++litefprocut::this_test.failed;\
}\ }\
else ++litefprocut::this_test.passed; else ++litefprocut::this_test.passed;
#define CONDITIONAL(macro, cond, ...)\
if(cond)\
{\
macro(__VA_ARGS__)\
}
// std::ifstream& litefprocut_##name##_ifs{#fname};\ // std::ifstream& litefprocut_##name##_ifs{#fname};\
// std::string litefprocut_##name##_content{};\ // std::string litefprocut_##name##_content{};\
// std::string litefprocut_##name##_aux{}\ // std::string litefprocut_##name##_aux{}\
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment