GitXplorerGitXplorer
a

libCAssert

public
1 stars
0 forks
0 issues

Commits

List of commits on branch main.
Unverified
dee27dc07e369c93d5ec4e4e434196f9d139a537

M: README update

aandreyvdl committed 8 months ago
Unverified
d5c39bc0d7bd13e6ab23c88aa478785051fe6589

+: fully void comparison plus "differs from"

aandreyvdl committed 8 months ago
Verified
45637241cdd739ded2ec30cfa966bc29ef22caa4

Update libassert.h

aandreyvdl committed 9 months ago
Verified
39892921cde6f7f913d0b521a64a7cd3bc49aa84

Update group_assert.c

aandreyvdl committed 9 months ago
Unverified
90baa122d8f5552b5e955318e59397440d9095a1

FR: minor fixes and refactor

aandreyvdl committed 9 months ago
Verified
164db1b1177acbd32f55dcca14d32b04480feec0

Update README.md

aandreyvdl committed 9 months ago

README

The README file for this repository.

libCAssert

Did you know that C has a macro function that checks a test for you? Well it doesn't work very well because if something wents wrong it will abort the program, so i decided to make this library.

Dependencies

  • C compiler (gcc, clang, cc, etc);
  • 64 bits system (because all tests with int will be using int64_t);

Compile it

git clone https://github.com/andreyvdl/libCAssert
cd libCAssert
make

Now move the libcassert.a to any project you want to use it.
You can also combine it to another .a that you are using in your project by rename/copy it or by:

ar -x libcassert.a
mv *.o /path/where/you/want

THE FUCKING MANUAL

You can do quick tests and group tests:

Group

Group tests are for pointers, int64_t and doubles.
They receive an array of instances (t_inst), two arrays of their type (one for your results and the other for your expects) and the size of these arrays (if the size is wrong the behaivor is undefined).
Group tests only print the title and description of the first instance (instance[0]).

Quick

Quick tests are almost equal to Group tests, but don't receive arrays nor the size (for obvious reasons).
Quick tests will always print the title and description of their instance.

Typedefs

There are 2 structs and 1 enum:

  • t_comp an enum that represents less-equal than (<=), less than (<), equal (==), greater than (>), greater-equal than (>=) and different (!=).
  • t_text a struct that contains a text field and a color field (macros for the colors are on libassert.h, if you want to use your own colors the program expects an ANSI pattern).
  • t_inst the main struct for instances, it takes 4 t_texts for title, description, ok message and ko messages, and a t_comp with the comparision type of that instance.