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