{"id":19045732,"url":"https://github.com/bigwhite/lcut","last_synced_at":"2025-04-24T00:20:37.528Z","repository":{"id":7779102,"uuid":"9148740","full_name":"bigwhite/lcut","owner":"bigwhite","description":"a Lightweight C Unit Testing framework","archived":false,"fork":false,"pushed_at":"2018-04-13T03:00:17.000Z","size":496,"stargazers_count":24,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T08:39:40.996Z","etag":null,"topics":["c","lcut","programmer"],"latest_commit_sha":null,"homepage":null,"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/bigwhite.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-01T14:34:16.000Z","updated_at":"2025-02-08T23:08:03.000Z","dependencies_parsed_at":"2022-09-13T15:24:16.865Z","dependency_job_id":null,"html_url":"https://github.com/bigwhite/lcut","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigwhite%2Flcut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigwhite%2Flcut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigwhite%2Flcut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigwhite%2Flcut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigwhite","download_url":"https://codeload.github.com/bigwhite/lcut/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250535996,"owners_count":21446653,"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","lcut","programmer"],"created_at":"2024-11-08T22:51:15.444Z","updated_at":"2025-04-24T00:20:37.463Z","avatar_url":"https://github.com/bigwhite.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"LCUT - Lightweight C Unit Test Framework\n========================================\n\nRecent News\n-----------\n\n - 2013-04-02 fork a copy to https://github.com/bigwhite/lcut.git.\n - 2012-04-13 lcut 0.3.0 Released!\n - 2012-04-10 lcut 0.3.0-rc1 published!\n   - add LCUT_ARG_RETURN_COUNT and LCUT_RETV_RETURN_COUNT macros.\n - 2010-12-16 lcut 0.2.0 Released!\n - 2010-10-29 lcut 0.2.0-beta1 published!\n   - add mock support\n - 2010-09-30 The first verison of lcut - LCUT 0.1.0 Released.\n\nMotivation\n----------\n\nIn late 2005，the \"TDD\" concept was so popular and there were many strong and mature unit testing framework available \nfor Java programmers, C# programmers and even python programmers, But there were few for C programmers. I have googled \nsome c unit testing framework and gave me a shot, but eventually none of them made me comfortable. so I decided \nto implement a new one for my daily work and then lcut born.\n\nIntroduction\n------------\n\nlcut is short for \"Lightweight C Unit Test framework\". lightweight means it is very small and easy to learn\u0026use. \nThe framework is inspired by the well-known JUnit which is invented by Kent Beck.The structure of lcut could be \nillustrated as below:\n\n    A logical Test\n          |  \n          |  \n      +-------------+\n      TS-1    ...  TS-N\n      |             |  \n      |             |  \n    +-------+ ... +--------+\n    TC-1 TC-N TC-1 TC-N\n    \n    TS - Test Suite，TC - Test Case\n\nA unit test using lcut is divided into three levels: logical test, test suite and test case. A logical test contains \nseveral test suites and each test suite also contains several test cases. test case is the most basic and the smallest\nunit in this framework. And the three-level concept is helpful for you to organize your unit testing well.\n\nFeature list\n------------\n\n - small and easy to learn\u0026use\n - inspired by xUnit\n - three-level concepts to help organizing your test well and each level could have independent setup and teardown\n   fixtures\n - provide mock support (inspired by cmockery)\n\nFor more information, please open and read the lcut project wiki. lcut_user_guide and its Chinese version are ready \nfor you.\n\nA Typical Example\n-------\n    /* calculator_test.c */\n    #include \"lcut.h\"\n\n    extern int add(int a, int b);\n    extern int subtract(int a, int b);\n    extern int multiply(int a, int b);\n    extern int divide(int a, int b);\n\n    void tc_add(lcut_tc_t *tc, void *data) {\n        LCUT_INT_EQUAL(tc, 10, add(2, 8));\n        LCUT_INT_EQUAL(tc, -6, add(2, -8));\n        LCUT_INT_EQUAL(tc, 0, add(2, -2));\n        LCUT_INT_NEQUAL(tc, 1, add(2, -2));\n\n        LCUT_TRUE(tc, 0 == add(2, -2));\n        LCUT_ASSERT(tc, \"2 + (-2) should equal to 0\", 0 == add(2, -2));\n    }\n\n    void tc_subtract(lcut_tc_t *tc, void *data) {\n        LCUT_INT_EQUAL(tc, 6, subtract(8, 2));\n        LCUT_INT_EQUAL(tc, 10, subtract(2, -8));\n        LCUT_INT_EQUAL(tc, 0, subtract(2, 2));\n    }\n\n    void tc_multiply(lcut_tc_t *tc, void *data) {\n        LCUT_INT_EQUAL(tc, 16, multiply(8, 2));\n        LCUT_INT_EQUAL(tc, -16, multiply(2, -8));\n        LCUT_INT_EQUAL(tc, 0, multiply(0, 2));\n    }\n\n    void tc_divide(lcut_tc_t *tc, void *data) {\n        LCUT_INT_EQUAL(tc, 4, divide(8, 2));\n        LCUT_INT_EQUAL(tc, 0, divide(0, 8));\n        LCUT_INT_EQUAL(tc, 1, divide(2, 2));\n    }\n\n    int main() {\n        lcut_ts_t   *suite = NULL;\n        LCUT_TEST_BEGIN(\"a simple calculator test\", NULL, NULL);\n\n        LCUT_TS_INIT(suite, \"a simple calculator unit test suite\", NULL, NULL);\n        LCUT_TC_ADD(suite, \"add test case\", tc_add, NULL, NULL, NULL);\n        LCUT_TC_ADD(suite, \"subtract test case\", tc_subtract, NULL, NULL, NULL);\n        LCUT_TC_ADD(suite, \"multiply test case\", tc_multiply, NULL, NULL, NULL);\n        LCUT_TC_ADD(suite, \"divide test case\", tc_divide, NULL, NULL, NULL);\n        LCUT_TS_ADD(suite);\n\n        LCUT_TEST_RUN();\n        LCUT_TEST_REPORT();\n        LCUT_TEST_END();\n\n        LCUT_TEST_RESULT();\n    }\n\nThe result of the example could be:\n\n    *********************************************************\n         LCUT -- Lightweight C Unit Testing framework\n \t\t                By Tony Bai\n    ********************************************************* \n    Unit Test for 'a simple calculator test':\n\n\t   Suite \u003ca simple calculator unit test suite\u003e: \n\t\t    Case 'add test case': Passed\n\t\t    Case 'subtract test case': Passed\n\t\t    Case 'multiply test case': Passed\n\t\t    Case 'divide test case': Passed\n\n    Summary: \n\t    Total Suites: 1 \n\t    Failed Suites: 0 \n\t    Total Cases: 4 \n\t    Failed Cases: 0 \n\n    ==========================\n\t       GREEN BAR!\n    ==========================\n\nBuild\n------\n - Download the source code package\n - unzip the package\n - configure-\u003emake-\u003emake install\n \nif you want to compile in 64-bit mode, pass \"CPPFLAGS=-m64 LDFLAGS=-m64\" to configure.\nsometimes, you may encounter such error:\n\n\tmv: cannot stat `.deps/lcut.Tpo': No such file or directory\n\tmake[1]: *** [lcut.lo] Error 1\n\t\na solution for this is execute \"libtoolize -f\" before \"configure\".\n\nUser Guide\n-------------\nFor more information, please open and read the [lcut_user_guide](https://github.com/bigwhite/lcut/wiki/lcut-user-guide).And Chinese version is [here](https://github.com/bigwhite/lcut/wiki/lcut%E7%94%A8%E6%88%B7%E6%8C%87%E5%8D%97).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigwhite%2Flcut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigwhite%2Flcut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigwhite%2Flcut/lists"}