Modern c++17 unit testing framework on Windows, macOS, Linux, iOS and android.
Operating system | Status |
---|---|
Windows | |
macOS | |
Linux |
- An xUnit test framework.
- Auto registration of class and method based tests.
- Rich set of assertions.
- ...
The classic first application 'Hello World'.
#include <tunit/tunit>
#include <string>
using namespace std;
using namespace tunit;
namespace unit_tests {
class test_class_(hello_world_test) {
public:
void test_method_(create_string_from_literal) {
string s = "Hello, World!";
valid::are_equal(13, s.size());
assert::are_equal("Hello, World!", s);
}
void test_method_(create_string_from_chars) {
string s = {'H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!'};
valid::are_equal(13, s.size());
string_assert::starts_with("Hello,", s);
string_assert::ends_with(" World!", s);
}
};
}
// The main entry point for the application.
int main() {
return console_unit_test().run();
}
cmake_minimum_required(VERSION 3.3)
project(tunit_hello_world)
find_package(tunit REQUIRED)
add_executable(${PROJECT_NAME} tunit_hello_world.cpp)
target_link_libraries(${PROJECT_NAME} tunit)
tart 2 tests from 1 test case
Run tests:
SUCCEED hello_world_test.create_string_from_literal (0 ms total)
SUCCEED hello_world_test.create_string_from_chars (0 ms total)
Test results:
SUCCEED 2 tests.
End 2 tests from 1 test case ran. (0 ms total)
- Installation provides download and install documentation.
- Portability provides information about C++, libraries dependency, Operating System suported, Compilators and Devepment Environment tools.
- Examples provides some examples.
© 2021 Gammasoft.