From c9c9e84b1b132c9995f13e850ebf6b90d6271092 Mon Sep 17 00:00:00 2001 From: Vladimir Paramuzov Date: Wed, 29 Jan 2025 13:27:13 +0400 Subject: [PATCH] removed json dep in unit tests Signed-off-by: Vladimir Paramuzov --- src/inference/tests/unit/config_test.cpp | 29 +++++------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/src/inference/tests/unit/config_test.cpp b/src/inference/tests/unit/config_test.cpp index adde70c139b96d..682ee50eb81c79 100644 --- a/src/inference/tests/unit/config_test.cpp +++ b/src/inference/tests/unit/config_test.cpp @@ -12,9 +12,9 @@ #include #include -#include #include #include +#include using namespace ::testing; using namespace ov; @@ -35,25 +35,13 @@ namespace { const std::string test_config_path = "test_debug_config_path.json"; const std::string device_name = "SOME_DEVICE"; -void dump_config(const std::string& filename, const std::map& config) { - nlohmann::json jsonConfig; - for (const auto& item : config) { - std::string deviceName = item.first; - for (const auto& option : item.second) { - // primary property - std::stringstream strm; - option.second.print(strm); - auto property_string = strm.str(); - jsonConfig[deviceName][option.first] = property_string; - } - } - +void dump_config(const std::string& filename, const std::string& config_content) { std::ofstream ofs(filename); if (!ofs.is_open()) { - throw std::runtime_error("Can't load config file \"" + filename + "\"."); + throw std::runtime_error("Can't save config file \"" + filename + "\"."); } - ofs << jsonConfig; + ofs << config_content; } } // namespace @@ -320,14 +308,9 @@ TEST(plugin_config, can_read_from_config) { const std::filesystem::path filepath = test_config_path; try { NotEmptyTestConfig cfg; - ov::AnyMap config { - int_property(10), - #ifdef ENABLE_DEBUG_CAPS - debug_property(20), - #endif - }; + std::string config = "{\"SOME_DEVICE\":{\"DEBUG_PROPERTY\":\"20\",\"INT_PROPERTY\":\"10\"}}"; - dump_config(filepath.generic_string(), {{device_name, config }}); + dump_config(filepath.generic_string(), config); ASSERT_EQ(cfg.get_int_property(), -1); // config is applied after finalization only for build with debug caps #ifdef ENABLE_DEBUG_CAPS