Files
tactility/TactilityKernel/tests/source/paths_test.cpp
T
Ken Van Hoeylandt 643cbc3806 Implement posix app loading (#643)
- Added POSIX desktop support for SDK builds, application packaging, and integration testing.
- Added POSIX filesystem partitions and improved application path handling.
- Added simulator support for loading and running applications dynamically.
- Improved simulator task stack handling and display startup reliability.
- Improved simulator display scaling, resizing, high-DPI support, and pointer accuracy.
- Fixed LVGL timers and input polling on POSIX. (fixes simulator with Linux on some Intel graphics platforms)
- Standardized data paths across platforms.
- Logging now works via separate task: this allows apps to write to log without it affecting their stdout (for apps that output text as relevant date for other apps, like the File Selection app)
- Fixes for app stdio
2026-08-31 22:09:04 +02:00

32 lines
1.3 KiB
C++

#include "doctest.h"
#include <cstring>
#include <tactility/paths.h>
// The simulator target is never built with ESP_PLATFORM, so paths_get_data_path()
// always takes the fixed "data" root, with "/tactility" appended, guarded by a buffer-size check.
TEST_CASE("paths_get_data_path succeeds when the buffer exactly fits") {
char buffer[32] = { 0 };
CHECK_EQ(paths_get_data_path(buffer, sizeof(buffer)), ERROR_NONE);
CHECK_EQ(std::strcmp(buffer, "data/tactility"), 0);
}
TEST_CASE("paths_get_data_path succeeds with a buffer sized to exactly fit the string and terminator") {
char buffer[15] = { 0 }; // strlen("data/tactility") + 1
CHECK_EQ(paths_get_data_path(buffer, sizeof(buffer)), ERROR_NONE);
CHECK_EQ(std::strcmp(buffer, "data/tactility"), 0);
}
TEST_CASE("paths_get_data_path reports a buffer overflow when the buffer is one byte too small") {
char buffer[14] = { 0 }; // strlen("data/tactility"), no room for the terminator
CHECK_EQ(paths_get_data_path(buffer, sizeof(buffer)), ERROR_BUFFER_OVERFLOW);
}
TEST_CASE("paths_get_data_path reports a buffer overflow for a zero-size buffer") {
char buffer[1] = { 'x' };
CHECK_EQ(paths_get_data_path(buffer, 0), ERROR_BUFFER_OVERFLOW);
CHECK_EQ(buffer[0], 'x'); // untouched
}