清理:删除废弃代码与旧 WebUI 残留
- backup/:SQLiteDB 旧备份 - src/bck/:整个旧 pPowerManger 备份源码树 - src/appPowerMangerWebUI/:旧 crow WebUI(已从构建移除) - bin/static、bin/templates:旧 crow WebUI 运行时资源 - test/SQLiteDBTest.cpp、test/udpCommTest.cpp:未参与编译,已被 test/until 取代
This commit is contained in:
@@ -1,65 +0,0 @@
|
||||
#include "catch2/catch.hpp"
|
||||
#include "../src/pPowerManger/SQLiteDB.h"
|
||||
#include "../src/pPowerManger/driver.h"
|
||||
|
||||
TEST_CASE("SQLiteDB Test", "[SQLiteDB]") {
|
||||
SQLiteDB db("test.db");
|
||||
|
||||
SECTION("Create Tables") {
|
||||
REQUIRE(db.createPowerDataTables() == true);
|
||||
// REQUIRE(db.createStateTables() == true);
|
||||
REQUIRE(db.createDisCcuSysTables() == true);
|
||||
REQUIRE(db.createDriversTables("test") == true);
|
||||
|
||||
}
|
||||
|
||||
SECTION("Test isDatabaseConnected") {
|
||||
REQUIRE(db.isDatabaseConnected("/home/zjk/project/H100/H100PowerManger/bin","test.db") == true);
|
||||
}
|
||||
|
||||
SECTION("Test insertPowerData") {
|
||||
PowerData powerData;
|
||||
StateData stateData;
|
||||
stateData.state_id = 1;
|
||||
stateData.state_name = "test";
|
||||
stateData.event = "test";
|
||||
stateData.event_id = 1;
|
||||
stateData.fault_code = 1;
|
||||
stateData.note = "test";
|
||||
REQUIRE(db.insertStateData(stateData) == true);
|
||||
// db.insertPowerData(powerData);
|
||||
|
||||
StateData stateDataForGet;
|
||||
REQUIRE(db.getStateData(stateDataForGet) == true);
|
||||
REQUIRE(stateDataForGet.state_id == 1);
|
||||
REQUIRE(stateDataForGet.state_name == "test");
|
||||
REQUIRE(stateDataForGet.event == "test");
|
||||
REQUIRE(stateDataForGet.event_id == 1);
|
||||
REQUIRE(stateDataForGet.fault_code == 1);
|
||||
REQUIRE(stateDataForGet.note == "test");
|
||||
|
||||
//REQUIRE(db.clearPowerData(stateDataForGet) == true);
|
||||
}
|
||||
|
||||
SECTION("Test insertStateData") {
|
||||
|
||||
for(int i = 0; i < 100; i++)
|
||||
{ DriverTable driver;
|
||||
REQUIRE(db.insertDriverTables(driver,"test") == true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SECTION("Test GETDATA") {
|
||||
StateData stateData;
|
||||
std::string time;
|
||||
REQUIRE(db.getStateData(stateData,time) == true);
|
||||
REQUIRE(db.getStateData(stateData) == true);
|
||||
REQUIRE(stateData.state_id == 1);
|
||||
REQUIRE(stateData.state_name == "test");
|
||||
cout << "-------------------------------------------------" << time << endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
#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