Files
onionHEN/source/util/tests/test_platform_notify.c
T
Hexwell 2c455c1eb6 test: expand host unit coverage for platform, ready flags, and IPC
Add suites for liborion_platform (fs/log/notify), richer settings and ready
flag cases, and msg.hpp protocol ordinals. Link real platform sources under
ORION_HOST_TEST; fix DaemonCommands to unsigned so high-bit opcodes are
well-formed. Rename host binary to orion-host-tests.
2026-07-10 15:42:32 +08:00

46 lines
1.3 KiB
C

/* Host tests for orion_notify_format (pure string path). */
#include "test_harness.h"
#include <orion/notify.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
static void format_msg(char *out, size_t out_sz, int wm, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
orion_notify_format(out, out_sz, wm, fmt, ap);
va_end(ap);
}
static int test_notify_format_prefix(void) {
char out[128];
format_msg(out, sizeof(out), 1, "hello %s", "world");
TEST_ASSERT_STREQ("[OrionHEN] hello world", out);
return 0;
}
static int test_notify_format_truncates(void) {
char out[16];
format_msg(out, sizeof(out), 0, "0123456789ABCDEFGHIJ");
/* must be NUL-terminated and start with prefix */
TEST_ASSERT_TRUE(out[sizeof(out) - 1] == '\0' || strlen(out) < sizeof(out));
TEST_ASSERT_TRUE(strncmp(out, "[OrionHEN]", 10) == 0);
return 0;
}
static int test_notify_send_noop(void) {
/* hits sceKernelSendNotificationRequest stub — must not crash */
orion_notify(1, "host test notify %d", 7);
return 0;
}
int test_platform_notify_suite(void) {
int failures = 0;
failures += orion_test_run("notify_format_prefix", test_notify_format_prefix);
failures += orion_test_run("notify_format_truncates", test_notify_format_truncates);
failures += orion_test_run("notify_send_noop", test_notify_send_noop);
return failures;
}