{"id":21084489,"url":"https://github.com/sorgom/cpputeststeps","last_synced_at":"2025-03-14T05:12:20.485Z","repository":{"id":204332233,"uuid":"711589180","full_name":"sorgom/CppUTestSteps","owner":"sorgom","description":"CppUTest Enhancement Test Steps","archived":false,"fork":false,"pushed_at":"2025-02-10T10:18:02.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-02-10T11:27:58.946Z","etag":null,"topics":["c-plus-plus","cad-ul","cadul","cpp20","cpp98","cpputest","gcc","msbuild","steps","test-steps"],"latest_commit_sha":null,"homepage":"","language":"C++","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/sorgom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-10-29T18:12:12.000Z","updated_at":"2025-01-16T15:53:00.000Z","dependencies_parsed_at":"2024-04-24T09:49:41.961Z","dependency_job_id":"aa68307f-8f9c-4f69-a427-d0da34156a5c","html_url":"https://github.com/sorgom/CppUTestSteps","commit_stats":null,"previous_names":["sorgom/cpputeststepper"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sorgom%2FCppUTestSteps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sorgom%2FCppUTestSteps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sorgom%2FCppUTestSteps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sorgom%2FCppUTestSteps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sorgom","download_url":"https://codeload.github.com/sorgom/CppUTestSteps/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243526953,"owners_count":20305115,"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-plus-plus","cad-ul","cadul","cpp20","cpp98","cpputest","gcc","msbuild","steps","test-steps"],"created_at":"2024-11-19T20:25:10.083Z","updated_at":"2025-03-14T05:12:20.456Z","avatar_url":"https://github.com/sorgom.png","language":"C++","readme":"# Test Steps for #CppUTest\n\n#CppUTest\n\nThe test steps solve a great disadvantage of CppUTest:\n\nWhen CppUTest exits a test due to an unmatched expectation it only provides\n- the test name\n- the source line of the test's begin\n\nSo if you have a test with some amount of lines\nyou will have a hard time to figure out\nwhere exactly the mismatch happens.\n\nUsing TestSteps's STEP() macro\nwill provide you with line of the last STEP() macro placed.\n\nThe STEP() macro also helps\nto give your tests a more readable structure.\n\n## test samples\n\n### simple test code\n```cpp\n01  #include \u003cCppUTestExt/MockSupport.h\u003e\n02  #include \u003cTestSteps/TestSteps.h\u003e\n03\n04  TEST_GROUP(TSTS_01) {};\n05\n06  //  failure in STEP(2)\n07  TEST(TSTS_01, T01)\n08  {\n09      STEP(1)\n10      mock().expectOneCall(\"somecall\").withParameter(\"value\", 42);\n11      mock().actualCall(\"somecall\").withParameter(\"value\", 42);   \n12      mock().checkExpectations(); mock().clear();\n13\n14      STEP(2)\n15      mock().expectOneCall(\"somecall\").withParameter(\"value\", 42);\n16      mock().actualCall(\"somecall\").withParameter(\"value\", 43);   \n17      mock().checkExpectations(); mock().clear();\n18  }\n19\n20  //  failure in STEP(2.6)\n21  TEST(TSTS_01, T02)\n22  {\n23      STEP(1)\n24      L_CHECK_EQUAL(2, 2)\n25\n26      STEP(2)\n27      SUBSTEPS()\n28      for (unsigned n = 0; n \u003c 10; ++n)\n29      {\n30          LSTEP(n)\n31          L_CHECK_TRUE(n \u003c 5)\n32      }\n33      ENDSTEPS()\n34  }\n35\n```\n### test ouput\n```shell\n$ bin/tests -b -v\nTEST(TSTS_01, T01)\n../samples/TSTS_01.cpp:14: error: Failure in TEST(TSTS_01, T01)\n        Mock Failure: Unexpected parameter value to parameter \"value\" to function \"somecall\": \u003c43 (0x2b)\u003e\n        EXPECTED calls that WERE NOT fulfilled related to function: somecall\n                somecall -\u003e int value: \u003c42 (0x2a)\u003e (expected 1 call, called 0 times)\n        EXPECTED calls that WERE fulfilled related to function: somecall\n                \u003cnone\u003e\n        ACTUAL unexpected parameter passed to function: somecall\n                int value: \u003c43 (0x2b)\u003e\n\nSTEP(2)\nfile: ../samples/TSTS_01.cpp\nfunc: testBody\nline: 14\n\nTEST(TSTS_01, T02)\n../samples/TSTS_01.cpp:31: error: Failure in TEST(TSTS_01, T02)\n        expected \u003ctrue\u003e\n        but was  \u003cfalse\u003e\n        difference starts at position 0 at: \u003c          false     \u003e\n                                                       ^\n\nSTEP(2.6)\n\nSTEP(2)\nfile: ../samples/TSTS_01.cpp\nfunc: testBody\nline: 26\n\nSTEP(6)\nfile: ../samples/TSTS_01.cpp\nfunc: testBody\nline: 31\n```\n\n### test code calling subroutine\n```cpp\n01  #include \u003cCppUTestExt/MockSupport.h\u003e\n02  #include \u003cTestSteps/TestSteps.h\u003e\n03\n04  TEST_GROUP(TSTS_02)\n05  {\n06      void check010(const int i)\n07      {\n08          SUBSTEPS()\n09          STEP(1)\n10          L_CHECK_TRUE(i \u003e= 0)\n11          STEP(2)\n12          L_CHECK_TRUE(i \u003c= 10)\n13          ENDSTEPS()\n14      }\n15  };\n16\n17  //  failure in STEP(2.1)\n18  TEST(TSTS_02, T01)\n19  {\n20      STEP(1)\n21      check010(1);\n22\n23      STEP(2)\n24      check010(-1);\n25  }\n26\n27  //  failure in STEP(2.12.2)\n28  TEST(TSTS_02, T02)\n29  {\n30      STEP(1)\n31      SUBSTEPS()\n32      for (int i = 0; i \u003c 20; ++i)\n33      {\n34          LSTEP(i)\n35          check010(i);\n36      }\n37      ENDSTEPS()\n38  }\n39\n```\n### test ouput\n```shell\n$ bin/tests -b -v\nTEST(TSTS_02, T01)\n../samples/TSTS_02.cpp:10: error: Failure in TEST(TSTS_02, T01)\n        expected \u003ctrue\u003e\n        but was  \u003cfalse\u003e\n        difference starts at position 0 at: \u003c          false     \u003e\n                                                       ^\n\nSTEP(2.1)\n\nSTEP(2)\nfile: ../samples/TSTS_02.cpp\nfunc: testBody\nline: 23\n\nSTEP(1)\nfile: ../samples/TSTS_02.cpp\nfunc: check010\nline: 10\n\nTEST(TSTS_02, T02)\n../samples/TSTS_02.cpp:12: error: Failure in TEST(TSTS_02, T02)\n        expected \u003ctrue\u003e\n        but was  \u003cfalse\u003e\n        difference starts at position 0 at: \u003c          false     \u003e\n                                                       ^\n\nSTEP(1.12.2)\n\nSTEP(1)\nfile: ../samples/TSTS_02.cpp\nfunc: testBody\nline: 30\n\nSTEP(12)\nfile: ../samples/TSTS_02.cpp\nfunc: testBody\nline: 34\n\nSTEP(2)\nfile: ../samples/TSTS_02.cpp\nfunc: check010\nline: 12\n```\n\n## sample of main\n\n```cpp\n#include \u003cTestSteps/TestStepsPlugin.h\u003e\n#include \u003cCppUTest/CommandLineTestRunner.h\u003e\n\nint main(const int argc, const char* const* const argv)\n{\n    TestStepsPlugin::setup();\n    return CommandLineTestRunner::RunAllTests(argc, argv);\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsorgom%2Fcpputeststeps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsorgom%2Fcpputeststeps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsorgom%2Fcpputeststeps/lists"}