增加了udp的测试代码,增加了时间获取函数,完善了ccu发送指令的函数
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#include "../src/pPowerManger/udpComm.h"
|
||||
#include "catch2/catch.hpp"
|
||||
#include <iostream>
|
||||
|
||||
TEST_CASE("udpComm getDate function test", "[udpComm]") {
|
||||
udpComm comm;
|
||||
|
||||
unsigned short year;
|
||||
unsigned char month, day, hour, minute, second, milliseconds;
|
||||
|
||||
bool result = comm.getDate(year, month, day, hour, minute, second, milliseconds);
|
||||
|
||||
// 输出日期和时间信息
|
||||
std::cout << "Year: " << year << std::endl;
|
||||
std::cout << "Month: " << static_cast<int>(month) << std::endl;
|
||||
std::cout << "Day: " << static_cast<int>(day) << std::endl;
|
||||
std::cout << "Hour: " << static_cast<int>(hour) << std::endl;
|
||||
std::cout << "Minute: " << static_cast<int>(minute) << std::endl;
|
||||
std::cout << "Second: " << static_cast<int>(second) << std::endl;
|
||||
std::cout << "Milliseconds: " << static_cast<int>(milliseconds) << std::endl;
|
||||
|
||||
REQUIRE(result == true);
|
||||
REQUIRE(year >= 2023);
|
||||
REQUIRE(year <= 2030);
|
||||
REQUIRE(month >= 1);
|
||||
REQUIRE(month <= 12);
|
||||
REQUIRE(day >= 1);
|
||||
REQUIRE(day <= 31);
|
||||
REQUIRE(hour >= 0);
|
||||
REQUIRE(hour <= 23);
|
||||
REQUIRE(minute >= 0);
|
||||
REQUIRE(minute <= 59);
|
||||
REQUIRE(second >= 0);
|
||||
REQUIRE(second <= 59);
|
||||
REQUIRE(milliseconds >= 0);
|
||||
REQUIRE(milliseconds <= 999);
|
||||
}
|
||||
Reference in New Issue
Block a user