{"id":15497257,"url":"https://github.com/jwerle/libok","last_synced_at":"2025-06-24T07:39:42.736Z","repository":{"id":13521560,"uuid":"16212742","full_name":"jwerle/libok","owner":"jwerle","description":"Super tiny tap output library","archived":false,"fork":false,"pushed_at":"2023-10-13T22:08:42.000Z","size":41,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T19:34:30.828Z","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":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jwerle.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":"2014-01-24T18:19:38.000Z","updated_at":"2023-10-13T13:18:35.000Z","dependencies_parsed_at":"2025-01-07T15:11:52.208Z","dependency_job_id":"d1bcda1e-a2d6-44f9-a5a8-c7f2792770e1","html_url":"https://github.com/jwerle/libok","commit_stats":{"total_commits":43,"total_committers":1,"mean_commits":43.0,"dds":0.0,"last_synced_commit":"bab995a8fc381937b53492e618910a1ec463a021"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Flibok","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Flibok/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Flibok/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwerle%2Flibok/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwerle","download_url":"https://codeload.github.com/jwerle/libok/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250334171,"owners_count":21413522,"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-02T08:32:20.548Z","updated_at":"2025-04-22T22:33:55.521Z","avatar_url":"https://github.com/jwerle.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"libok\n=====\n\nSuper tiny tap output library\n\n## install\n\n**clib:**\n\n```sh\n$ clib install jwerle/libok\n```\n\n**source:**\n\n```sh\n$ git clone https://github.com/jwerle/libok.git\n$ cd libok\n$ make\n$ make install\n```\n\n## usage\n\n```c\nok_expect(1);\nok(\"my feature works\");\nok_done();\n```\n\n## api\n\n```c\n/**\n * libok version\n */\n#ifndef OK_VERSION\n#define OK_VERSION \"0.6.5\"\n#endif\n\n/**\n * No-op/void `ok()` function\n */\n#ifndef okx\n#define okx(...) (void) (0);\n#endif\n\n/**\n * Allow for custom `printf` implementation.\n */\n#if !defined(LIBOK_PRINTF)\n#define LIBOK_PRINTF(...) (printf(__VA_ARGS__))\n#endif\n\n/**\n * Allow for custom `fprintf` implementation.\n */\n#if !defined(LIBOK_FPRINTF)\n#define LIBOK_FPRINTF(...) (fprintf(__VA_ARGS__))\n#endif\n\n/**\n * Configure the need for a newline ('\\n') in a `printf` call.\n */\n#if !defined(LIBOK_PRINTF_NEEDS_NEWLINE)\n#define LIBOK_PRINTF_NEEDS_NEWLINE 1\n#endif\n\n/**\n * Configure the need for a newline ('\\n') in a `fprintf` call.\n */\n#if !defined(LIBOK_FPRINTF_NEEDS_NEWLINE)\n#define LIBOK_FPRINTF_NEEDS_NEWLINE LIBOK_PRINTF_NEEDS_NEWLINE\n#endif\n\n/**\n * Increments ok count and\n * outputs a message to stdout\n */\n#define ok(format, ...) ({                                                     \\\n  if (ok_count() == 0 \u0026\u0026 ok_failed() == 0) ok_begin(NULL);                     \\\n  int count = ok_count_inc() + ok_failed();                                    \\\n  LIBOK_PRINTF(\"ok %d - \" format, count, ##__VA_ARGS__);                       \\\n  if (LIBOK_PRINTF_NEEDS_NEWLINE) {                                            \\\n    LIBOK_PRINTF(\"\\n\");                                                        \\\n  }                                                                            \\\n})\n\n/**\n * Outputs a a \"not ok\"  message to stdout.\n * Increments not ok count.\n */\n#define notok(format, ...) ({                                                  \\\n  if (ok_count() == 0 \u0026\u0026 ok_failed() == 0) ok_begin(NULL);                     \\\n  int count = ok_count() + ok_failed_inc();                                    \\\n  LIBOK_PRINTF(\"not ok %d - \" format, count, ##__VA_ARGS__);                   \\\n                                                                               \\\n  if (LIBOK_PRINTF_NEEDS_NEWLINE) {                                            \\\n    LIBOK_PRINTF(\"\\n\");                                                        \\\n  }                                                                            \\\n                                                                               \\\n  LIBOK_PRINTF(\"   ---\");                                                      \\\n  if (LIBOK_PRINTF_NEEDS_NEWLINE) {                                            \\\n    LIBOK_PRINTF(\"\\n\");                                                        \\\n  }                                                                            \\\n                                                                               \\\n  LIBOK_PRINTF(\"   severity: fail\");                                           \\\n  if (LIBOK_PRINTF_NEEDS_NEWLINE) {                                            \\\n    LIBOK_PRINTF(\"\\n\");                                                        \\\n  }                                                                            \\\n                                                                               \\\n  LIBOK_PRINTF(\"   stack:    |-\");                                             \\\n  if (LIBOK_PRINTF_NEEDS_NEWLINE) {                                            \\\n    LIBOK_PRINTF(\"\\n\");                                                        \\\n  }                                                                            \\\n                                                                               \\\n  LIBOK_PRINTF(\"          at %s (%s:%d)\",                                      \\\n    __FUNCTION__,                                                              \\\n    __FILE__,                                                                  \\\n    __LINE__                                                                   \\\n  );                                                                           \\\n  if (LIBOK_PRINTF_NEEDS_NEWLINE) {                                            \\\n    LIBOK_PRINTF(\"\\n\");                                                        \\\n  }                                                                            \\\n                                                                               \\\n  LIBOK_PRINTF(\"   ...\");                                                      \\\n  if (LIBOK_PRINTF_NEEDS_NEWLINE) {                                            \\\n    LIBOK_PRINTF(\"\\n\");                                                        \\\n  }                                                                            \\\n})\n\n/**\n * Called at the beginning of a test with an optional (NULL) label.\n */\nvoid ok_begin (const char *label);\n\n/**\n * Can be used to printf a comment.\n */\nvoid ok_comment (const char *comment);\n\n/**\n * Can be used to provide a multiline test explaination.\n */\nvoid ok_explain (const char *explaination);\n\n/**\n * Can be used to issue an emergency \"Bail out!\" statement with an\n * optional comment.\n */\nvoid ok_bail (const char *comment);\n\n/**\n * Completes tests and asserts that\n * the expected test count matches the\n * actual test count if the expected\n * count is greater than 0\n */\nbool ok_done (void);\n\n/**\n * Sets the expectation count\n */\nvoid ok_expect (int);\n\n/**\n * Returns the expected count\n */\nint ok_expected (void);\n\n/**\n * Returns the ok count\n */\nint ok_count (void);\nint ok_count_inc (void);\n\n/**\n * Returns the not ok count\n */\nint ok_failed (void);\nint ok_failed_inc (void);\n\n/**\n * Resets count and expected counters\n */\nvoid ok_reset (void);\n```\n\n## license\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwerle%2Flibok","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwerle%2Flibok","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwerle%2Flibok/lists"}