{"id":17149816,"url":"https://github.com/keeferrourke/libtdd","last_synced_at":"2026-01-20T10:33:24.366Z","repository":{"id":72115361,"uuid":"128562502","full_name":"keeferrourke/libtdd","owner":"keeferrourke","description":"libtdd is a minimalist testing framework inspired by the golang testing pkg","archived":false,"fork":false,"pushed_at":"2019-09-24T16:45:18.000Z","size":285,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"development","last_synced_at":"2025-04-06T03:42:33.592Z","etag":null,"topics":["c","c-library","c99","library","posix","tdd","test-driven-development","testing","testing-framework"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keeferrourke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-07T19:46:48.000Z","updated_at":"2021-03-26T19:59:41.000Z","dependencies_parsed_at":"2023-04-20T19:17:37.111Z","dependency_job_id":null,"html_url":"https://github.com/keeferrourke/libtdd","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/keeferrourke/libtdd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keeferrourke%2Flibtdd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keeferrourke%2Flibtdd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keeferrourke%2Flibtdd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keeferrourke%2Flibtdd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keeferrourke","download_url":"https://codeload.github.com/keeferrourke/libtdd/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keeferrourke%2Flibtdd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28601880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T09:39:28.479Z","status":"ssl_error","status_checked_at":"2026-01-20T09:38:10.511Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","c-library","c99","library","posix","tdd","test-driven-development","testing","testing-framework"],"created_at":"2024-10-14T21:34:11.063Z","updated_at":"2026-01-20T10:33:24.351Z","avatar_url":"https://github.com/keeferrourke.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"libtdd\n======\n\n[![repo ci status](https://img.shields.io/travis/com/keeferrourke/libtdd.svg)\n![dev ci status](https://img.shields.io/travis/com/keeferrourke/libtdd/development.svg?label=build%20%28dev%29)](https://travis-ci.com/keeferrourke/libtdd)\n[![v0.0.2](https://img.shields.io/badge/version-0.0.2%20%28alpha%29-blue.svg)](#)\n\n`libtdd` is a minimalist testing framework inspired by the Golang\ntesting pkg. It is designed to provide a framework which may be used to\nbuild scaffolding during Test Driven Development (TDD).\n\nThis small C library attempts to provide a simple, featureful API for\ncreating, running, and checking the results of tests.  Simply declare\ntest functions, add them to a suite in your `main()`, compile and run :)\n\n\nFeatures\n--------\n\n * Easy API for test suite creation and execution using TDD semantics\n * Simple benchmarking\n * Pretty output with optional colour support\n * Summary statistics\n * Catch and count crashes (SIGSEGV handler)\n\n\nBuild and Installation\n----------------------\n\n### Meson (Ninja)\n\nTo build this library, run\n\n    meson setup --prefix=/usr/local _build\n    ninja -C _build\n\nTo install the library and documentation, run\n\n    ninja -C _build all docs install\n\nBuilds have been tested for Fedora 29 Workstation, Ubuntu 16.04, and\nmacOS Mojave with both `clang` and `gcc`.\n\n#### Build options\n\nBuild options are detailed in the `meson_options.txt` file.\nYou may modify them there as required.\n\n### Make\n\nThis project was originally built with GNU Make before I migrated to\nMeson/Ninja. The included Makefile will not be updated, but also won't\nbe removed in the foreseeable future.\n\n\nUsage\n-----\n\n### Documentation\n\nThis library is extensively documented. You can generate the\ndocumentation with `doxygen`.\n\nDocumentation is provided in the following formats:\n\n - HTML\n - PDF (requires `LaTeX`)\n - man pages (run `man -m _build/docs/man $page` to view)\n\nTo build the documentation, run the following:\n\n    ninja -C _build docs\n\nIt will be output to `_build/docs`.\n\n### Example program\n\nA simple example program that demonstrates all features provided by this\nlibrary can be found in the `examples/` directory of this project.\n\nIt is built as part of the default build target,\n\n### Conventions to follow\n\n#### Test functions\n\nEvery testing function is defined as a `void* test_myfunc(void* t)`\nwhere the parameter `t` is a `test_t` that records information about\nthe test, including failure and error states, and start and end time\nof each test. The parameter and return types are `void*` because tests\nare run in `pthreads`. Despite this, there is no need to cast `t` when\ncalling the provided API functions.\n\nA test is assumed to have succeeded if it runs to completion without\nraising any failure or error flags. A test can be marked as a failure\nby a call to `test_fail(t, \"reason\")`; you should return from the test\nfunction shortly after this call is made. Non-critical errors that\nshould not end a test can be recorded by `test_error(t, \"reason\")`.\n\nThe macro `test_fatal(t, \"reason\")` exists for convenience so you don't\nneed to return from a failure condition (this is handled automatically)\nbut should be used sparingly as you won't have an opportunity to run\nclean-up code if it executes.\n\nThe start of a test can be optionally flagged by `test_timer_start(t)`\nand the end the test can be similarly flagged by `test_timer_end(t)`,\nif the name of your test is prefixed by `bench_` then these functions\nwill be called for you automatically.\n\n#### Benchmarked functions\n\nIf benchmarking a test, then the `test_timer_start(t)` and\n`test_timer_end(t)` function calls will automatically be called if\nthe test name is prefixed by `bench_`. These times will be automatically\nrecorded by the suite and reported at the end.\n\nCalls to `test_timer_start(t)` and `test_timer_end(t)` may still be made\nto override the start and end times if the benchmarks require setup and\nteardown code that should not be included in the recorded time.\n\ni.e. a benchmarking function may be simply defined as\n\n    void* bench_func(void* t) {\n        ...\n        return NULL;\n    }\n\nand can be added to a test suite as a benchmarking function by\n\n    suite_addtest(s, newtest(\"bench_one\", \u0026bench_func));\n\nAfter execution of each benchmark function, a short summary of runtime\nis printed.\n\n\nFuture development\n------------------\n\nThere are no bugs to speak of at the moment :)\n\n### Possible feature work\n\n * It might be nice to optionally run tests in parallel; currently all\n   tests run sequentially in the order they are added to the suite\n * I'll probably factor out the reporter interface so that new reporters\n   can be written and used to display results\n * It might be good to specify how long a benchmarked function has to\n   run before it might be considered a failure due to poor performance\n\n\nLicense information\n-------------------\n\nCopyright (c) 2018-2019 Keefer Rourke \u003cmail@krourke.org\u003e\n\nThis software is released under the ISC License. See [LICENSE](LICENSE)\nfor more details.\n\n\nAlternatives\n------------\n\nThis project aims to realize a modern, easy to use solution for C\ntesting frameworks. If you don't want to use this, there are some\nalternatives that I like:\n\n - [`rcunit`](https://github.com/jecklgamis/rcunit)\n    + Seems very similar to the goals of my project;\n      I wish I'd known about it before :wink:\n - [`minunit`](http://www.jera.com/techinfo/jtns/jtn002.html)\n    + For the ultra minimal\n - [`check`](https://libcheck.github.io/check/)\n    + Includes an extensive assertion library\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeeferrourke%2Flibtdd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeeferrourke%2Flibtdd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeeferrourke%2Flibtdd/lists"}