{"id":364593,"date":"2024-05-21T02:20:08","date_gmt":"2024-05-21T02:20:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=364593"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=364593","title":{"rendered":"<span>\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e unit-\u0442\u0435\u0441\u0442\u043e\u0432<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041e\u0442\u043b\u0430\u0434\u043a\u0430 \u044d\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0431\u044b \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u043c\u043d\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0438\u0441\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u0438\u0434\u0435\u043b \u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041d\u043e unit-\u0442\u0435\u0441\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043a\u0435\u0439\u0441\u043e\u0432, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0432 \u043a\u043e\u0434\u0435. \u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043d\u043e\u043c\u0443 \u0443\u0447\u0430\u0441\u0442\u043a\u0443, \u043d\u043e \u0443 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0435\u0441\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u0438\u043d\u0443\u0441 &#8212; \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0448\u0430\u043d\u0441 \u0437\u0430\u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0434\u0435\u0431\u0430\u0436\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u042f \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043a \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f unit-\u0442\u0435\u0441\u0442\u043e\u0432 \u0432\u043c\u0435\u0441\u0442\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u0438 \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u044d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442 \u201c\u043e\u0442\u043b\u0430\u0434\u043a\u0438\u201d \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u0430\u043a unit-\u0442\u0435\u0441\u0442 \u0434\u043b\u044f \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. <\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0442\u0440\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 (\u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 Microsoft Visual Studio 2022 solution). \u0414\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0434\u043b\u044f embedded \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043f\u043e\u0434 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u0443\u044e \u043f\u043b\u0430\u0442\u0443 STM32F4-Discovery, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u043e \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u043c \u041f\u041e \u0447\u0430\u0441\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0441\u043e\u0431\u043b\u044e\u0441\u0442\u0438 \u0432\u0441\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0434\u043b\u044f \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0418 \u0442\u0440\u0435\u0442\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043b\u044f .NET \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u0441\u0435 \u0442\u0440\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432 \u0441\u0435\u0431\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0421\/\u0421++. <code>UTestsForDebug_CAN<\/code>. \u0418\u043c\u0438\u0442\u0430\u0446\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u0435\u0432\u0430\u0439\u0441\u0430 \u043d\u0430 STM32F4 \u0441 \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u043f\u043e CAN \u0448\u0438\u043d\u0435. \u041f\u043e \u043b\u0435\u0433\u0435\u043d\u0434\u0435 \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0440\u0435\u0434\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u043f\u043e CAN. \u0414\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 CAN \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0432 \u0440\u0435\u0436\u0438\u043c LOOPBACK, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0432 \u043f\u0440\u0438\u0435\u043c\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u0421\/\u0421++. <code>UTestsForDebug_UART<\/code>. \u0418\u043c\u0438\u0442\u0430\u0446\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u0435\u0432\u0430\u0439\u0441\u0430 \u043d\u0430 STM32F4 \u0441 \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u043f\u043e UART \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443. \u041f\u043e \u043b\u0435\u0433\u0435\u043d\u0434\u0435 \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0440\u0435\u0434\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u043f\u043e UART. \u0412\u0432\u0438\u0434\u0443 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u201c\u044d\u0445\u0430\u201d \u0443 \u043c\u043e\u0434\u0443\u043b\u044f UART, \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u201c\u043c\u043e\u043a\u0438\u043d\u0433\u043e\u043c (Mock)\u201d \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u0440\u0438\u0435\u043c\u0430\/\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>C#. <code>UTestsForDebug_dotNET<\/code>. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u043e \u0440\u0430\u0441\u0447\u0435\u0442\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435. \u041e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c \u044d\u0442\u0443 \u0444\u043e\u0440\u043c\u0443\u043b\u0443.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432\u0441\u0435\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0435\u0441\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/viordash\/UTestsForDebug\" rel=\"noopener noreferrer nofollow\">\u0433\u0438\u0442\u0445\u0430\u0431<\/a>. Embedded \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u0435 <a href=\"https:\/\/visualgdb.com\/\" rel=\"noopener noreferrer nofollow\">VisualGDB<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c (\u0434\u043b\u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c 30 \u0434\u043d\u0435\u0432\u043d\u0443\u044e \u0442\u0440\u0438\u0430\u043b-\u0432\u0435\u0440\u0441\u0438\u044e) \u0438 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 <a href=\"https:\/\/cpputest.github.io\/\" rel=\"noopener noreferrer nofollow\">CppUTest<\/a> (\u043e\u043d \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 VisualGDB). \u0412\u044b\u0431\u043e\u0440 VisualGDB \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u0442\u0430 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e embedded \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e\u0434 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c \u0438 \u0441 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u043b\u0430\u0434\u043a\u043e\u0439 \u043d\u0430 \u201c\u0436\u0435\u043b\u0435\u0437\u0435\u201d. CppUTest \u0432\u044b\u0431\u0440\u0430\u043d \u0438\u0437-\u0437\u0430 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043c\u043e\u043a\u0438\u043d\u0433\u0430 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440\u0430 memleak-\u043e\u0432 \u0438\u0437 \u201c\u043a\u043e\u0440\u043e\u0431\u043a\u0438\u201d. \u041f\u0440\u043e\u0435\u043a\u0442 .NET \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 .NET 8.0, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a NUnit.  <\/p>\n<h2>UTestsForDebug_CAN  <\/h2>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <code>UTestsForDebug_CAN\/UTestsForDebug_CAN.sln<\/code> \u0432 Visual Studio.\u00a0<\/p>\n<blockquote>\n<p>\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u0435\u0433\u0435\u043d\u0434\u044b: \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u044c <code>communication.cpp<\/code>, \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>Comm_ProcessMessages()<\/code> \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438\u0435\u043c \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0449\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u041f\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0435 <code>cmd_VeryDifficult<\/code> \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 <code>Perform_Command_VeryDifficult<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c. \u041d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>cmd_VeryDifficult<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u043b\u0430\u0434\u043a\u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0435\u043d\u0430.  <\/p>\n<\/blockquote>\n<p>\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0443\u044e \u043e\u0442\u043b\u0430\u0434\u043a\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c unit-test \u043f\u0440\u043e\u0435\u043a\u0442\u0435 <code>UTestsForDebug_CAN_Tests<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 unit-test \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0416\u043c\u0435\u043c \u0432 Visual Studio \u043c\u0435\u043d\u044e->FILE->Add->New Project. \u0412 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u043c\u0441\u044f \u043c\u0430\u0441\u0442\u0435\u0440\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u201cEmbedded Project Wizard\u201d:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0cf\/66e\/0d2\/0cf66e0d24e180f07afd03d0967ceaea.png\" width=\"957\" height=\"307\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0cf\/66e\/0d2\/0cf66e0d24e180f07afd03d0967ceaea.png\"\/><\/figure>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <code>UTestsForDebug_CAN_Tests<\/code> \u0438 \u043f\u0443\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 <code>UTestsForDebug_CAN<\/code>.\u00a0<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Unit Test, MSBuild, CppUTest:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6b6\/1e2\/a05\/6b61e2a0564999df6bbd40cd16d1dd6a.png\" width=\"864\" height=\"446\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6b6\/1e2\/a05\/6b61e2a0564999df6bbd40cd16d1dd6a.png\"\/><\/figure>\n<p>\u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u0443\u043b\u0447\u0435\u0439\u043d ARM \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 STM32F407VG:  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8b8\/ec4\/cf8\/8b8ec4cf876c94a615dee52d04856036.png\" width=\"796\" height=\"566\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8b8\/ec4\/cf8\/8b8ec4cf876c94a615dee52d04856036.png\"\/><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Empty Project:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ca6\/1fd\/98f\/ca61fd98f06b3ce85b1e416c1b30598d.png\" width=\"875\" height=\"279\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ca6\/1fd\/98f\/ca61fd98f06b3ce85b1e416c1b30598d.png\"\/><\/figure>\n<p>\u041d\u0430 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u043b\u0430\u0434\u043a\u0438, \u0434\u043b\u044f STM32 \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e\u00a0 ST-Link:  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1b4\/048\/9b9\/1b40489b96a5292e371e9f03182e1e05.png\" width=\"875\" height=\"444\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1b4\/048\/9b9\/1b40489b96a5292e371e9f03182e1e05.png\"\/><\/figure>\n<p><em>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u0435\u0440\u0435\u043e\u0442\u043a\u0440\u044b\u0442\u044c solution, \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/em><\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438\u0437 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u042d\u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u0441\u0440\u0435\u0434 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c.  <\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u0434\u043e\u0432, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u0437 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0448\u0430\u0433\u0438:<\/p>\n<ul>\n<li>\n<p>\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <code>UTestsForDebug_CAN_Tests<\/code> \u0444\u0430\u0439\u043b:<\/p>\n<ul>\n<li>\n<p>\u00a0startup_stm32f407xx.c<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b-\u0444\u0438\u043b\u044c\u0442\u0440 \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 <code>UTestsForDebug_CAN_Tests<\/code>, \u0436\u043c\u0435\u043c \u043c\u0435\u043d\u044e->PROJECT->New Filter, \u0432\u0432\u043e\u0434\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 ProjectSources. \u041f\u0440\u0430\u0432\u044b\u043c \u043a\u043b\u0438\u043a\u043e\u043c \u043d\u0430 \u0432\u043d\u043e\u0432\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0435 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u043c \u043c\u0435\u043d\u044e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Add->Existing Item\u2026<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/71e\/8d8\/f61\/71e8d8f61843525dfa34e6c766917b4a.png\" width=\"755\" height=\"220\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/71e\/8d8\/f61\/71e8d8f61843525dfa34e6c766917b4a.png\"\/><\/figure>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u0438\u0437 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430:\u00a0<\/p>\n<ul>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/can_module.cpp<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/communication.cpp<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/Src\/stm32f4xx_hal_msp.c<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/Src\/stm32f4xx_it.c<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/Src\/system_stm32f4xx.c<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/Inc\/main.h<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/Inc\/stm32f4xx_hal_conf.h<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/Inc\/stm32f4xx_it.h<\/p>\n<\/li>\n<li>\n<p>\u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0438\u0437 \u043f\u0430\u043f\u043a\u0438 UTestsForDebug_CAN\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/STM32F4xx_HAL_Driver\/Src<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/StartupFiles\/startup_stm32f407xx.c<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u0440\u0430\u0432\u044b\u043c \u043a\u043b\u0438\u043a\u043e\u043c \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u201cVisualGDB Project Properties\u201d, \u043d\u0430 \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0435 \u0441\u043b\u0435\u0432\u0430 \u201cMSBuild settings\u201d, \u0432 \u043f\u043e\u043b\u0435 Preprocessor Macros \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u201c<code>DEBUG=1;STM32F407VG;STM32F407xx<\/code>\u201d\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0422\u0430\u043c \u0436\u0435 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0432 \u043f\u043e\u043b\u0435 Include Directories \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u201c<code>..\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/BSP\/STM32F4-Discovery;..\/UTestsForDebug_CAN\/Inc;..\/UTestsForDebug_CAN\/Src;..\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/CMSIS_HAL\/Device\/ST\/STM32F4xx\/Include;..\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/CMSIS_HAL\/Include;..\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/STM32F4xx_HAL_Driver\/Inc<\/code>\u201d.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043f\u043e\u043b\u0435 Linker Script \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u0444\u0430\u0439\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043b\u0438\u043d\u043a\u0435\u0440\u0430\u00a0 \u201c<code>..\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/LinkerScripts\/STM32F407VG_flash.lds<\/code>\u201d.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0444\u0438\u043b\u044c\u0442\u0440\u0435 Source files \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430, \u043f\u0440\u0430\u0432\u044b\u0439 \u043a\u043b\u0438\u043a \u043d\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0435 Add->New Item:<\/p>\n<ul>\n<li>\n<p>\u201cUTestsForDebug_CAN_Tests.cpp\u201d  <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">#include &lt;CppUTest\/CommandLineTestRunner.h> #include &lt;stm32f4xx_hal.h>  int main(void) {   HAL_Init();    const char *p = \"\";   CommandLineTestRunner::RunAllTests(0, &amp;p);   return 0; }<\/code><\/pre>\n<\/p>\n<ul>\n<li>\n<p>\u201ccommunication_tests.cpp\u201d  <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">#include \"main.h\" #include &lt;CppUTest\/CommandLineTestRunner.h> #include &lt;stdio.h>  TEST_GROUP(CommunicationTestGroup){TEST_SETUP(){         SystemClock_Config();         CAN_Init(true); }  TEST_TEARDOWN() {} } ;  static Led_TypeDef led_On; void BSP_LED_On(Led_TypeDef Led) { led_On = Led; }  static Led_TypeDef led_Off; void BSP_LED_Off(Led_TypeDef Led) { led_Off = Led; }  static Led_TypeDef led_Toggle; void BSP_LED_Toggle(Led_TypeDef Led) { led_Toggle = Led; }  TEST(CommunicationTestGroup, Debug_VeryDifficult_Case) {   uint8_t payload[6] = {0, 1, 2, 3, 4, 5};    CAN_SendCommand(TCommandId::cmd_VeryDifficult, 2, payload);   Comm_ProcessMessages();    CHECK_EQUAL_TEXT(LED6, led_On,                    \"Perform_Command_VeryDifficult was not called\");   CHECK_EQUAL_TEXT(LED5, led_Off,                    \"Perform_Command_VeryDifficult was not called\"); }<\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u043c \u0443\u0434\u0430\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0441\u043b\u0443\u0436\u0438\u0442 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0432 Test Explorer Visual Studio.  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0dd\/915\/d07\/0dd915d07061cd7b056ccf3e9c96fcd4.png\" width=\"786\" height=\"203\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0dd\/915\/d07\/0dd915d07061cd7b056ccf3e9c96fcd4.png\"\/><\/figure>\n<p>\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0430\u0436\u0430\u0442\u0438\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 Run.  <\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 <code>Perform_Command_VeryDifficult<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c breakpoint \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 <code>UTestsForDebug_CAN_Tests<\/code> \u0432 Debug.\u00a0<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d31\/689\/a3d\/d31689a3d2c901f247d0762c6b40e416.png\" width=\"693\" height=\"329\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d31\/689\/a3d\/d31689a3d2c901f247d0762c6b40e416.png\"\/><\/figure>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 Call Stack, \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u0435 \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043f\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u0435, \u0432 <code>TEST(CommunicationTestGroup, Debug_VeryDifficult_Case)<\/code> \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f <code>cmd_VeryDifficult<\/code>, \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 CAN \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a. \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 <code>Comm_ProcessMessages<\/code> \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f, \u043f\u0430\u0440\u0441\u044f\u0442\u0441\u044f \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>Perform_Command_VeryDifficult<\/code>. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0432 \u0444\u0438\u043d\u0430\u043b\u0435 \u0442\u0435\u0441\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442 \u0443\u0436\u0435 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u0430\u043a unit-\u0442\u0435\u0441\u0442. <\/p>\n<h2>UTestsForDebug_UART<\/h2>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <code>UTestsForDebug_UART\/UTestsForDebug_UART.sln<\/code> \u0432 Visual Studio.\u00a0<\/p>\n<blockquote>\n<p>\u041b\u0435\u0433\u0435\u043d\u0434\u0430 \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0448\u0438\u043d\u043e\u0439 CAN, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c Perform_Command_VeryDifficult. <\/p>\n<\/blockquote>\n<p>\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0443\u044e \u043e\u0442\u043b\u0430\u0434\u043a\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c unit-test \u043f\u0440\u043e\u0435\u043a\u0442\u0435 <code>UTestsForDebug_UART_Tests<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 unit-test \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <code>UTestsForDebug_CAN_Tests<\/code>. \u0417\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0443\u043d\u043a\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u0417\u0430\u043c\u0435\u043d\u0430 CAN \u043d\u0430 UART \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0424\u0430\u0439\u043b <code>UTestsForDebug_UART\/UTestsForDebug_UART\/uart_module.cpp<\/code> \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0444\u0438\u043b\u044c\u0442\u0440 \u201c<code>Source files\/Device-specific files\/Test Framework<\/code>\u201d \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 mocking, <em>\u043c\u0430\u043a\u0440\u043e\u0441 $(TESTFW_BASE_LOCAL) \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043f\u0430\u043f\u043a\u0443 \u0441 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u043c\u0438 VisualGDB, \u0442.\u0435. C:\\Users\\User\\AppData\\Local\\VisualGDB\\TestFrameworks\\<\/em>:<\/p>\n<ul>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockActualCall.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockExpectedCall.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockExpectedCallsList.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockFailure.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockNamedValue.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockSupport.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockSupportPlugin.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockSupport_c.cpp&#187;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>UTestsForDebug_UART_Tests.cpp<\/code> \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e <code>UTestsForDebug_CAN_Tests.cpp<\/code>. <\/p>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>communication_tests.cpp<\/code>:<\/p>\n<pre><code class=\"cpp\">#include \"CppUTest\/TestHarness.h\" #include \"CppUTestExt\/MockSupport.h\" #include &lt;CppUTest\/CommandLineTestRunner.h>  #include \"main.h\" #include &lt;stdio.h>  TEST_GROUP(CommunicationTestGroup){TEST_SETUP(){SystemClock_Config(); } TEST_TEARDOWN() { mock().clear(); } } ;  TEST(CommunicationTestGroup, Debug_VeryDifficult_Case) {   TCommandId id;    id = TCommandId::cmd_VeryDifficult;    mock()       .expectOneCall(\"UART_HandleReceivingCommands\")       .withOutputParameterReturning(\"id\", &amp;id, sizeof(id))       .andReturnValue(true);    mock()       .expectOneCall(\"UART_SendCommand\")       .withParameter(\"id\", TCommandId::cmd_Start)       .withParameter(\"status\", 0);    mock().expectOneCall(\"BSP_LED_On\").withParameter(\"Led\", LED6);   mock().expectOneCall(\"BSP_LED_Off\").withParameter(\"Led\", LED4);   mock().expectOneCall(\"BSP_LED_Off\").withParameter(\"Led\", LED5);    Comm_ProcessMessages();    mock().checkExpectations(); }  \/* mocking work module*\/  void UART_Init() { mock().actualCall(\"UART_Init\"); }  void UART_SendCommand(TCommandId id, uint8_t status, uint8_t *payload) {   (void)payload;    mock()       .actualCall(\"UART_SendCommand\")       .withIntParameter(\"id\", id)       .withUnsignedIntParameter(\"status\", status); }  bool UART_HandleReceivingCommands(TCommandId *id, uint8_t *status,                                   uint8_t *payload, size_t payload_size) {   (void)status;   (void)payload;   (void)payload_size;    return mock()       .actualCall(\"UART_HandleReceivingCommands\")       .withOutputParameter(\"id\", id)       .returnBoolValue(); }  void BSP_LED_On(Led_TypeDef Led) {   mock().actualCall(\"BSP_LED_On\").withIntParameter(\"Led\", Led); }  void BSP_LED_Off(Led_TypeDef Led) {   mock().actualCall(\"BSP_LED_Off\").withIntParameter(\"Led\", Led); }  void BSP_LED_Toggle(Led_TypeDef Led) {   mock().actualCall(\"BSP_LED_Toggle\").withIntParameter(\"Led\", Led); }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0438 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 Test Explorer Visual Studio \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0442\u0435\u0441\u0442 \u201c<code>Debug_VeryDifficult_Case<\/code>\u201d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c\u0441\u044f \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u043d\u0430 Run.  <\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0442\u043b\u0430\u0434\u043a\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 <code>Perform_Command_VeryDifficult<\/code> \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0441 CAN \u0448\u0438\u043d\u043e\u0439. \u041f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043f\u043e UART \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0438\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u201cmocking\u201d \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>UART_HandleReceivingCommands<\/code>, <\/p>\n<pre><code class=\"cpp\">id = TCommandId::cmd_VeryDifficult;  mock()      .expectOneCall(\"UART_HandleReceivingCommands\")      .withOutputParameterReturning(\"id\", &amp;id, sizeof(id))      .andReturnValue(true);<\/code><\/pre>\n<p>\u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <code>UART_HandleReceivingCommands<\/code> \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0442\u0435\u0441\u0442\u0430, \u201c<code>expectOneCall\u2026withOutputParameterReturning\u2026<\/code>\u201d. \u0412\u0430\u0440\u0438\u0430\u0446\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u043c\u0435\u0442\u043e\u0434\u0430\u0445 <code>withOutputParameterReturning<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0441\u0438\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u0435\u0439\u0441\u044b. <em>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u0443 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u201cid\u201d<\/em>.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u0441\u043f\u0435\u0445\u0430 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <code>Perform_Command_VeryDifficult<\/code> \u0437\u0430\u043c\u043e\u043a\u0430\u043d\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p><code>UART_SendCommand<\/code>, \u0441 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c <code>id<\/code> \u0440\u0430\u0432\u043d\u044b\u043c <code>TCommandId::cmd_Start<\/code> \u0438 <code>status<\/code> \u0440\u0430\u0432\u043d\u044b\u043c 0.<\/p>\n<\/li>\n<li>\n<p><code>BSP_LED_On<\/code>, \u0441 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>Led<\/code> \u0440\u0430\u0432\u043d\u044b\u043c <code>LED6<\/code><\/p>\n<\/li>\n<li>\n<p>\u0438 \u0434\u0432\u0430 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f <code>BSP_LED_Off<\/code>, \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0443 <code>Led<\/code> \u0440\u0430\u0432\u043d\u044b\u043c\u0438 <code>LED4<\/code> \u0438 <code>LED5<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0443\u0436\u0435 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u0430\u043a unit-\u0442\u0435\u0441\u0442.<\/p>\n<h2>UTestsForDebug_dotNET  <\/h2>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <code>UTestsForDebug_dotNET\/UTestsForDebug_dotNET.sln<\/code> \u0432 Visual Studio.\u00a0<\/p>\n<p>\u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>SuperCalc.GetVeryDifficultCompute<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 unit-test \u043f\u0440\u043e\u0435\u043a\u0442 <code>UTestsForDebug_dotNET.Tests<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 unit-test \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/summary>\n<div class=\"spoiler__content\">\n<ul>\n<li>\n<p>\u0416\u043c\u0435\u043c \u0432 Visual Studio \u043c\u0435\u043d\u044e->FILE->Add->New Project.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u043c\u0441\u044f \u043c\u0430\u0441\u0442\u0435\u0440\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u201cNUnit Test Project\u201d.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <code>UTestsForDebug_dotNET.Tests<\/code> \u0438 \u043f\u0443\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 <code>UTestsForDebug_dotNET<\/code>.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Framework .NET 8.0 (LTS) \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0412 Visual Studio \u043c\u0435\u043d\u044e->PROJECT \u0436\u043c\u0435\u043c \u043d\u0430 Add Project Reference\u2026 \u0438 \u0432 \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0435\u043c\u0441\u044f \u043e\u043a\u043d\u0435 \u043e\u0442\u043c\u0435\u0447\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 UTestsForDebug_dotNET.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b <code>UnitTest1.cs<\/code> \u0432 <code>SuperCalcTests.cs<\/code>, \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u043a\u043e\u0434\u043e\u043c:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cs\">namespace UTestsForDebug_dotNET.Tests {     public class SuperCalcTests {         [Test]         public void GetVeryDifficultCompute_Test() {             var value = SuperCalc.GetVeryDifficultCompute(0);             Assert.That(value, Is.EqualTo(0));              value = SuperCalc.GetVeryDifficultCompute(int.MaxValue);             Assert.That(value, Is.EqualTo(4.6116860143471688E+18).Within(1).Ulps);              value = SuperCalc.GetVeryDifficultCompute(int.MinValue);             Assert.That(value, Is.EqualTo(4.61168601821264E+18).Within(1).Ulps);         }     } }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0438 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 Test Explorer visual studio \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0442\u0435\u0441\u0442 \u201c<code>GetVeryDifficultCompute_Test<\/code>\u201d.  <\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0442\u043b\u0430\u0434\u043a\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 <code>SuperCalc.GetVeryDifficultCompute<\/code> \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c Debug-\u043e\u043c \u044d\u0442\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430, \u043f\u0440\u0430\u0432\u044b\u0439 \u043a\u043b\u0438\u043a \u043d\u0430 \u0442\u0435\u0441\u0442\u0435 <code>GetVeryDifficultCompute_Test<\/code> \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0431\u043e\u0440 Debug Tests.  <\/p>\n<details class=\"spoiler\">\n<summary>Debug Tests<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/899\/ed9\/381\/899ed938141ed267a9f3f329a3e2f0e5.png\" width=\"737\" height=\"499\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/899\/ed9\/381\/899ed938141ed267a9f3f329a3e2f0e5.png\"\/><\/figure>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u201c\u043f\u0435\u0440\u0435\u0442\u044f\u0433\u0438\u0432\u0430\u043d\u0438\u0435\u043c\u201d \u0442\u043e\u0447\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (\u0436\u0435\u043b\u0442\u0430\u044f \u0441\u0442\u0440\u0435\u043b\u043a\u0430) \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430 \u0442\u043e\u0447\u043a\u0443 \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430.  <\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/39c\/88d\/957\/39c88d95789a6bbc1ff25c14008d4018.png\" width=\"870\" height=\"308\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/39c\/88d\/957\/39c88d95789a6bbc1ff25c14008d4018.png\"\/><\/figure>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0441\u043b\u0435 \u0432\u0445\u043e\u0434\u0430 \u0432 GetVeryDifficultCompute \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u00a0number \u043d\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435.  <\/p>\n<details class=\"spoiler\">\n<summary>Inline \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430<\/summary>\n<div class=\"spoiler__content\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b8e\/253\/45d\/b8e25345dba1a0db5c554f5bf7715742.png\" width=\"884\" height=\"214\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b8e\/253\/45d\/b8e25345dba1a0db5c554f5bf7715742.png\"\/><\/figure>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435  <\/h2>\n<p>\u0414\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u044f \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434, \u0432\u0435\u0434\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f unit-\u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0435 \u0442\u0430\u043a \u0441\u043b\u043e\u0436\u043d\u043e. \u041b\u0443\u0447\u0448\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0447\u0430\u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043d\u043e \u043f\u043e\u0442\u043e\u043c \u043d\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u043e\u0439 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0438. \u0414\u0430 \u0438 \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u0441\u0442\u044b \u0443\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435. \u0421\u0442\u0430\u0442\u044c\u044f \u0442\u0430\u043a\u0436\u0435 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0435 \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043e\u043b\u043b\u0435\u0433-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432.   <\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/784644\/\"> https:\/\/habr.com\/ru\/articles\/784644\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041e\u0442\u043b\u0430\u0434\u043a\u0430 \u044d\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0431\u044b \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u043e \u043c\u043d\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0438\u0441\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u0438\u0434\u0435\u043b \u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041d\u043e unit-\u0442\u0435\u0441\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043a\u0435\u0439\u0441\u043e\u0432, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0432 \u043a\u043e\u0434\u0435. \u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043d\u043e\u043c\u0443 \u0443\u0447\u0430\u0441\u0442\u043a\u0443, \u043d\u043e \u0443 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0435\u0441\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u0438\u043d\u0443\u0441 &#8212; \u044d\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u0438\u0437-\u0437\u0430 \u0447\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0448\u0430\u043d\u0441 \u0437\u0430\u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0434\u0435\u0431\u0430\u0436\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u042f \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043a \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f unit-\u0442\u0435\u0441\u0442\u043e\u0432 \u0432\u043c\u0435\u0441\u0442\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u0438 \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u044d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442 \u201c\u043e\u0442\u043b\u0430\u0434\u043a\u0438\u201d \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u0430\u043a unit-\u0442\u0435\u0441\u0442 \u0434\u043b\u044f \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. <\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u044b \u0442\u0440\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 (\u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 Microsoft Visual Studio 2022 solution). \u0414\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0434\u043b\u044f embedded \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u043f\u043e\u0434 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u0443\u044e \u043f\u043b\u0430\u0442\u0443 STM32F4-Discovery, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u043e \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u043c \u041f\u041e \u0447\u0430\u0441\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0441\u043e\u0431\u043b\u044e\u0441\u0442\u0438 \u0432\u0441\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0434\u043b\u044f \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0418 \u0442\u0440\u0435\u0442\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043b\u044f .NET \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u0441\u0435 \u0442\u0440\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432 \u0441\u0435\u0431\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0421\/\u0421++. <code>UTestsForDebug_CAN<\/code>. \u0418\u043c\u0438\u0442\u0430\u0446\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u0435\u0432\u0430\u0439\u0441\u0430 \u043d\u0430 STM32F4 \u0441 \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u043f\u043e CAN \u0448\u0438\u043d\u0435. \u041f\u043e \u043b\u0435\u0433\u0435\u043d\u0434\u0435 \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0440\u0435\u0434\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u043f\u043e CAN. \u0414\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 CAN \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0432 \u0440\u0435\u0436\u0438\u043c LOOPBACK, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0432 \u043f\u0440\u0438\u0435\u043c\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u0421\/\u0421++. <code>UTestsForDebug_UART<\/code>. \u0418\u043c\u0438\u0442\u0430\u0446\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0434\u0435\u0432\u0430\u0439\u0441\u0430 \u043d\u0430 STM32F4 \u0441 \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u0435\u0439 \u043f\u043e UART \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443. \u041f\u043e \u043b\u0435\u0433\u0435\u043d\u0434\u0435 \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0440\u0435\u0434\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u043f\u043e UART. \u0412\u0432\u0438\u0434\u0443 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u201c\u044d\u0445\u0430\u201d \u0443 \u043c\u043e\u0434\u0443\u043b\u044f UART, \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u201c\u043c\u043e\u043a\u0438\u043d\u0433\u043e\u043c (Mock)\u201d \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u0440\u0438\u0435\u043c\u0430\/\u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>C#. <code>UTestsForDebug_dotNET<\/code>. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u043e \u0440\u0430\u0441\u0447\u0435\u0442\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435. \u041e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c \u044d\u0442\u0443 \u0444\u043e\u0440\u043c\u0443\u043b\u0443.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432\u0441\u0435\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0435\u0441\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/viordash\/UTestsForDebug\" rel=\"noopener noreferrer nofollow\">\u0433\u0438\u0442\u0445\u0430\u0431<\/a>. Embedded \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u043f\u043b\u0430\u0433\u0438\u043d\u0435 <a href=\"https:\/\/visualgdb.com\/\" rel=\"noopener noreferrer nofollow\">VisualGDB<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c (\u0434\u043b\u044f \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c 30 \u0434\u043d\u0435\u0432\u043d\u0443\u044e \u0442\u0440\u0438\u0430\u043b-\u0432\u0435\u0440\u0441\u0438\u044e) \u0438 \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 <a href=\"https:\/\/cpputest.github.io\/\" rel=\"noopener noreferrer nofollow\">CppUTest<\/a> (\u043e\u043d \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043e\u0441\u0442\u0430\u0432 VisualGDB). \u0412\u044b\u0431\u043e\u0440 VisualGDB \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u0442\u0430 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e embedded \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e\u0434 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c \u0438 \u0441 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u043b\u0430\u0434\u043a\u043e\u0439 \u043d\u0430 \u201c\u0436\u0435\u043b\u0435\u0437\u0435\u201d. CppUTest \u0432\u044b\u0431\u0440\u0430\u043d \u0438\u0437-\u0437\u0430 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043c\u043e\u043a\u0438\u043d\u0433\u0430 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0434\u0435\u0442\u0435\u043a\u0442\u043e\u0440\u0430 memleak-\u043e\u0432 \u0438\u0437 \u201c\u043a\u043e\u0440\u043e\u0431\u043a\u0438\u201d. \u041f\u0440\u043e\u0435\u043a\u0442 .NET \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 .NET 8.0, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a NUnit.  <\/p>\n<h2>UTestsForDebug_CAN  <\/h2>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <code>UTestsForDebug_CAN\/UTestsForDebug_CAN.sln<\/code> \u0432 Visual Studio.\u00a0<\/p>\n<blockquote>\n<p>\u041a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u0435\u0433\u0435\u043d\u0434\u044b: \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u044c <code>communication.cpp<\/code>, \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <code>Comm_ProcessMessages()<\/code> \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438\u0435\u043c \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 \u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0449\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b. \u041f\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0435 <code>cmd_VeryDifficult<\/code> \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 <code>Perform_Command_VeryDifficult<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c. \u041d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>cmd_VeryDifficult<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0439 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u043b\u0430\u0434\u043a\u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0435\u043d\u0430.  <\/p>\n<\/blockquote>\n<p>\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0443\u044e \u043e\u0442\u043b\u0430\u0434\u043a\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c unit-test \u043f\u0440\u043e\u0435\u043a\u0442\u0435 <code>UTestsForDebug_CAN_Tests<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 unit-test \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0416\u043c\u0435\u043c \u0432 Visual Studio \u043c\u0435\u043d\u044e->FILE->Add->New Project. \u0412 \u043e\u0442\u043a\u0440\u044b\u0432\u0448\u0435\u043c\u0441\u044f \u043c\u0430\u0441\u0442\u0435\u0440\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u201cEmbedded Project Wizard\u201d:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <code>UTestsForDebug_CAN_Tests<\/code> \u0438 \u043f\u0443\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 <code>UTestsForDebug_CAN<\/code>.\u00a0<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Unit Test, MSBuild, CppUTest:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u0443\u043b\u0447\u0435\u0439\u043d ARM \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 STM32F407VG:  <\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Empty Project:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041d\u0430 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043e\u0442\u043b\u0430\u0434\u043a\u0438, \u0434\u043b\u044f STM32 \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e\u00a0 ST-Link:  <\/p>\n<figure class=\"full-width\"><\/figure>\n<p><em>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u0435\u0440\u0435\u043e\u0442\u043a\u0440\u044b\u0442\u044c solution, \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/em><\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438\u0437 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u042d\u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0438\u044f \u0441\u0440\u0435\u0434 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0438 \u0432 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c.  <\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u0434\u043e\u0432, \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0439 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u0437 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0448\u0430\u0433\u0438:<\/p>\n<ul>\n<li>\n<p>\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <code>UTestsForDebug_CAN_Tests<\/code> \u0444\u0430\u0439\u043b:<\/p>\n<ul>\n<li>\n<p>\u00a0startup_stm32f407xx.c<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b-\u0444\u0438\u043b\u044c\u0442\u0440 \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 <code>UTestsForDebug_CAN_Tests<\/code>, \u0436\u043c\u0435\u043c \u043c\u0435\u043d\u044e->PROJECT->New Filter, \u0432\u0432\u043e\u0434\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 ProjectSources. \u041f\u0440\u0430\u0432\u044b\u043c \u043a\u043b\u0438\u043a\u043e\u043c \u043d\u0430 \u0432\u043d\u043e\u0432\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0435 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u043c \u043c\u0435\u043d\u044e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Add->Existing Item\u2026<\/p>\n<figure class=\"full-width\"><\/figure>\n<\/li>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u0438\u0437 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430:\u00a0<\/p>\n<ul>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/can_module.cpp<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/communication.cpp<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/Src\/stm32f4xx_hal_msp.c<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/Src\/stm32f4xx_it.c<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/Src\/system_stm32f4xx.c<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/Inc\/main.h<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/Inc\/stm32f4xx_hal_conf.h<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/Inc\/stm32f4xx_it.h<\/p>\n<\/li>\n<li>\n<p>\u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0438\u0437 \u043f\u0430\u043f\u043a\u0438 UTestsForDebug_CAN\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/STM32F4xx_HAL_Driver\/Src<\/p>\n<\/li>\n<li>\n<p>UTestsForDebug_CAN\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/StartupFiles\/startup_stm32f407xx.c<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p>\u041f\u0440\u0430\u0432\u044b\u043c \u043a\u043b\u0438\u043a\u043e\u043c \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u201cVisualGDB Project Properties\u201d, \u043d\u0430 \u0437\u0430\u043a\u043b\u0430\u0434\u043a\u0435 \u0441\u043b\u0435\u0432\u0430 \u201cMSBuild settings\u201d, \u0432 \u043f\u043e\u043b\u0435 Preprocessor Macros \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u201c<code>DEBUG=1;STM32F407VG;STM32F407xx<\/code>\u201d\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0422\u0430\u043c \u0436\u0435 \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0432 \u043f\u043e\u043b\u0435 Include Directories \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u043a \u0444\u0430\u0439\u043b\u0430\u043c \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u201c<code>..\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/BSP\/STM32F4-Discovery;..\/UTestsForDebug_CAN\/Inc;..\/UTestsForDebug_CAN\/Src;..\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/CMSIS_HAL\/Device\/ST\/STM32F4xx\/Include;..\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/CMSIS_HAL\/Include;..\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/STM32F4xx_HAL_Driver\/Inc<\/code>\u201d.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043f\u043e\u043b\u0435 Linker Script \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u0444\u0430\u0439\u043b \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043b\u0438\u043d\u043a\u0435\u0440\u0430\u00a0 \u201c<code>..\/UTestsForDebug_CAN\/BSP\/STM32F4xxxx\/LinkerScripts\/STM32F407VG_flash.lds<\/code>\u201d.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0444\u0438\u043b\u044c\u0442\u0440\u0435 Source files \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430, \u043f\u0440\u0430\u0432\u044b\u0439 \u043a\u043b\u0438\u043a \u043d\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0435 Add->New Item:<\/p>\n<ul>\n<li>\n<p>\u201cUTestsForDebug_CAN_Tests.cpp\u201d  <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">#include &lt;CppUTest\/CommandLineTestRunner.h> #include &lt;stm32f4xx_hal.h>  int main(void) {   HAL_Init();    const char *p = \"\";   CommandLineTestRunner::RunAllTests(0, &amp;p);   return 0; }<\/code><\/pre>\n<\/p>\n<ul>\n<li>\n<p>\u201ccommunication_tests.cpp\u201d  <\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"cpp\">#include \"main.h\" #include &lt;CppUTest\/CommandLineTestRunner.h> #include &lt;stdio.h>  TEST_GROUP(CommunicationTestGroup){TEST_SETUP(){         SystemClock_Config();         CAN_Init(true); }  TEST_TEARDOWN() {} } ;  static Led_TypeDef led_On; void BSP_LED_On(Led_TypeDef Led) { led_On = Led; }  static Led_TypeDef led_Off; void BSP_LED_Off(Led_TypeDef Led) { led_Off = Led; }  static Led_TypeDef led_Toggle; void BSP_LED_Toggle(Led_TypeDef Led) { led_Toggle = Led; }  TEST(CommunicationTestGroup, Debug_VeryDifficult_Case) {   uint8_t payload[6] = {0, 1, 2, 3, 4, 5};    CAN_SendCommand(TCommandId::cmd_VeryDifficult, 2, payload);   Comm_ProcessMessages();    CHECK_EQUAL_TEXT(LED6, led_On,                    \"Perform_Command_VeryDifficult was not called\");   CHECK_EQUAL_TEXT(LED5, led_Off,                    \"Perform_Command_VeryDifficult was not called\"); }<\/code><\/pre>\n<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u043c \u0443\u0434\u0430\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0441\u043b\u0443\u0436\u0438\u0442 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0432 Test Explorer Visual Studio.  <\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0430\u0436\u0430\u0442\u0438\u0435\u043c \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 Run.  <\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 <code>Perform_Command_VeryDifficult<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c breakpoint \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 <code>UTestsForDebug_CAN_Tests<\/code> \u0432 Debug.\u00a0<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 Call Stack, \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u0435 \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043f\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u0435, \u0432 <code>TEST(CommunicationTestGroup, Debug_VeryDifficult_Case)<\/code> \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f <code>cmd_VeryDifficult<\/code>, \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 CAN \u043f\u0440\u0438\u0435\u043c\u043d\u0438\u043a. \u0412 \u043c\u0435\u0442\u043e\u0434\u0435 <code>Comm_ProcessMessages<\/code> \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f, \u043f\u0430\u0440\u0441\u044f\u0442\u0441\u044f \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>Perform_Command_VeryDifficult<\/code>. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0432 \u0444\u0438\u043d\u0430\u043b\u0435 \u0442\u0435\u0441\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0442\u043b\u0430\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442 \u0443\u0436\u0435 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a\u0430\u043a unit-\u0442\u0435\u0441\u0442. <\/p>\n<h2>UTestsForDebug_UART<\/h2>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <code>UTestsForDebug_UART\/UTestsForDebug_UART.sln<\/code> \u0432 Visual Studio.\u00a0<\/p>\n<blockquote>\n<p>\u041b\u0435\u0433\u0435\u043d\u0434\u0430 \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0448\u0438\u043d\u043e\u0439 CAN, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u043b\u0430\u0434\u0438\u0442\u044c Perform_Command_VeryDifficult. <\/p>\n<\/blockquote>\n<p>\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0443\u044e \u043e\u0442\u043b\u0430\u0434\u043a\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c unit-test \u043f\u0440\u043e\u0435\u043a\u0442\u0435 <code>UTestsForDebug_UART_Tests<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 unit-test \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <code>UTestsForDebug_CAN_Tests<\/code>. \u0417\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u0443\u043d\u043a\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u0417\u0430\u043c\u0435\u043d\u0430 CAN \u043d\u0430 UART \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0424\u0430\u0439\u043b <code>UTestsForDebug_UART\/UTestsForDebug_UART\/uart_module.cpp<\/code> \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0444\u0438\u043b\u044c\u0442\u0440 \u201c<code>Source files\/Device-specific files\/Test Framework<\/code>\u201d \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 mocking, <em>\u043c\u0430\u043a\u0440\u043e\u0441 $(TESTFW_BASE_LOCAL) \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043f\u0430\u043f\u043a\u0443 \u0441 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430\u043c\u0438 VisualGDB, \u0442.\u0435. C:\\Users\\User\\AppData\\Local\\VisualGDB\\TestFrameworks\\<\/em>:<\/p>\n<ul>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockActualCall.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockExpectedCall.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockExpectedCallsList.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockFailure.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockNamedValue.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockSupport.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockSupportPlugin.cpp&#187;<\/p>\n<\/li>\n<li>\n<p>&#171;$(TESTFW_BASE_LOCAL)\\com.sysprogs.unittest.CppUTest\\src\\CppUTestExt\\MockSupport_c.cpp&#187;<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>UTestsForDebug_UART_Tests.cpp<\/code> \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e <code>UTestsForDebug_CAN_Tests.cpp<\/code>. <\/p>\n<p>\u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>communication_tests.cpp<\/code>:<\/p>\n<pre><code class=\"cpp\">#include \"CppUTest\/TestHarness.h\" #include \"CppUTestExt\/MockSupport.h\" #include &lt;CppUTest\/CommandLineTestRunner.h>  #include \"main.h\" #include &lt;stdio.h>  TEST_GROUP(CommunicationTestGroup){TEST_SETUP(){SystemClock_Config(); } TEST_TEARDOWN() { mock().clear(); } } ;  TEST(CommunicationTestGroup, Debug_VeryDifficult_Case) {   TCommandId id;    id = TCommandId::cmd_VeryDifficult;    mock()       .expectOneCall(\"UART_HandleReceivingCommands\")       .withOutputParameterReturning(\"id\", &amp;id, sizeof(id))       .andReturnValue(true);    mock()       .expectOneCall(\"UART_SendCommand\")       .withParameter(\"id\", TCommandId::cmd_Start)       .withParameter(\"status\", 0);<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-364593","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/364593","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=364593"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/364593\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=364593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=364593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=364593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}