{"id":13670585,"url":"https://github.com/siu/minunit","last_synced_at":"2025-04-27T13:32:29.378Z","repository":{"id":3711496,"uuid":"4783321","full_name":"siu/minunit","owner":"siu","description":"Minimal unit testing framework for C","archived":false,"fork":false,"pushed_at":"2023-10-27T06:25:41.000Z","size":51,"stargazers_count":591,"open_issues_count":5,"forks_count":101,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-04-20T06:53:42.147Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"making/config-repo","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/siu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2012-06-25T15:17:12.000Z","updated_at":"2025-04-15T07:30:53.000Z","dependencies_parsed_at":"2024-01-05T22:05:12.389Z","dependency_job_id":"c8113301-1163-4100-874f-8015bb251cd7","html_url":"https://github.com/siu/minunit","commit_stats":{"total_commits":56,"total_committers":17,"mean_commits":"3.2941176470588234","dds":0.4285714285714286,"last_synced_commit":"b15ad0ae28f1a7a43881ea17defb0a4367d9582d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siu%2Fminunit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siu%2Fminunit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siu%2Fminunit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siu%2Fminunit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siu","download_url":"https://codeload.github.com/siu/minunit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251145642,"owners_count":21543075,"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-08-02T09:00:45.768Z","updated_at":"2025-04-27T13:32:24.363Z","avatar_url":"https://github.com/siu.png","language":"C","readme":"## MinUnit\n\nMinunit is a minimal unit testing framework for C/C++ self-contained in a\nsingle header file.\n\nIt provides a way to define and configure test suites and a few handy assertion\ntypes.  It reports the summary of the number of tests run, number of assertions\nand time elapsed.\n\nNote that this project is based on:\nhttp://www.jera.com/techinfo/jtns/jtn002.html\n\n## How to use it\n\nThis is a minimal test suite written with minunit:\n\n```c\n#include \"minunit.h\"\n\nMU_TEST(test_check) {\n\tmu_check(5 == 7);\n}\nMU_TEST_SUITE(test_suite) {\n\tMU_RUN_TEST(test_check);\n}\n\nint main(int argc, char *argv[]) {\n\tMU_RUN_SUITE(test_suite);\n\tMU_REPORT();\n\treturn MU_EXIT_CODE;\n}\n```\n\nWhich will produce the following output:\n\n```\nF\ntest_check failed:\n\treadme_sample.c:4: 5 == 7\n\n\n1 tests, 1 assertions, 1 failures\n\nFinished in 0.00032524 seconds (real) 0.00017998 seconds (proc)\n```\n\nCheck out `minunit_example.c` to see a complete example. Compile with something\nlike:\n\n```\ngcc minunit_example.c -lrt -lm -o minunit_example\n```\n\nDon't forget to add `-lrt` for the timer and `-lm` for linking the function `fabs`\nused in `mu_assert_double_eq`.\n\n## Setup and teardown functions\n\nOne can define setup and teardown functions and configure the test suite to run\nthem by using the macro `MU_SUITE_CONFIGURE` with within a `MU_TEST_SUITE`\ndeclaration.\n\n## Assertion types\n\n`mu_check(condition)`: will pass if the condition is evaluated to `true`, otherwise\nit will show the condition as the error message\n\n`mu_fail(message)`: will fail and show the message\n\n`mu_assert(condition, message)`: will pass if the condition is `true`, otherwise it\nwill show the failed condition and the message\n\n`mu_assert_int_eq(expected, result)`: it will pass if the two numbers are\nequal or show their values as the error message\n\n`mu_assert_double_eq(expected, result)`: it will pass if the two values\nare almost equal or show their values as the error message. The value of\n`MINUNIT_EPSILON` sets the threshold to determine if the values are close enough.\n\n`mu_assert_string_eq(expected, resurt):` it will pass if the two strings are equal.\n\n## Authors\n\nDavid Siñuela Pastor \u003csiu.4coders@gmail.com\u003e\n","funding_links":[],"categories":["Debug","C","Testing ##"],"sub_categories":["Web Frameworks ###"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiu%2Fminunit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiu%2Fminunit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiu%2Fminunit/lists"}