Git Product home page Git Product logo

catch2-demo's Introduction

Build Status Coverage Status License

catch2-demo

C++ unit test demo using Catch2 with continuous integration provided by GitHub Actions and test coverage deployed to Coveralls.

How to build this demo

git clone https://github.com/ENCCS/catch2-demo.git
cd catch2-demo
cmake -S. -Bbuild 
cmake --build build

Running the tests

Either using ctest:

$ cd build
$ ctest

Test project /home/user/catch2-demo/build
    Start 1: Use the example library to add numbers
1/2 Test #1: Use the example library to add numbers ........   Passed    0.01 sec
    Start 2: Use the example library to subtract numbers
2/2 Test #2: Use the example library to subtract numbers ...   Passed    0.01 sec

100% tests passed, 0 tests failed out of 2

Label Time Summary:
unit    =   0.01 sec*proc (2 tests)

Total Test time (real) =   0.02 sec

Or directly using unit_tests:

$ cd build 
$ ./bin/unit_tests --success

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
unit_tests is a Catch v2.13.4 host application.
Run with -? for options

-------------------------------------------------------------------------------
Use the example library to add numbers
-------------------------------------------------------------------------------
/home/user/catch2-demo/test/example_add.cpp:7
...............................................................................

/home/user/catch2-demo/test/example_add.cpp:9: PASSED:
  REQUIRE( res == 3.0_a )
with expansion:
  3.0 == Approx( 3.0 )

-------------------------------------------------------------------------------
Use the example library to subtract numbers
-------------------------------------------------------------------------------
/home/user/catch2-demo/test/example_subtract.cpp:7
...............................................................................

/home/user/catch2-demo/test/example_subtract.cpp:9: PASSED:
  REQUIRE( res == -1.0_a )
with expansion:
  -1.0 == Approx( -1.0 )

===============================================================================
All tests passed (2 assertions in 2 test cases)

catch2-demo's People

Contributors

robertodr avatar shamray 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.