Download the latest stable xtd.tunit version

The classic first application 'Hello World'.


#include <xtd/tunit>

#include <string>


using namespace std;

using namespace xtd::tunit;


namespace unit_tests {

  class test_class_(hello_world_test) {


    void test_method_(create_string_from_literal) {

      string s = "Hello, World!";

      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', '!'};

      assert::are_equal_("Hello, World!", s);





// The main entry point for the application.

int main(int argc, char* argv[]) {

  return console_unit_test(argv, argc).run();



cmake_minimum_required(VERSION 3.3)



find_package(xtd.tunit REQUIRED)

add_executable(${PROJECT_NAME} src/tunit_hello_world.cpp)

target_link_libraries(${PROJECT_NAME} xtd.tunit)


Start 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)

© 2019 Gammasoft.

  • Github
  • SourceForge
  • White Facebook Icon
  • White Twitter Icon
This site was designed with the
website builder. Create your website today.
Start Now