{"id":15049378,"url":"https://github.com/thstrauss/acutest","last_synced_at":"2026-01-18T22:33:17.338Z","repository":{"id":238207395,"uuid":"736428581","full_name":"thstrauss/acuTest","owner":"thstrauss","description":"Test framework which just uses c89.","archived":false,"fork":false,"pushed_at":"2025-04-02T16:51:10.000Z","size":1683,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T17:40:10.246Z","etag":null,"topics":["atari-st","c89","purec"],"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/thstrauss.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":"2023-12-27T22:08:13.000Z","updated_at":"2025-04-02T16:51:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"38d63543-c210-4f34-a894-735deccc9902","html_url":"https://github.com/thstrauss/acuTest","commit_stats":null,"previous_names":["thstrauss/acutest"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thstrauss%2FacuTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thstrauss%2FacuTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thstrauss%2FacuTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thstrauss%2FacuTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thstrauss","download_url":"https://codeload.github.com/thstrauss/acuTest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284918,"owners_count":20913691,"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":["atari-st","c89","purec"],"created_at":"2024-09-24T21:20:01.654Z","updated_at":"2026-01-18T22:33:17.328Z","avatar_url":"https://github.com/thstrauss.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# acu_Test \n\nacu_Test (Atari C Unit Test) is a C89 compliant c unit test framework. The library and unit tests are compiling \non Atari ST with PureC and on Windows with Visual Studio. \n\n## Plug-ins\n\nThe framework allows to implement test plug-ins which are the executed by a generic runner.\n\n### Windows\n\n### Plug-in Implementation\n\nPlease implement a function like this with name `acu_entr.c`:\n\n```C\nACU_Entry* acu_init() {\n    ACU_Fixture* fixture = acu_fixtureMalloc();\n    ACU_Entry* entry = acu_entryMalloc();\n    acu_entryInit(entry, fixture);\n\n...\n    /* Please add test fixtures to suites. */\n...\n\n    return entry;\n}\n```\n\nBuild a dll like `example.dll`\n\n## Start Generic Runner\n\n```cmd\ncurunner example.dll\n```\n\nThe runner starts and execute the given dll. Output is going to the console. The `curunner` return `0` on success and `2` when any test fails.\n\n### Atari TOS\n\nFor plain TOS we don't have a concept of shared libraries. Something similar is done with CPX modules. \nI reimplemented the loading of CPX-modules.\n\n#### TOS Plug-in Implementation\n\nThe PureC project file shall look like this:\n\n```\ncutscup.cup\n\n.C [ -I..\\acu_test ]\n.C [ -I..\\acu_util ]\n.C [ -P ]\n.L [ -Y ]\n\n=\n\n..\\acu_test\\plgstart.s\n\nacu_entr.c (..\\acu_test\\acu_ldr.h)\nchar_tst.c (char_tst.h, tst_bed.h)\n\n..\\acu_util\\acu_util.prj\n..\\acu_test\\acu_test.prj\n\nPCFLTLIB.LIB\nPCSTDLIB.LIB\nPCTOSLIB.LIB\nPCEXTLIB.LIB\n```\n\nThe of `acu_entr.c` is the same as for the windows plug-in.\n\nThe linker creates an executable with the start code `plgstart.s`. The start code is executed when \nthe plug-in is loaded by `curunner.ttp`.\n\n#### Start Generic TOS Runner\n\n```cmd\ncurunner cutscup.cup\n```\n\nThe runner starts and execute the given plug-in. Output is going to the console. The `curunner` return `0` on success and `2` when any test fails.\n\n#### Start Generic GEM-Runner\n\nThere is a GEM-Runner `gemrunnr.prg` implemented. In the moment it just have a load and execute item. More to come.\n\n## Demo\n\n### Test Cases\nTest cases are just C functions. They have to follow the signature: `void simpleTestCase(ACU_ExecuteEnv* environment, const void* context)`.\nThe parameter `environment` is used by the framework to provide some information which is needed for result collection by the assert functions.\nThe `context` allows to pass in fixture common data.\n\n### Asserts\n\nThe asserts are defined as macros which allows to capture file and line number. For **simple** types the main entry\nis `ACU_assert`.\n\n### Fixtures\n\nA Fixture's is aggregating test cases. The test cases are just added by providing a function pointer to the test case.\n\n### Suites\n\nA Fixture's can aggregate fixtures on the next level. On higher level you typically execute the test \ncases with `result = acu_fixtureExecute(suite, acu_progress, NULL)`.\n\n```C\n#include \u003cstdlib.h\u003e\n\n#include \u003cacu_eenv.h\u003e\n#include \u003cacu_asrt.h\u003e\n#include \u003cacu_fxtr.h\u003e\n#include \u003cacu_tryc.h\u003e\n\nstatic void simpleTestCase(ACU_ExecuteEnv* environment, const void* context) {\n    ACU_assert(environment, int, Equal, 0, 42, \"number not equal to 42\");\n    UNUSED(context);\n}\n\nACU_Fixture* sampleFixture(void)\n{\n    ACU_Fixture* fixture = acu_fixtureMalloc();\n    acu_fixtureInit(fixture, \"sample tests\");\n    acu_fixtureAddTestCase(fixture, \"simpleTestCase\", simpleTestCase);\n    return fixture;\n}\n\nint main()\n{\n    ACU_Fixture* fixture = acu_fixtureMalloc();\n    ACU_ReportHelper reportHelper = {NULL, NULL};\n    ACU_ReportVisitor report = { acu_report, NULL };\n    ACU_Progress progress = { acu_progress , NULL };\n    enum ACU_TestResult result;\n    report.context = \u0026reportHelper;\n\n    acu_fixtureInit(fixture, \"Sample test suite\");\n    acu_fixtureAddChildFixture(fixture, sampleFixture());\n\n    result = acu_fixtureExecute(fixture, \u0026progress);\n\n    acu_fixtureAccept(fixture, \u0026report);\n\n    acu_fixtureDestroy(fixture);\n    return result != ACU_TEST_PASSED ? 2 : 0;\n}\n``` \n## Design Considerations\n\nThe Atari PureC compiler has a limitation of 4096 characters for macro expansion. To work around this\nan hybrid approach with macro based code generation at compile time to generate the assert functions and \nmacro's which are part of the runtime was taken. It acts somehow like templates in C++.\n\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthstrauss%2Facutest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthstrauss%2Facutest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthstrauss%2Facutest/lists"}