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