ProductPromotion
Logo

C Programming

made by https://0x3d.site

GitHub - rafael-santiago/cutest: C-Library for unit testing.
C-Library for unit testing. Contribute to rafael-santiago/cutest development by creating an account on GitHub.
Visit Site

GitHub - rafael-santiago/cutest: C-Library for unit testing.

GitHub - rafael-santiago/cutest: C-Library for unit testing.

Cutest

Cutest is an acronym that can be understood as C unit test.

This library brings a bunch of macros in order to guide the implementation of unit tests for C projects.

Cutest brings a minimal memory leak detection system (fully working in Linux, Windows, FreeBSD, Solaris, NetBSD, MINIX and OpenBSD). You can also use cutest to test kernel mode stuff in Linux, FreeBSD, NetBSD and Windows.

All supported platforms by this library and other general features are listed on Table 1.

On Cutest is also possible customize the logs generated by your tests if you want to.

Table 1: Places where I have been running it. A.k.a. supported platforms. In additional, the compiler/linker options to be passed when using cutest as your unit testing library.

Operating System Has GNU Backtracing? Thread safe? Compiler/Linker flags to use (besides -lcutest) Kernel mode
Linux Yes Yes -ldl, -lpthread Yes
FreeBSD Yes Yes -lexecinfo, -lpthread Yes
NetBSD Yes Yes -lexecinfo, -lpthread Yes
OpenBSD Yes Yes -lexecinfo, -lpthread No
MINIX Yes No -lexecinfo No
Solaris No Yes -DNO_CUTEST_BACKTRACING, -lpthread No
Windows Yes Yes Yes

Of course, that it should run in a bunch of UNIX boxes, however I prefer listing the places where I actually watched it running and working pretty fine. If there is a specific non-listed platform that you want to use cutest, let me know, maybe I can adjust the library's build to accomplish your requirements ;)

Remark: When using cutest to test kernel mode code you do not need compiler flags because all is available in one single header file. For more details read the documentation.

How to build it

To build cutest is necessary to use my own build system called hefesto. Being Hefesto installed in your system all you need to emit on a shell inside the cutest's src sub-directory is:

hefesto

After the build a file named libcutest.a that stands for the library will be generated under the path src/lib. You should use this file and the header src/cutest.h to develop your further unit tests.

Note that the build was written based on GCC. So, you need to have the gcc/mingw installed (and well exported) in your system before going ahead.

Maybe you should read the documentation before starting.

Tip: In case of trying to compile it under a UNIX environment with no support for PTHREADS before calling hefesto you need to edit the file src/.ivk and add the following C Macro definition -DHAS_NO_PTHREAD to --cflags option:

--cflags=-DHAS_NO_PTHREAD

Note for Visual Studio users

If you want to build cutest under MSVC you need to invoke Hefesto as follows:

> hefesto --toolset=msvc-c-lib

The command above will build lib/libcutestmt.lib.

If you want to build lib/libcutestmtd.lib, use:

> hefesto --toolset=msvc-c-lib --compile-model=debug

On 64-bit environments 64-bit lib artifacts will be built, for 32-bit, use:

>hefesto --toolset=msvc-c-lib --cpu-arch=x86

After run one of the commands listed above, a file named libcutest.lib will be generated inside src/lib path. Note that use cutest on MSVC is a little bit tricky. It envolves composite the cutest with your current msvcrt.lib (it explains why the cutest.lib is so huge).

Important: When linking your test artifact. You need to add the following link option: /NODEFAULTLIB:MSVCRT,MSVCRTD.

I have tested it over Microsoft Visual Studio 2019.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory