aboutsummaryrefslogtreecommitdiff
path: root/lib/libk/stdlib/test_allocator.hh
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2023-03-05 14:38:54 +0200
committeraqua <aqua@iserlohn-fortress.net>2023-03-05 14:38:54 +0200
commit787c1a6016dd2fdb51f20fcb5ca0ac5e461892d6 (patch)
tree7db9f5102adc3d50ca85a8175ce67465256b8908 /lib/libk/stdlib/test_allocator.hh
parentAdd TARGETBIN and TARGETLIB rules (diff)
downloadkernel-master.tar.xz
Move all tests next to the code they're testingHEADmaster
Diffstat (limited to 'lib/libk/stdlib/test_allocator.hh')
-rw-r--r--lib/libk/stdlib/test_allocator.hh22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/libk/stdlib/test_allocator.hh b/lib/libk/stdlib/test_allocator.hh
new file mode 100644
index 0000000..3bc1715
--- /dev/null
+++ b/lib/libk/stdlib/test_allocator.hh
@@ -0,0 +1,22 @@
+#pragma once
+
+class TestAllocator : public ::testing::Test {
+protected:
+ void
+ SetUp() override
+ {
+ memory = malloc(memory_size);
+ libk::alloc_init(memory, memory_size);
+ ASSERT_EQ(libk::begin, memory);
+ }
+
+ void
+ TearDown() override
+ {
+ free(memory);
+ libk::begin = nullptr;
+ }
+
+ const size_t memory_size = 4096;
+ void *memory = nullptr;
+};