blob: b28de93e86c7f2269ab2c4f5883a30754b646799 [file] [log] [blame]
James Feist6714a252018-09-10 15:26:18 -07001#include <TachSensor.hpp>
2#include <Thresholds.hpp>
3#include <dbus/connection.hpp>
James Feist582be092018-11-27 10:54:59 -08004#include <nlohmann/json.hpp>
5
James Feist38fb5982020-05-28 10:09:54 -07006#include <fstream>
7
James Feist6714a252018-09-10 15:26:18 -07008#include "gtest/gtest.h"
9
10TEST(TachSensor, TestTachSensor)
11{
12 boost::asio::io_service io;
13 auto system_bus =
14 std::make_shared<dbus::connection>(io, dbus::bus::session);
15 dbus::DbusObjectServer object_server(system_bus);
16
17 std::vector<thresholds::Threshold> sensor_thresholds;
18 auto t = thresholds::Threshold(thresholds::Level::CRITICAL,
19 thresholds::Direction::LOW, 1000);
20 sensor_thresholds.emplace_back(t);
21
22 std::ofstream test_file("test.txt");
23 test_file << "10000\n";
24 test_file.close();
25 auto filename = std::string("test.txt");
26 auto fanname = std::string("test fan");
27 TachSensor test(filename, object_server, system_bus, io, fanname,
28 std::move(sensor_thresholds));
29 std::remove("test.txt");
30}