blob: 4f0b5c5ce5b69024e2d6a5db2e07f02b707cbf9b [file] [log] [blame]
Sunny Srivastavafa5e4d32023-03-12 11:59:49 -05001#include "parser.hpp"
2#include "types.hpp"
3#include "utility/json_utility.hpp"
4
5#include <iostream>
6
7#include <gtest/gtest.h>
8
9using namespace vpd;
10
11TEST(IsFruPowerOffOnlyTest, PositiveTestCase)
12{
13 const std::string l_jsonPath{"/usr/local/share/vpd/50001001.json"};
14 const std::string l_vpdPath{"/sys/bus/spi/drivers/at25/spi12.0/eeprom"};
15 const nlohmann::json l_parsedJson = jsonUtility::getParsedJson(l_jsonPath);
16 const bool l_result =
17 jsonUtility::isFruPowerOffOnly(l_parsedJson, l_vpdPath);
18 EXPECT_TRUE(l_result);
19}
20
21TEST(IsFruPowerOffOnlyTest, NegativeTestCase)
22{
23 const std::string l_jsonPath{"/usr/local/share/vpd/50001001.json"};
24 const std::string l_vpdPath{"/sys/bus/i2c/drivers/at24/4-0050/eeprom"};
25 const nlohmann::json l_parsedJson = jsonUtility::getParsedJson(l_jsonPath);
26 const bool l_result =
27 jsonUtility::isFruPowerOffOnly(l_parsedJson, l_vpdPath);
28 EXPECT_FALSE(l_result);
29}