Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

README.md

quick

C++ License

quick aims to be a small header only library to help black box testing in C++. It borrows the idea from Golang's testing/quick package

Idea

Create a predicate where you want to test your struct/class/function/member function and return true on success. quick will randomly generate input data to this predicate and launch it predefined number of iterations or will keep running for predefined time duration.

Note

quick is in very alpha state not even remotely close to being ready for production

Example usage:

#include <iostream>
#include <string>

#include "quick.hpp"

using namespace std::chrono_literals;

std::string prefix(const std::string& s, int n)
{
  static int counter = 0;
  ++counter;
  return s.substr(0, n);
}

int main()
{
    auto f1 = [](const std::string& s, int n){
      const std::string ret = prefix(s, n);
      return ret == s.substr(0, n);
    };
    quick::check(f1, 200ms, "Prefix always has N length - 200ms");

    auto f2 = [](const std::string& s, int n){
      const std::string ret = prefix(s, n);
      return ret == s.substr(0, n);
    };
    quick::check(f2, 100, "Prefix always has N length - 100 iterations");
}

About

quick aims to be a small header only library to help black box testing in C++

Topics

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.