{"id":23613856,"url":"https://github.com/clement-muth/criterion-unit-test-c","last_synced_at":"2026-05-19T19:03:11.880Z","repository":{"id":169854613,"uuid":"340923892","full_name":"Clement-Muth/criterion-unit-test-c","owner":"Clement-Muth","description":"Some example of criterion unit tests","archived":false,"fork":false,"pushed_at":"2021-02-21T19:22:00.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-18T05:32:53.150Z","etag":null,"topics":["c","criterion","test-unitaire","unit-test"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/Clement-Muth.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-21T14:41:40.000Z","updated_at":"2023-01-24T19:46:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"a8030cb9-3759-45d5-86ae-c7bffca2322d","html_url":"https://github.com/Clement-Muth/criterion-unit-test-c","commit_stats":null,"previous_names":["clement-muth/criterion-unit-test-c"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Clement-Muth/criterion-unit-test-c","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clement-Muth%2Fcriterion-unit-test-c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clement-Muth%2Fcriterion-unit-test-c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clement-Muth%2Fcriterion-unit-test-c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clement-Muth%2Fcriterion-unit-test-c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Clement-Muth","download_url":"https://codeload.github.com/Clement-Muth/criterion-unit-test-c/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clement-Muth%2Fcriterion-unit-test-c/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266420797,"owners_count":23925990,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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","criterion","test-unitaire","unit-test"],"created_at":"2024-12-27T17:29:18.672Z","updated_at":"2026-05-19T19:03:11.812Z","avatar_url":"https://github.com/Clement-Muth.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# criterion_unit_test_c\nSome example of criterion unit tests\n\n# Summary\n\n- Installation\n- Example\n\t- Rules for Makefile\n\t- Some example of unit test with criterion\n\n# Installation\n\nUse this [file](https://github.com/Clement-Muth/criterion_unit_test_c/blob/master/install_criterion.sh) to install criterion\n\n```bash\nchmod 777 install_criterion.sh\n./install_criterion.sh\n```\n\n# Example\n\n## Rules for Makefile\n\n```Make\ntests_run:\n\tgcc $(SRCS) tests/*.c -o unit_tests --coverage -lcriterion -Iincludes/\n\t- ./unit_tests\n```\n\n## Some example of unit test with criterion\n\n[Unit test](https://github.com/Clement-Muth/criterion_unit_test_c/blob/master/test_output.c) which test output of a program\n\n```c\n#include \u003ccriterion/criterion.h\u003e\n#include \u003ccriterion/redirect.h\u003e\n\nstatic void redirect_all_stdout(void)\n{\n    cr_redirect_stdout();\n    cr_redirect_stderr();\n}\n\nTest(test_output, test_output_string, .init=redirect_all_stdout)\n{\n    write(1, \"test output\\n\", 13);\n    cr_assert_stdout_eq_str(\"test output\\n\");\n}\n```\n\n[Unit test](https://github.com/Clement-Muth/criterion_unit_test_c/blob/master/test_string_compare.c) which test string output of a function\n\n```c\n#include \u003ccriterion/criterion.h\u003e\n\nTest(test_string_compare, test_string)\n{\n    char test[] = \"test string\";\n\n    cr_assert_str_eq(test, \"test string\");\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclement-muth%2Fcriterion-unit-test-c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclement-muth%2Fcriterion-unit-test-c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclement-muth%2Fcriterion-unit-test-c/lists"}