This commit is contained in:
Andre Wagner
2026-04-29 15:36:22 -05:00
parent 30bfb38e9a
commit 03b61f4339
5 changed files with 110 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
#include "../bytecode/bytearray.hh"
#include "../bytecode/bytecode.hh"
#include "code.hh"
#include "stack.hh"
using namespace tyche;
@@ -28,6 +29,20 @@ TEST(Code, ImportSingleAndDebug)
printf("%s\n", code.disassemble().c_str());
}
TEST(Stack, PushPullGet)
{
Stack stack;
stack.push(Value::CreateInteger(10));
stack.push(Value::CreateInteger(20));
stack.push(Value::CreateInteger(30));
ASSERT_EQ(stack.size(), 3);
ASSERT_EQ(stack.at(0).as_integer(), 10);
ASSERT_EQ(stack.at(1).as_integer(), 20);
ASSERT_EQ(stack.at(-1).as_integer(), 30);
ASSERT_EQ(stack.at(-2).as_integer(), 20);
}
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);