Skip to content
Modern c++17 unit testing framework on Microsoft Windows, Apple macOS, Linux, iOS and android.
C++ Other
  1. C++ 98.8%
  2. Other 1.2%
Branch: master
Clone or download
Latest commit 7cedb8e Dec 29, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs add docs Oct 9, 2019
examples xtd integration Aug 21, 2019
scripts Update git_pull_submodules.sh Oct 25, 2019
src Update assert.hpp Dec 29, 2019
tests fix build on xcode 11 Sep 21, 2019
.appveyor.yml first commit Feb 13, 2019
.codecov.yml first commit Feb 13, 2019
.codedocs first commit Feb 13, 2019
.doxygen.txt Update .doxygen.txt Oct 27, 2019
.gitignore first commit Feb 13, 2019
.travis.yml change to xcode 10.1 Feb 22, 2019
CMakeLists.txt move xtd.tunit to src/xtd_tunit Oct 10, 2019
LICENSE.md first commit Feb 13, 2019
README.md
install
install.cmd add docs Apr 14, 2019

README.md

tunit

Build Status Build status codecov Documented Documentation Website license SourceForge Download tunit c++17 Windows macOS Linux iOS android

Modern c++17 unit testing framework on Windows, macOS, Linux, iOS and android.

Features

  • An xUnit test framework.
  • Auto registration of class and method based tests.
  • Rich set of assertions.
  • ...

For more information see xtd.tunit website (or markdown documentations) and Reference Guide.

Examples

The classic first application 'Hello World'.

src/tunit_hello_world.cpp:

#include <xtd/tunit>
#include <string>

using namespace std;
using namespace xtd::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();
}

CMakeLists.txt:

cmake_minimum_required(VERSION 3.3)

project(tunit_hello_world)
find_package(xtd.tunit REQUIRED)
add_executable(${PROJECT_NAME} src/tunit_hello_world.cpp)
target_link_libraries(${PROJECT_NAME} xtd.tunit)

Output:

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)

For more examples see examples

Download and install

Before running examples you must download and install tunit. To download and install it read downloads file.


© 2019 Gammasoft.

You can’t perform that action at this time.