From adfd7dac5376c24e44f5f217f387784a8f614a74 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 31 Dec 2025 11:28:13 +0100 Subject: chore: rename kout to print test. ran format. Signed-off-by: Amlal El Mahrouss --- test/kernel_test/kout.test.cc | 73 ---------------------------------------- test/kernel_test/print.test.cc | 73 ++++++++++++++++++++++++++++++++++++++++ test/kernel_test/process.test.cc | 5 ++- 3 files changed, 75 insertions(+), 76 deletions(-) delete mode 100644 test/kernel_test/kout.test.cc create mode 100644 test/kernel_test/print.test.cc (limited to 'test/kernel_test') diff --git a/test/kernel_test/kout.test.cc b/test/kernel_test/kout.test.cc deleted file mode 100644 index fb395b90..00000000 --- a/test/kernel_test/kout.test.cc +++ /dev/null @@ -1,73 +0,0 @@ -/// \file kout.test.cc -/// \brief Konsole Out tests. - -#include -#include - -/// \note PrintGet tests -KT_DECL_TEST(KOutIsNull, []() -> bool { return PrintGet("/null/") == nullptr; }); -KT_DECL_TEST(KOutIsNotNull, []() -> 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(KOutIsNull); - KT_RUN_TEST(KOutIsNotNull); - - 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; -} \ No newline at end of file diff --git a/test/kernel_test/print.test.cc b/test/kernel_test/print.test.cc new file mode 100644 index 00000000..4f9bc828 --- /dev/null +++ b/test/kernel_test/print.test.cc @@ -0,0 +1,73 @@ +/// \file kout.test.cc +/// \brief Konsole Out tests. + +#include +#include + +/// \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; +} diff --git a/test/kernel_test/process.test.cc b/test/kernel_test/process.test.cc index 1c7af22c..451cacfe 100644 --- a/test/kernel_test/process.test.cc +++ b/test/kernel_test/process.test.cc @@ -25,9 +25,8 @@ KT_DECL_TEST(ProcessSpawnWithArgs, []() -> bool { return pid > 0; }); -KT_DECL_TEST(ProcessSpawnNullPath, []() -> bool { - return RtlSpawnProcess(nullptr, 0, nullptr, nullptr, 0) == -1; -}); +KT_DECL_TEST(ProcessSpawnNullPath, + []() -> bool { return RtlSpawnProcess(nullptr, 0, nullptr, nullptr, 0) == -1; }); KT_DECL_TEST(ProcessSpawnInvalidPath, []() -> bool { return RtlSpawnProcess("/invalid/nonexistent", 0, nullptr, nullptr, 0) == -1; -- cgit v1.2.3