{"id":17261593,"url":"https://github.com/nvll/units","last_synced_at":"2025-03-26T10:11:06.121Z","repository":{"id":2813045,"uuid":"3814425","full_name":"nvll/units","owner":"nvll","description":"A simple, minimal and dynamic C unit testing framework","archived":false,"fork":false,"pushed_at":"2012-03-25T18:43:06.000Z","size":116,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-31T11:24:39.016Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nvll.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-24T01:59:35.000Z","updated_at":"2013-09-29T23:16:30.000Z","dependencies_parsed_at":"2022-07-12T21:40:42.742Z","dependency_job_id":null,"html_url":"https://github.com/nvll/units","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/nvll%2Funits","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvll%2Funits/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvll%2Funits/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nvll%2Funits/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nvll","download_url":"https://codeload.github.com/nvll/units/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245632423,"owners_count":20647193,"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":[],"created_at":"2024-10-15T07:51:38.620Z","updated_at":"2025-03-26T10:11:06.096Z","avatar_url":"https://github.com/nvll.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Units\n=====\n\nUnits is simple / dynamic unit testing framework for C (and C++, I suppose). \n\n###Main features:\n- Lightweight\n- Tests are sandboxed, but can share functions in their own files\n- There is no global configuration. All tests are completely contained within their own file, no registration needed.\n- It should run on any unix system with a somewhat recent version of GCC (tested on 4.2 and 4.6)\n- Output is TAP compliant\n\n###Writing tests\nSee example.c. Each function is called individually as its own test if included with add_test. Tests are sandboxed in\nchild processes so there is no memory sharing between them.\n\n###Running tests\nRunning tests is easy. For most projects you can simply drop a .c in the tests directory, build and run:\n\n\tuser@host:~/code/units$ make\n\tcompiling main.c\n\tcompiling tests/example.c\n\tlinking runtests\n\tuser@host:~/code/units$ ./runtests \n\t1..4\n\tok 1 - always_passing\n\tnot ok 2 - always_failing\n\tnot ok 3 - fail_with_output\n\t\tthis is a string with\n\t\tlinebreaks\n\t\tin the failure output\n\tok 4 - pass_with_output\n\t\teverything went better than expected\n\t# 4 tests run, 2/4 passed \n\nExample of running the example tests via `prove`:\n\n\tuser@host:~/code/units$ prove -e '' -v ./runtests \n\t./runtests .. \n\t1..4\n\tok 1 - always_passing\n\tnot ok 2 - always_failing\n\tnot ok 3 - fail_with_output\n\t\tthis is a string with\n\t\tlinebreaks\n\t\tin the failure output\n\tok 4 - pass_with_output\n\t\teverything went better than expected\n\t# 4 tests run, 2/4 passed\n\tDubious, test returned 2 (wstat 512, 0x200)\n\tFailed 2/4 subtests \n\t\n\tTest Summary Report\n\t-------------------\n\t./runtests (Wstat: 512 Tests: 4 Failed: 2)\n  \tFailed tests:  2-3\n  \tNon-zero exit status: 2\n\tFiles=1, Tests=4,  0 wallclock secs ( 0.03 usr +  0.00 sys =  0.03 CPU)\n\tResult: FAIL\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvll%2Funits","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnvll%2Funits","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnvll%2Funits/lists"}