mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
debuging args
This commit is contained in:
parent
50023da3aa
commit
9b700cbe47
@ -1 +1 @@
|
||||
Subproject commit 2188f240790522bf50a5e7788b5d40e66c126c4f
|
||||
Subproject commit 8b2428ce8189107eef2aa4871992c40e50e39f50
|
49
src/test/arg-test.cpp
Normal file
49
src/test/arg-test.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
#include "gtest/gtest.h"
|
||||
extern "C"
|
||||
{
|
||||
#include "dataArg.h"
|
||||
#include "dataString.h"
|
||||
}
|
||||
static int mem;
|
||||
extern DMEM_STATE DMEMS;
|
||||
|
||||
TEST(arg_test, int_)
|
||||
{
|
||||
Arg *arg = New_arg(NULL);
|
||||
arg_setInt(arg, 1);
|
||||
int a = arg_getInt(arg);
|
||||
EXPECT_EQ(a, 1);
|
||||
arg_deinit(arg);
|
||||
EXPECT_EQ(DMEMS.heapUsed, 0);
|
||||
}
|
||||
|
||||
TEST(arg_test, float_)
|
||||
{
|
||||
Arg *arg = New_arg(NULL);
|
||||
arg_setFloat(arg, 1.01);
|
||||
float a = arg_getFloat(arg);
|
||||
EXPECT_EQ(a, (float)1.01);
|
||||
arg_deinit(arg);
|
||||
EXPECT_EQ(DMEMS.heapUsed, 0);
|
||||
}
|
||||
|
||||
TEST(arg_test, str_)
|
||||
{
|
||||
Arg *arg = New_arg(NULL);
|
||||
arg_setStr(arg, (char *)"test str");
|
||||
char *a = arg_getStr(arg);
|
||||
EXPECT_EQ(strEqu(a, (char *)"test str"), 1);
|
||||
arg_deinit(arg);
|
||||
EXPECT_EQ(DMEMS.heapUsed, 0);
|
||||
}
|
||||
|
||||
TEST(arg_test, ptr)
|
||||
{
|
||||
Arg *arg = New_arg(NULL);
|
||||
int a = 1;
|
||||
arg_setPtr(arg, &a);
|
||||
int *pa = (int *)arg_getPtr(arg);
|
||||
EXPECT_EQ(*pa, 1);
|
||||
arg_deinit(arg);
|
||||
EXPECT_EQ(DMEMS.heapUsed, 0);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user