A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/codeplea/minctest below:

codeplea/minctest: tiny unit testing framework for ANSI C

Minctest is a very minimal unit-testing "framework" written in ANSI C and implemented in a single header file. It's handy when you want some real simple unit tests for a small project.

Basically, it implements assertion and equal functions. It'll track and time how many tests pass and fail. Failed tests will also display which line the failing test code was on.

There is a Node.js port here and a Lua port here.

#include "minctest.h"

void test1() {
    lok('a' == 'a');
}

void test2() {
    lequal(5, 5);
    lfequal(5.5, 5.5);
    lsequal("abc", "abc");
}

int main(int argc, char *argv[])
{
    lrun("test1", test1);
    lrun("test2", test2);
    lresults();
    return lfails != 0;
}

That produces the following output:

        test1:
         -- pass: 1                    fail: 0                    time: 12ms
        test2:
         -- pass: 3                    fail: 0                    time: 0ms
ALL TESTS PASSED (4/4)
 All functions/variables start with the letter 'l'.

Minctest is used in almost all of my C projects, including:

You can check those out to see how Minctest is used in practice.

If you're using Minctest in your project, let me know. I could add a link back.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4