{"id":16586154,"url":"https://github.com/conni2461/examiner","last_synced_at":"2025-10-29T08:32:12.503Z","repository":{"id":104985500,"uuid":"379931949","full_name":"Conni2461/examiner","owner":"Conni2461","description":"A small, opinionated c unit testing framework","archived":false,"fork":false,"pushed_at":"2023-06-07T07:07:45.000Z","size":77,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-01T23:51:07.300Z","etag":null,"topics":["c","unit-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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Conni2461.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":"2021-06-24T13:21:10.000Z","updated_at":"2024-10-20T11:09:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"1a9bd065-682c-4bfa-9209-b98653fd807b","html_url":"https://github.com/Conni2461/examiner","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Conni2461%2Fexaminer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Conni2461%2Fexaminer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Conni2461%2Fexaminer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Conni2461%2Fexaminer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Conni2461","download_url":"https://codeload.github.com/Conni2461/examiner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238795350,"owners_count":19531722,"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","unit-testing-framework"],"created_at":"2024-10-11T22:50:43.642Z","updated_at":"2025-10-29T08:32:07.082Z","avatar_url":"https://github.com/Conni2461.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# examiner\n\nA small, opinionated c unit testing framework.\n\n## Features\n\n- Autoregister tests\n- `ASSERT_EQ` and `ASSERT_NE` macros that dispatches a compare to the\nappropriated type\n- `BEFORE_EACH` and `AFTER_EACH` to register functions that run before and/or\nafter a scope\n- `PENDING` to tell examiner that a test should not run\n- colored output support\n- time how long it took to run a test\n- multiple files just work. Define one `main.c` file and n test files and build\none executable. It should execute all tests without additional setup or header\nfiles. See makefile and `test` directory for an example\n- parsing argc argv for parameter options\n  - filter for test with `--filter pattern`, possible to only filter for a scope\n  thanks to prefix matching. Multiple `--filter` will act like an or, so only\n  one filter needs to match in order to get a test to execute.\n  - list all tests with `--list-tests`\n  - short output with `--short`\n  - shuffle test order with `--shuffle`\n  - repeat test with `--repeat n`\n  - die on fail with `--die-on-fail`\n  - disable colors with `--color off`\n\n![preview](https://i.imgur.com/9vcLkOp.png)\n\n## Build\n\n```bash\nmake                # set optimazation with TYPE=, example: TYPE=-Og. Default is: `-O2`\nsudo make install   # to install it\nsudo make uninstall # to remove it again\n```\n\n## Documentation\n\n```c\n#include \"examiner.h\"\n\n/** Define a new test with a scope and a name. The resulting test name will then\n *  always be: scope + \".\" + name\n *  This name can be used to filter on command line later, and only run specific\n *  tests.\n */\nTEST(math, test_int) {\n  /** ASSERT_EQ and ASSERT_NE are two macros that will dispatch based on the\n   *  type to internal comparator functions. It dispatches\n   *  `int32_t`, `uint32_t`,\n   *  `long int`, `unsigned long int`,\n   *  `long long`, `unsigned long long`,\n   *  `float`, `double`,\n   *  `char`, `char *`\n   */\n  ASSERT_EQ(1, 1);\n  ASSERT_NE(1, 2);\n}\n\n/**\n * You can define BEFORE_EACH and AFTER_EACH for each scope (even after a test\n * definition). Before each and after each will run before and after each test\n * in the \"math\" scope (for this example)\n */\nBEFORE_EACH(math) {\n  printf(\"Before math POG\\n\");\n}\n\nAFTER_EACH(math) {\n  printf(\"After math POG\\n\");\n}\n\nTEST(str, test) {\n  ASSERT_EQ(\"test\", \"test\");\n  ASSERT_NE(\"test\", \"nest\");\n}\n\n/**\n * PENDING means that the feature the test is testing is probably not\n * implemented yet so the test will not be executed.\n */\nPENDING(pending, should_fail) {\n  ASSERT_EQ(\"a\", \"b\");\n}\n\n/**\n * Also awailable are:\n * ASSERT_EQ_MEM\n * ASSERT_NE_MEM\n * ASSERT_TRUE\n * ASSERT_FALSE\n */\n\n/** You HAVE to pass argc and argv to init. It is needed to parse `--filter` and\n *  more.\n */\nint main(int argc, char **argv) {\n  exam_init(argc, argv);\n  return exam_run();\n}\n```\n\nBuild and like your source code against `examiner`\n\n```bash\ncc test_file.c -o test -lexaminer\n```\n\nIf you get\n```\n./test: error while loading shared libraries: libexaminer.so: cannot open shared object file: No such file or directory\n```\nthen your `LD_LIBRARY_PATH` is probably missing `/usr/local/bin`\n```bash\nLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib ./test\n\n# To see help page run\nLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib ./test --help\n\n# To filter for a test\n# The first will run all tests under the math scope.\n# The second will run all tests that start with math.test_int (probably just one)\nLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib ./test --filter math\nLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib ./test --filter math.test_int\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconni2461%2Fexaminer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconni2461%2Fexaminer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconni2461%2Fexaminer/lists"}