blob: 6ecb79d74e53bef6cf86aff22758beeaada40d0b [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
Ed Tanous8a57ec02020-10-09 12:46:52 -07008#include <gtest/gtest.h>
James Feist6714a252018-09-10 15:26:18 -07009
10TEST(TachSensor, TestTachSensor)
11{
12 boost::asio::io_service io;
Patrick Williams92f8f512022-07-22 19:26:55 -050013 auto system_bus = std::make_shared<dbus::connection>(io, dbus_t::session);
James Feist6714a252018-09-10 15:26:18 -070014 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}