Skip to content
/ nosh Public

nosh is a simple, no shit C++ test framework. It aims to do no voodoo magic behind your back.

License

Notifications You must be signed in to change notification settings

tejainece/nosh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nosh

nosh is a no shit C++ test framework

Why write tests with nosh?

  1. What you see is what you get. No magic behind your back.
  2. No shoutcased macros
  3. A test is a simple C++ class. An assertion is a simple method of the Test class with defined syntax.
  4. Easy to understand and get started.
  5. Develop parameter based tests. Easily generate parameters for tests using Generators.

Getting started

  1. Download nosh.hpp or clone this repository
  2. Make sure nosh.hpp is in one of your project's include paths
  3. Follow the tutorial section to add test cases to your project using nosh

Tutorial

Simple test

class SimpleTest: public Test {
public:
  SimpleTest() {
    //TODO Construction goes here
  }
  
  virtual ~SimpleTest() {
    //TODO Destruction goes here
  }
  
  virtual void run() {
    //TODO Test logic goes here
  }
};

int main(void) {
  execTest(SimpleTest());
}

Assertions

Basic assertions

Fatal assertion Nonfatal assertion Verifies
assertTrue(condition); expectTrue(condition); condition is true
assertFalse(condition); expectFalse(condition); condition is false

Binary assertions

Fatal assertion Nonfatal assertion Verifies
assertEQ(val1, val2); expectEQ(val1, val2); val1 == val2
assertNE(val1, val2); expectNE(val1, val2); val1 != val2
assertLT(val1, val2); expectLT(val1, val2); val1 < val2
assertLE(val1, val2); expectLE(val1, val2); val1 <= val2
assertGT(val1, val2); expectGT(val1, val2); val1 > val2
assertGE(val1, val2); expectGE(val1, val2); val1 >= val2

Test with assertions

TBD

Test with parameters

TBD

Generating parameters

TBD

Creating generators

TBD

Features

  • Test fixtures
  • Basic and binary assertions
  • Tests with parameters
  • Parameter generators
  • Print information about test case before run. Print parameters in case parameters are involved
  • Versbose/No verbose command line flag
  • Filter tests from command line
  • Filter tests programatically
  • Export test results in JSON, XML

About

nosh is a simple, no shit C++ test framework. It aims to do no voodoo magic behind your back.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages