Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pmalek/quick
quick aims to be a small header only library to help black box testing in C++
https://github.com/pmalek/quick
blackbox-testing cpp cpp14 testing
Last synced: 6 days ago
JSON representation
quick aims to be a small header only library to help black box testing in C++
- Host: GitHub
- URL: https://github.com/pmalek/quick
- Owner: pmalek
- License: gpl-3.0
- Created: 2016-08-04T20:27:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-01-24T10:48:14.000Z (almost 4 years ago)
- Last Synced: 2024-10-29T10:52:08.330Z (about 2 months ago)
- Topics: blackbox-testing, cpp, cpp14, testing
- Language: C++
- Size: 18.6 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# quick
![C++](https://img.shields.io/badge/language-C%2B%2B-blue.svg) ![License](https://img.shields.io/badge/license-GPLv3-blue.svg)
`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](https://golang.org/pkg/testing/quick/)### 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:
```cpp
#include
#include#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");
}
```