Coder Social home page Coder Social logo

gammasoft71 / tunit Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 0.0 2.5 MB

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

Home Page: https://gammasoft71.wixsite.com/tunit

License: MIT License

CMake 0.86% Batchfile 0.08% Shell 0.29% C++ 98.54% C 0.23%
cpp17 library libraries unittest unittests unit-testing unit-test unit-tests unit-testing-framework unit-tesing macosx multi-platform ios cpp test testing test-framework tdd framework

tunit's Introduction

tunit

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

tunit

Continuous Integration build status

Operating system Status
Windows Build status
macOS Build Status
Linux Build Status

Download the latest stable tunit version

SourceForge Download tunit

Features

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

For more information see

Examples

The classic first application 'Hello World'.

tunit_hello_world.cpp

#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();
}

CMakeLists.txt

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)

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)

Getting Started

  • 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.

tunit's People

Contributors

gammasoft71 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.