From 6dce7016ce63281bfb8b38035139e63b55216a64 Mon Sep 17 00:00:00 2001 From: CHatingPython Date: Sun, 19 Jul 2026 21:53:37 +0200 Subject: [PATCH] test(furvm): introduce an add things test --- furvm/test/test.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/furvm/test/test.cpp b/furvm/test/test.cpp index 37afc66..2e82f54 100644 --- a/furvm/test/test.cpp +++ b/furvm/test/test.cpp @@ -1,3 +1,28 @@ +#include "furlang/arena.hpp" +#include "furvm/furvm.hpp" +#include "furvm/thing.hpp" +#include "furvm/thing_allocator.hpp" + #include "gtest/gtest.h" // IWYU pragma: keep -namespace {} \ No newline at end of file +namespace { + +// TODO: Basic program tests (e.g. for loops) + +TEST(Things, Ops) { + furlang::arena arena; + furvm::thing_allocator alloc{ arena }; + + furvm::thing lhs{ furvm::thing_type{ furvm::thing_type::U32 }, alloc }; + lhs.get() = 6; + furvm::thing rhs{ furvm::thing_type{ furvm::thing_type::U32 }, alloc }; + rhs.get() = 7; + + auto res = lhs.add(rhs); + ASSERT_EQ(res.type().type, furvm::thing_type::U32); + EXPECT_EQ(lhs.get(), 6); + EXPECT_EQ(rhs.get(), 7); + EXPECT_EQ(res.get(), 6 + 7); +} + +} // namespace