Initial commit: demo-epb v1.0 — Elektrische Parkbremse Demo
Vollstaendige Demo des slohmaier Dev Process anhand einer EPB-Steuergeraet- Software. Zeigt ASPICE 4.0 / ISO 26262-konforme Entwicklung im Monorepo. Inhalte: - 5 Plaene (PID, PM-, QA-, SWE-, Test-Plan) in Word, ausgefuellt mit EPB-spezifischen Inhalten - 10 System-Anforderungen + 25 Software-Anforderungen (Doorstop-MD) - 5 System-Architektur-Elemente + 10 Software-Architektur-Elemente mit PlantUML-Diagrammen und vollstaendigem Mapping - 3 implementierte Komponenten (Apply Controller D, Actuator Driver B, Switch Debouncer QM) plus 7 Header-Stubs - 28 Unit-Tests, alle gruen, mit Coverage- und MISRA-Build-Targets - Audit-Artefakte: 1 Review-Protokoll, 1 Non-Conformity, 1 MISRA-Record - Gitea-Actions-CI-Pipeline (validate.yml) - Doorstop-Konfiguration fuer bidirektionale Traceability - Generator-Skript fuer alle 50 Reqs/Arch-Elemente aus Strukturdaten - README mit gefuehrter Tour fuer Prospects
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* @file unit_test_framework.h
|
||||
* @brief Minimaler Test-Runner fuer demo-epb.
|
||||
*
|
||||
* In Produktion wuerde hier CppUTest oder Google Test stehen
|
||||
* (siehe docs/SWE-Plan.docx, Abschnitt 7). Fuer die Demo
|
||||
* bleibt das Framework klein, damit es ohne externe Abhaengigkeiten baut.
|
||||
*/
|
||||
#ifndef UNIT_TEST_FRAMEWORK_H
|
||||
#define UNIT_TEST_FRAMEWORK_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct {
|
||||
int tests_run;
|
||||
int tests_failed;
|
||||
} TestStats;
|
||||
|
||||
extern TestStats g_test_stats;
|
||||
|
||||
#define TEST_BEGIN(name) \
|
||||
do { \
|
||||
++g_test_stats.tests_run; \
|
||||
const char* _test_name = name; \
|
||||
int _test_failed = 0; \
|
||||
printf(" TEST %s ... ", _test_name);
|
||||
|
||||
#define TEST_END() \
|
||||
if (_test_failed) { ++g_test_stats.tests_failed; \
|
||||
printf("FAIL\n"); } \
|
||||
else { printf("ok\n"); } \
|
||||
} while (0)
|
||||
|
||||
#define ASSERT_TRUE(expr) \
|
||||
do { if (!(expr)) { _test_failed = 1; \
|
||||
printf("\n ASSERT_TRUE failed: %s (%s:%d)\n", \
|
||||
#expr, __FILE__, __LINE__); } } while (0)
|
||||
|
||||
#define ASSERT_EQ(a, b) \
|
||||
do { long long _a = (long long)(a), _b = (long long)(b); \
|
||||
if (_a != _b) { _test_failed = 1; \
|
||||
printf("\n ASSERT_EQ failed: %s=%lld != %s=%lld (%s:%d)\n", \
|
||||
#a, _a, #b, _b, __FILE__, __LINE__); } \
|
||||
} while (0)
|
||||
|
||||
#define ASSERT_NE(a, b) \
|
||||
do { long long _a = (long long)(a), _b = (long long)(b); \
|
||||
if (_a == _b) { _test_failed = 1; \
|
||||
printf("\n ASSERT_NE failed: %s==%s==%lld (%s:%d)\n", \
|
||||
#a, #b, _a, __FILE__, __LINE__); } \
|
||||
} while (0)
|
||||
|
||||
#define TEST_SUMMARY() \
|
||||
do { \
|
||||
printf("\n%d tests run, %d failed.\n", \
|
||||
g_test_stats.tests_run, g_test_stats.tests_failed); \
|
||||
return (g_test_stats.tests_failed == 0) ? 0 : 1; \
|
||||
} while (0)
|
||||
|
||||
#endif /* UNIT_TEST_FRAMEWORK_H */
|
||||
Reference in New Issue
Block a user