Mod aaa-12 1. 添加gtest主程序文件

RCA:
SOL:
修改人:huangxin
检视人:huangxin
This commit is contained in:
huangxin 2019-12-03 15:04:34 +08:00
parent d32d08039b
commit ad92219248
4 changed files with 20 additions and 13 deletions

View File

@ -12,21 +12,19 @@ extern "C" {
#include "ztp_config.h"
}
TEST(config_file_test, ztpConfig)
TEST(config_file_test, load_ztpConfig)
{
int ret = init_configure("../../ztp.conf");
ASSERT_EQ(ERR_OK, ret);
PZTP_CONFIG pZtpCfg = get_ztp_configure();
ASSERT_STREQ(pZtpCfg->svr_cfg.server_url, "cmhi.ztp.com");
ASSERT_STREQ(pZtpCfg->dev_dir, "dev_confs");
ASSERT_EQ(10082, pZtpCfg->svr_cfg.port);
}
TEST(config_file_test, devConfig)
TEST(config_file_test, load_devConfig)
{
int ret = init_configure("../../ztp.conf");
ASSERT_EQ(ERR_OK, ret);
@ -46,4 +44,3 @@ TEST(config_file_test, devConfig)
ASSERT_STREQ(pDevCfg->lan_config.ip_addr, "192.168.1.1");
ASSERT_STREQ(pDevCfg->lan_config.netmask, "255.255.255.0");
}

View File

@ -57,9 +57,3 @@ TEST(json_test, decode)
ASSERT_EQ(0, ret);
}
auto main(int argc, char *argv[]) -> int
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

View File

@ -50,8 +50,6 @@ TEST(ztp_auth, authorized_success)
free(pZTPRsp->ip);
}
free(pZTPRsp);
}
}
@ -87,6 +85,7 @@ TEST(ztp_auth, unauthorized_failed)
if(pZTPRsp->ip) {
free(pZTPRsp->ip);
}
free(pZTPRsp);
}
}

View File

@ -0,0 +1,17 @@
//
// Created by xajhu on 2019/12/3 0003.
//
#include <iostream>
using namespace std;
#include "gtest/gtest.h"
auto main(int argc, char *argv[]) -> int
{
testing::GTEST_FLAG(repeat) = 1;
testing::GTEST_FLAG(break_on_failure) = true;
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}