{"id":18282527,"url":"https://github.com/rafael-santiago/cutest","last_synced_at":"2025-04-05T06:30:46.781Z","repository":{"id":33129937,"uuid":"36769423","full_name":"rafael-santiago/cutest","owner":"rafael-santiago","description":"C-Library for unit testing.","archived":false,"fork":false,"pushed_at":"2021-10-08T01:10:26.000Z","size":117,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T23:41:34.766Z","etag":null,"topics":["c","dsl","internal-dsl","kernel-mode-unit-tests","memory-leak-detection","minimalist-library","suckless","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rafael-santiago.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-03T00:16:23.000Z","updated_at":"2025-01-01T13:38:34.000Z","dependencies_parsed_at":"2022-09-11T22:02:22.743Z","dependency_job_id":null,"html_url":"https://github.com/rafael-santiago/cutest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafael-santiago%2Fcutest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafael-santiago%2Fcutest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafael-santiago%2Fcutest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rafael-santiago%2Fcutest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rafael-santiago","download_url":"https://codeload.github.com/rafael-santiago/cutest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299766,"owners_count":20916183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","dsl","internal-dsl","kernel-mode-unit-tests","memory-leak-detection","minimalist-library","suckless","unit-testing"],"created_at":"2024-11-05T13:05:29.308Z","updated_at":"2025-04-05T06:30:46.255Z","avatar_url":"https://github.com/rafael-santiago.png","language":"C","funding_links":[],"categories":["Testing ##"],"sub_categories":["Web Frameworks ###"],"readme":"# Cutest\n\nCutest is an acronym that can be understood as ``C`` ``u``nit ``test``.\n\nThis library brings a bunch of macros in order to guide the implementation of unit tests for ``C`` projects.\n\n``Cutest`` brings a minimal memory leak detection system (fully working in ``Linux``, ``Windows``, ``FreeBSD``, ``Solaris``, ``NetBSD``, ``MINIX`` and ``OpenBSD``).\nYou can also use cutest to test kernel mode stuff in ``Linux``, ``FreeBSD``, ``NetBSD`` and ``Windows``.\n\nAll supported platforms by this library and other general features are listed on **Table 1**.\n\nOn ``Cutest`` is also possible customize the logs generated by your tests if you want to.\n\n**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.\n\n| **Operating System** | **Has *GNU* Backtracing?** |  **Thread safe?**    |   **Compiler/Linker flags to use (besides ``-lcutest``)** | **Kernel mode** |\n|:--------------------:|:--------------------------:|:--------------------:|:---------------------------------------------------------:|:---------------:|\n|        ``Linux``     |         *Yes*              |        *Yes*         |                                 ``-ldl``, ``-lpthread``   |     *Yes*       | \n|        ``FreeBSD``   |         *Yes*              |        *Yes*         |                           ``-lexecinfo``, ``-lpthread``   |     *Yes*       |\n|        ``NetBSD``    |         *Yes*              |        *Yes*         |                           ``-lexecinfo``, ``-lpthread``   |     *Yes*       |\n|        ``OpenBSD``   |         *Yes*              |        *Yes*         |                           ``-lexecinfo``, ``-lpthread``   |     *No*        |\n|        ``MINIX``     |         *Yes*              |        *No*          |                                   ``-lexecinfo``          |     *No*        |\n|        ``Solaris``   |         *No*               |        *Yes*         |                 ``-DNO_CUTEST_BACKTRACING``, ``-lpthread``|     *No*        |\n|        ``Windows``   |         *Yes*              |        *Yes*         |                                                           |     *Yes*       |\n\nOf course, that it should run in a bunch of ``UNIX`` boxes, however I prefer listing the places where I actually watched it running\nand working pretty fine. If there is a specific non-listed platform that you want to use ``cutest``, let me know, maybe I\ncan adjust the library's build to accomplish your requirements ;)\n\n**Remark**: When using cutest to test kernel mode code you do not need compiler flags because all is available in one single\nheader file. For more details read the documentation.\n\n## How to build it\n\nTo build ``cutest`` is necessary to use my own build system called [hefesto](https://github.com/rafael-santiago/hefesto.git). Being\n``Hefesto`` installed in your system all you need to emit on a ``shell`` inside the cutest's ``src`` sub-directory is:\n\n``hefesto``\n\nAfter the build a file named ``libcutest.a`` that stands for the library will be generated under the path ``src/lib``.\nYou should use this file and the header ``src/cutest.h`` to develop your further ``unit tests``.\n\nNote that the build was written based on ``GCC``. So, you need to have the ``gcc``/``mingw`` installed (and well exported)\nin your system before going ahead.\n\nMaybe you should read the [documentation](https://github.com/rafael-santiago/cutest/blob/master/doc/README.md) before starting.\n\n**Tip**: In case of trying to compile it under a ``UNIX`` environment with no support for ``PTHREADS`` before calling ``hefesto``\nyou need to edit the file ``src/.ivk`` and add the following ``C Macro`` definition ``-DHAS_NO_PTHREAD`` to ``--cflags`` option:\n\n```\n--cflags=-DHAS_NO_PTHREAD\n```\n\n### Note for Visual Studio users\n\nIf you want to build ``cutest`` under ``MSVC`` you need to invoke ``Hefesto`` as follows:\n\n```\n\u003e hefesto --toolset=msvc-c-lib\n```\n\nThe command above will build ``lib/libcutestmt.lib``.\n\nIf you want to build ``lib/libcutestmtd.lib``, use:\n\n```\n\u003e hefesto --toolset=msvc-c-lib --compile-model=debug\n```\n\nOn ``64-bit`` environments ``64-bit`` lib artifacts will be built, for ``32-bit``, use:\n\n```\n\u003ehefesto --toolset=msvc-c-lib --cpu-arch=x86\n```\n\nAfter run one of the commands listed above, a file named ``libcutest.lib`` will be generated inside ``src/lib`` path.\nNote that use ``cutest`` on ``MSVC`` is a little bit tricky. It envolves composite the ``cutest`` with your current ``msvcrt.lib``\n(it explains why the ``cutest.lib`` is so huge).\n\n**Important**: When linking your test artifact. You need to add the following link option: ``/NODEFAULTLIB:MSVCRT,MSVCRTD``.\n\nI have tested it over ``Microsoft Visual Studio 2019``.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafael-santiago%2Fcutest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frafael-santiago%2Fcutest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frafael-santiago%2Fcutest/lists"}