summaryrefslogtreecommitdiffhomepage
path: root/test/user_tests/kernel_test/print.test.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-03-06 06:36:01 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-03-06 06:37:15 +0100
commitac993e1cf8ec4c55cbd1e80c7b94ac492d6dc4e8 (patch)
tree7993e57bdab4fa9b6400d81ae477c736193de352 /test/user_tests/kernel_test/print.test.cc
parenta5f3fdf32ba6aa34a5dd05eeb807446a9f046393 (diff)
[FEAT] HeapMgr: Add LockDelegate to allocation calls, and re-introduce double-free prevention.
[CHORE] FileMgr: Cleanup and tweaks. [CHORE] ABI: Update copyright year. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'test/user_tests/kernel_test/print.test.cc')
-rw-r--r--test/user_tests/kernel_test/print.test.cc73
1 files changed, 73 insertions, 0 deletions
diff --git a/test/user_tests/kernel_test/print.test.cc b/test/user_tests/kernel_test/print.test.cc
new file mode 100644
index 00000000..4f9bc828
--- /dev/null
+++ b/test/user_tests/kernel_test/print.test.cc
@@ -0,0 +1,73 @@
+/// \file kout.test.cc
+/// \brief Konsole Out tests.
+
+#include <libSystem/SystemKit/System.h>
+#include <public/frameworks/KernelTest.fwrk/headers/TestCase.h>
+
+/// \note PrintGet tests
+KT_DECL_TEST(PrintIsNull, []() -> bool { return PrintGet("/null/") == nullptr; });
+KT_DECL_TEST(PrintIsNotNull, []() -> bool { return PrintGet(nullptr) != nullptr; });
+
+/// \note PrintCreate/PrintRelease tests
+KT_DECL_TEST(PrintCreateValid, []() -> bool {
+ auto handle = PrintCreate();
+ if (!handle) return NO;
+ PrintRelease(handle);
+ return YES;
+});
+
+KT_DECL_TEST(PrintReleaseValid, []() -> bool {
+ auto handle = PrintCreate();
+ if (!handle) return NO;
+ return PrintRelease(handle) == 0;
+});
+
+KT_DECL_TEST(PrintReleaseNull, []() -> bool { return PrintRelease(nullptr) != 0; });
+
+/// \note PrintOut tests
+KT_DECL_TEST(PrintOutValid, []() -> bool {
+ SInt32 result = PrintOut(nullptr, "Test output\n");
+ return result >= 0;
+});
+
+KT_DECL_TEST(PrintOutWithHandle, []() -> bool {
+ auto handle = PrintCreate();
+ SInt32 result = PrintOut(handle, "Test with handle\n");
+ PrintRelease(handle);
+ return result >= 0;
+});
+
+KT_DECL_TEST(PrintOutNull, []() -> bool {
+ SInt32 result = PrintOut(nullptr, nullptr);
+ return result < 0;
+});
+
+KT_DECL_TEST(PrintOutFormatted, []() -> bool {
+ SInt32 result = PrintOut(nullptr, "Value: %d\n", 42);
+ return result >= 0;
+});
+
+/// \note PrintIn tests
+KT_DECL_TEST(PrintInValid, []() -> bool {
+ SInt32 result = PrintIn(nullptr, "Input prompt: ");
+ return result >= 0;
+});
+
+/// \brief Run 'kout' test.
+SInt32 KT_TEST_MAIN() {
+ KT_RUN_TEST(PrintIsNull);
+ KT_RUN_TEST(PrintIsNotNull);
+
+ KT_RUN_TEST(PrintCreateValid);
+ KT_RUN_TEST(PrintReleaseValid);
+ KT_RUN_TEST(PrintReleaseNull);
+
+ KT_RUN_TEST(PrintOutValid);
+ KT_RUN_TEST(PrintOutWithHandle);
+ KT_RUN_TEST(PrintOutNull);
+ KT_RUN_TEST(PrintOutFormatted);
+
+ KT_RUN_TEST(PrintInValid);
+
+ return KT_TEST_SUCCESS;
+}