GithubHelp home page GithubHelp logo

isabella232 / theft Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fastly/theft

0.0 0.0 0.0 440 KB

property-based testing for C: generate input to find obscure bugs, then reduce to minimal failing input

License: ISC License

Makefile 1.29% C 98.47% Awk 0.24%

theft's Introduction

theft: property-based testing for C

theft is a C library for property-based testing. Where example-based testing checks test results for specific input, theft tests assert general properties ("for any possible input, [some condition] should hold"), generate input, and search for counter-examples that make the test fail. If theft finds any failures, it also knows how to generate and test simpler variants of the input, and then report the simplest counter-example found.

theft is distributed under the ISC license.

Installation

theft does not depend on anything beyond C99 and a Unix-like environment. Its internal tests use greatest, but there is not any coupling between them. It contains implementations of the Mersenne Twister PRNG and the FNV-1a hashing algorithm - see their files for copyright info.

To build, using GNU make:

$ make

Note: You may need to call it as gmake, especially if building on BSD.

To build and run the tests:

$ make test

This will produce example output from several falsifiable properties, and confirm that failures have been found.

To install libtheft and its headers:

$ make install    # using sudo, if necessary

theft can also be vendored inside of projects -- in that case, just make sure the headers in ${VENDOR}/theft/inc/ are added to the -I include path, and ${VENDOR}/theft/build/libtheft.a is linked.

Usage

For usage documentation, see doc/usage.md.

Properties

For some examples of properties to test, see doc/properties.md.

Shrinking and Auto-shrinking

For more info about shrinking and auto-shrinking, see doc/shrinking.md.

Forking

theft can fork before running properties, to shrink failures that make the code under test crash or exceed an optional timeout. For more info, see doc/forking.md.

theft's People

Contributors

alyptik avatar iximeow avatar jmesmon avatar katef avatar kquick avatar lochsh avatar neuschaefer avatar richardipsum avatar silentbicycle 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.