ztp/unit_test/test/json_test.cpp

41 lines
625 B
C++
Raw Normal View History

//
// Created by xajhu on 2019/11/29 0029.
//
#include <iostream>
using namespace std;
#include "gtest/gtest.h"
extern "C" {
#include "json_interface.h"
}
TEST(json_encode_test, retOK)
{
int ret = 0;
const char *pJson;
AUTH_ZTH_REQ ztpReq;
memset(&ztpReq, 0, sizeof(AUTH_ZTH_REQ));
ztpReq.pESN = (char*)"ace08484843";
pJson = Struct2Json(&ztpReq, JE_AUTH_ZTP, false, &ret);
if(pJson) {
free((void *)pJson);
}
ASSERT_EQ(0,ret);
}
auto main(int argc, char* argv[]) -> int
{
int ret;
testing::InitGoogleTest(&argc, argv);
ret = RUN_ALL_TESTS();
return 0;
}