diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-06 06:36:01 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-06 06:37:15 +0100 |
| commit | ac993e1cf8ec4c55cbd1e80c7b94ac492d6dc4e8 (patch) | |
| tree | 7993e57bdab4fa9b6400d81ae477c736193de352 /test/kernel_test/error.test.cc | |
| parent | a5f3fdf32ba6aa34a5dd05eeb807446a9f046393 (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/kernel_test/error.test.cc')
| -rw-r--r-- | test/kernel_test/error.test.cc | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/test/kernel_test/error.test.cc b/test/kernel_test/error.test.cc deleted file mode 100644 index ece8f71d..00000000 --- a/test/kernel_test/error.test.cc +++ /dev/null @@ -1,67 +0,0 @@ -/// \file error.test.cc -/// \brief Error handling API tests. -/// \author Amlal El Mahrouss (amlal at nekernel dot org) - -#include <libSystem/SystemKit/System.h> -#include <public/frameworks/KernelTest.fwrk/headers/TestCase.h> - -/// \note ErrGetLastError tests -KT_DECL_TEST(ErrGetLastErrorInitial, []() -> bool { - SInt32 error = ErrGetLastError(); - return error >= 0; -}); - -KT_DECL_TEST(ErrGetLastErrorAfterSuccess, []() -> bool { - auto heap = MmCreateHeap(1024, 0); - if (!heap) return NO; - - SInt32 error = ErrGetLastError(); - MmDestroyHeap(heap); - - return error == 0; -}); - -KT_DECL_TEST(ErrGetLastErrorAfterFailure, []() -> bool { - auto heap = MmCreateHeap(0, 0); - - SInt32 error = ErrGetLastError(); - - return error != 0; -}); - -KT_DECL_TEST(ErrGetLastErrorAfterInvalidFile, []() -> bool { - auto file = IoOpenFile("/invalid/path/that/does/not/exist", nullptr); - - SInt32 error = ErrGetLastError(); - - if (file) IoCloseFile(file); - - return error != 0; -}); - -KT_DECL_TEST(ErrGetLastErrorAfterNullOp, []() -> bool { - auto ptr = MmCopyMemory(nullptr, nullptr, 10); - - SInt32 error = ErrGetLastError(); - - return error != 0; -}); - -KT_DECL_TEST(ErrGetLastErrorMultipleCalls, []() -> bool { - SInt32 error1 = ErrGetLastError(); - SInt32 error2 = ErrGetLastError(); - - return error1 == error2; -}); - -/// \brief Run error tests. -IMPORT_C SInt32 KT_TEST_MAIN() { - KT_RUN_TEST(ErrGetLastErrorInitial); - KT_RUN_TEST(ErrGetLastErrorAfterSuccess); - KT_RUN_TEST(ErrGetLastErrorAfterFailure); - KT_RUN_TEST(ErrGetLastErrorAfterInvalidFile); - KT_RUN_TEST(ErrGetLastErrorAfterNullOp); - KT_RUN_TEST(ErrGetLastErrorMultipleCalls); - - return KT_TEST_SUCCESS; -} |
