Coder Social home page Coder Social logo

gitpocket / mettle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jimporter/mettle

0.0 1.0 0.0 1.57 MB

A C++14 unit test framework

Home Page: https://jimporter.github.io/mettle

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.84% Python 0.64% C++ 98.53%

mettle's Introduction

mettle

Documentation Travis build status Appveyor build status

mettle is a "batteries included" unit testing framework for C++14. Its mission is to provide a full toolbox to address your testing needs and to look good doing it.

Features

Build your own assertions

Expectations (assertions) are defined using composable matchers that automatically generate human-readable output, ensuring even complex objects are easy to test.

Nest your tests

Suites group your tests together and can be nested as deeply as you need, so you can use their hierarchy to set up and tear down your fixtures for you.

Don't repeat yourself

Type- and value-parameterized tests let you write your tests once and apply them to multiple implementations or preconditions.

Aggregate everything

The mettle universal test runner makes it a snap to write multiple, independent test files โ€“ even ones running completely different kinds of tests โ€“ and aggregate them into a single list of results.

A Brief Example

A picture is worth a thousand words, and code's almost as good (I'm sure it's worth at least 100 words), so let's take a look at a test file:

#include <mettle.hpp>
using namespace mettle;

suite<> basic("a basic suite", [](auto &_) {

  _.test("a test", []() {
    expect(true, equal_to(true));
  });

  for(int i = 0; i < 4; i++) {
    _.test("test number " + std::to_string(i), [i]() {
      expect(i % 2, less(2));
    });
  }

  subsuite<>(_, "a subsuite", [](auto &_) {
    _.test("a sub-test", []() {
      expect(true, equal_to(true));
    });
  });

});

License

This library is licensed under the BSD 3-Clause license.

mettle's People

Contributors

jmgao avatar d0ugal avatar

Watchers

James Cloos 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.