blob: 059b18b457cfa8a2432d7c46b81edacd15737fd0 [file] [log] [blame]
#include <TachSensor.hpp>
#include <Thresholds.hpp>
#include <dbus/connection.hpp>
#include <nlohmann/json.hpp>
#include <fstream>
#include "gtest/gtest.h"
TEST(TachSensor, TestTachSensor)
{
boost::asio::io_service io;
auto system_bus =
std::make_shared<dbus::connection>(io, dbus::bus::session);
dbus::DbusObjectServer object_server(system_bus);
std::vector<thresholds::Threshold> sensor_thresholds;
auto t = thresholds::Threshold(thresholds::Level::CRITICAL,
thresholds::Direction::LOW, 1000);
sensor_thresholds.emplace_back(t);
std::ofstream test_file("test.txt");
test_file << "10000\n";
test_file.close();
auto filename = std::string("test.txt");
auto fanname = std::string("test fan");
TachSensor test(filename, object_server, system_bus, io, fanname,
std::move(sensor_thresholds));
std::remove("test.txt");
}