summaryrefslogtreecommitdiffhomepage
path: root/public/frameworks/KernelTest.fwrk/headers
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-29 21:38:33 -0500
committerAmlal El Mahrouss <amlal@nekernel.org>2025-11-29 21:38:33 -0500
commitb456c928fecf78157270b052e441a427f06afdda (patch)
tree2dbea485a392789fc67aa590f8a7afb9f263be3c /public/frameworks/KernelTest.fwrk/headers
parentbb303088aa2ed0693e19e93158155dd85783ce76 (diff)
feat: kernel: Introduce Vet.h, better Ref.h, and more improved containers for better kernel code.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'public/frameworks/KernelTest.fwrk/headers')
-rw-r--r--public/frameworks/KernelTest.fwrk/headers/Foundation.h9
-rw-r--r--public/frameworks/KernelTest.fwrk/headers/SourceLocation.h8
-rw-r--r--public/frameworks/KernelTest.fwrk/headers/TestCase.h47
3 files changed, 30 insertions, 34 deletions
diff --git a/public/frameworks/KernelTest.fwrk/headers/Foundation.h b/public/frameworks/KernelTest.fwrk/headers/Foundation.h
index 4329af6b..8ff956a7 100644
--- a/public/frameworks/KernelTest.fwrk/headers/Foundation.h
+++ b/public/frameworks/KernelTest.fwrk/headers/Foundation.h
@@ -6,11 +6,14 @@
#pragma once
-#include <KernelKit/DebugOutput.h>
-#include <NeKit/KernelPanic.h>
+#include <libSystem/SystemKit/System.h>
+#include <libSystem/SystemKit/Err.h>
+
+#include <CoreFoundation.fwrk/headers/Object.h>
+#include <CoreFoundation.fwrk/headers/String.h>
#define KT_TEST_VERSION_BCD (0x0001)
-#define KT_TEST_VERSION "dev-nekernel-test"
+#define KT_TEST_VERSION "v0.0.1"
#define KT_TEST_SUCCESS (kErrorSuccess)
#define KT_TEST_FAILURE (kErrorSuccess + 1)
diff --git a/public/frameworks/KernelTest.fwrk/headers/SourceLocation.h b/public/frameworks/KernelTest.fwrk/headers/SourceLocation.h
index 6507864b..6cfddae2 100644
--- a/public/frameworks/KernelTest.fwrk/headers/SourceLocation.h
+++ b/public/frameworks/KernelTest.fwrk/headers/SourceLocation.h
@@ -6,8 +6,6 @@
#pragma once
-#include <CoreFoundation.fwrk/headers/Object.h>
-#include <CoreFoundation.fwrk/headers/String.h>
#include <KernelTest.fwrk/headers/Foundation.h>
class KTSourceLocation;
@@ -17,7 +15,7 @@ class KTSourceLocation;
/// ================================================================================
class KTSourceLocation final CF_OBJECT {
public:
- explicit KTSourceLocation() = delete;
+ KTSourceLocation() = delete;
~KTSourceLocation() override = default;
LIBSYS_COPY_DELETE(KTSourceLocation);
@@ -25,8 +23,8 @@ class KTSourceLocation final CF_OBJECT {
public:
KTSourceLocation(const Char*, const SInt32 = 0UL);
- CF::CFString File();
- SInt32 Line();
+ CF::CFString& File() { return mFile; }
+ SInt32 Line() { return mLine; }
CF::CFString operator()();
diff --git a/public/frameworks/KernelTest.fwrk/headers/TestCase.h b/public/frameworks/KernelTest.fwrk/headers/TestCase.h
index 26325d42..2dcc56ef 100644
--- a/public/frameworks/KernelTest.fwrk/headers/TestCase.h
+++ b/public/frameworks/KernelTest.fwrk/headers/TestCase.h
@@ -18,34 +18,29 @@
KTTestCase##OBJECT{}.Run(); \
}
-#define KT_MUST_PASS(MSG, LEFT_COND, RIGHT_COND) \
- if (LEFT_COND != RIGHT_COND) { \
- (Kernel::Void)(Kernel::kout << "[KERNEL-TEST] BREAK: LEFT_COND: " << #LEFT_COND \
- << " RIGHT_COND: " << #RIGHT_COND << Kernel::kendl); \
- (Kernel::Void)(Kernel::kout << "[KERNEL-TEST] BREAK: MSG: " << MSG << Kernel::kendl); \
- MUST_PASS(NO); \
- } else { \
- (Kernel::Void)(Kernel::kout << "[KERNEL-TEST] PASS: MSG: " << MSG << Kernel::kendl); \
+#define KT_MUST_PASS(MSG, LEFT_COND, RIGHT_COND) \
+ if (LEFT_COND != RIGHT_COND) { \
+ MUST_PASS(NO); \
}
-#define KT_DECL_TEST(NAME, FN) \
- class KTTestCase##NAME final { \
- public: \
- explicit KTTestCase##NAME() = default; \
- ~KTTestCase##NAME() = default; \
- LIBSYS_COPY_DELETE(KTTestCase##NAME); \
- Kernel::Void Run(); \
- const Kernel::Char* ToString(); \
- }; \
- inline Kernel::Void KTTestCase##NAME::Run() { \
- auto ret = FN() == YES; \
- if (!ret) { \
- Kernel::kout << "[KERNEL-TEST] TEST FAILED!" << Kernel::kendl; \
- MUST_PASS(ret); \
- } \
- } \
- inline const Kernel::Char* KTTestCase##NAME::ToString() { \
- return #FN; \
+#define KT_DECL_TEST(NAME, FN) \
+ class KTTestCase##NAME final { \
+ public: \
+ KTTestCase##NAME() = default; \
+ ~KTTestCase##NAME() = default; \
+ LIBSYS_COPY_DELETE(KTTestCase##NAME); \
+ Void Run(); \
+ const Char* ToString(); \
+ }; \
+ inline Void KTTestCase##NAME::Run() { \
+ auto ret = FN() == YES; \
+ if (!ret) { \
+ PrintOut(nullptr, "[KERNEL-TEST] TEST FAILED!"); \
+ MUST_PASS(ret); \
+ } \
+ } \
+ inline const Char* KTTestCase##NAME::ToString() { \
+ return #FN; \
}
KT_DECL_TEST(AlwaysBreak, []() -> bool {