Giter Site home page Giter Site logo

libunit's Introduction

libunit

This is a small unit testing library created with the intent of making unit tests in C more accesible.

I plan on writting a step by step introductory guide on how to make the most of Test Driven Development (TDD) using this library.

Usage:

git clone [email protected]:jlsrvr/libunit.git

This will clone the library as well as a set of tests to benchmark the library, these are found in the tests folder at the root of the project.

For a basic example of how to use the library see the tests directory.

Main function to be used :

Adding a single test to a suite:

void load_test(t_unit_lst **lst, char *describe, int (*test)(void*), void *params);

Launching a test suite:

int launch_tests(t_unit_lst **lst, char *title);

Adding a test suite:

void load_suite(t_suite_lst **lst, int (*suite)(void));

Running all the test suites:

int run_suites(t_suite_lst **suites, char *title);

Redirecting output of the function you are testing:

t_fd *redirect_stdout(char *filepath);
OR
t_fd *redirect_stderr(char *filepath);

Reversing the redirection:

void	reverse_redirect(t_fd *my_fd);

Comparing two files:

int		file_diff(char *filepath1, char *filepath2, int print);

libunit's People

Contributors

jlsrvr avatar

Watchers

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