Initial commit

This commit is contained in:
Martino Ferrari
2026-02-21 00:58:56 +01:00
commit 5ef0efe7d6
26 changed files with 7999 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 3.10)
project(marte_dev_tests)
include_directories(
${MARTe2_DIR}/Source/Core/BareMetal/L0Types
${MARTe2_DIR}/Source/Core/BareMetal/L1Portability
# ... more ...
../../Source
../../Headers
)
file(GLOB SOURCES "*.cpp")
add_executable(UnitTests ${SOURCES})
target_link_libraries(UnitTests
marte_dev
${MARTe2_DIR}/Build/${TARGET}/Core/libMARTe2.so
)

35
Test/UnitTests/main.cpp Normal file
View File

@@ -0,0 +1,35 @@
#include <stdio.h>
#include <assert.h>
#include "DebugCore.h"
using namespace MARTe;
void TestRingBuffer() {
printf("Testing TraceRingBuffer...\n");
TraceRingBuffer rb;
assert(rb.Init(1024));
uint32 id = 42;
uint32 val = 12345678;
uint32 size = 4;
assert(rb.Push(id, &val, size));
assert(rb.Count() > 0);
uint32 poppedId = 0;
uint32 poppedVal = 0;
uint32 poppedSize = 0;
assert(rb.Pop(poppedId, &poppedVal, poppedSize, 4));
assert(poppedId == 42);
assert(poppedVal == 12345678);
assert(poppedSize == 4);
printf("TraceRingBuffer test passed.\n");
}
int main(int argc, char **argv) {
printf("Running MARTe2 Component Tests...\n");
TestRingBuffer();
return 0;
}