pikapython/port/linux/test/stack-test.cpp
2021-11-14 18:39:08 +08:00

26 lines
612 B
C

#include "gtest/gtest.h"
extern "C" {
#include "BaseObj.h"
#include "dataMemory.h"
#include "dataStack.h"
}
TEST(stack, NEW) {
Stack* s = New_Stack();
stack_deinit(s);
EXPECT_EQ(pikaMemNow(), 0);
}
TEST(stack, str) {
Stack* s = New_Stack();
stack_pushStr(s, (char*)"abc");
stack_pushStr(s, (char*)"123");
stack_pushStr(s, (char*)"xyz");
char buff[32] = {0};
EXPECT_STREQ(stack_popStr(s, buff), (char*)"xyz");
EXPECT_STREQ(stack_popStr(s, buff), (char*)"123");
EXPECT_STREQ(stack_popStr(s, buff), (char*)"abc");
stack_deinit(s);
EXPECT_EQ(pikaMemNow(), 0);
}