mdst is a static library for testing.
To install, run :
$ make && sudo make install
To use, simply include in your test file:
#include <mdst.h>
To specify a test name, use :
#define test_name "whateveryouwant"
By default, test name value is "undefined_test_name"
Where main.c
is your source file and exec
the output executable :
$ gcc -static main.c -lmdst -o exec
// file.h
int ret_zero();
// file.c
int ret_zero()
{
return -1; // Failing test.
}
// test_file.c
#include <stdio.h>
#include <stdlib.h>
#define test_name "test_if_eq_zero"
#include <mdst.h>
#include "file.h"
int main(int argc, char *argv[])
{
m_assert(ret_zero() == 0, "error : `" test_name "` failed.");
return EXIT_SUCCESS;
}
$ gcc -static file.c test_file.c -lmdst -o exec