1 #include "parser.hpp" 2 #include "types.hpp" 3 #include "utility/json_utility.hpp" 4 5 #include <iostream> 6 7 #include <gtest/gtest.h> 8 9 using namespace vpd; 10 11 TEST(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 21 TEST(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 } 30