mirror of
https://github.com/aydencharles/onionHEN.git
synced 2026-10-23 04:12:37 -05:00
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.
46 lines
1.3 KiB
C
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;
|
|
}
|