mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
27 lines
628 B
C
27 lines
628 B
C
#include "gtest/gtest.h"
|
|
extern "C" {
|
|
#include "BaseObj.h"
|
|
#include "dataMemory.h"
|
|
#include "dataStack.h"
|
|
}
|
|
static int mem;
|
|
|
|
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);
|
|
}
|