{"id":62074,"library":"cmocka","title":"cmocka","description":"An elegant unit testing framework for C with support for mock objects.","status":"active","version":"2.0.2","language":"cpp","source_language":null,"source_url":null,"tags":["testing","unit-test","mock","c"],"install":[{"cmd":"vcpkg install cmocka","lang":"bash","label":"vcpkg"},{"cmd":"# CMakeLists.txt\nfind_package(cmocka CONFIG REQUIRED)\ntarget_link_libraries(main PRIVATE cmocka::cmocka)","lang":"cmake","label":"CMake"}],"dependencies":[],"imports":[{"symbol":"cmocka.h","correct":"#include <cmocka.h>"}],"quickstart":{"code":"#include <stdarg.h>\n#include <stddef.h>\n#include <setjmp.h>\n#include <cmocka.h>\n\nstatic void test_null(void **state) {\n    (void) state;\n    assert_null(NULL);\n}\n\nint main() {\n    const struct CMUnitTest tests[] = {\n        cmocka_unit_test(test_null),\n    };\n    return cmocka_run_group_tests(tests, NULL, NULL);\n}","lang":"cpp","description":"Simple test that checks NULL is null."},"warnings":[{"fix":"Ensure target_link_libraries includes cmocka::cmocka.","message":"cmocka requires linking with the library; it is not header-only.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'c':8,19 'cmocka':1 'eleg':3 'framework':6 'mock':12,18 'object':13 'support':10 'test':5,14,17 'unit':4,16 'unit-test':15","created_at":"2026-06-17T05:16:03.871413+00:00","updated_at":"2026-06-17T05:16:03.871413+00:00","problems":[],"ecosystem":"vcpkg","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-12-14","install_tag":null}}