* Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
* MindIE is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
#include <common_util.h>
#include <env_util.h>
#include <gtest/gtest.h>
#include <unistd.h>
#include <algorithm>
#include <chrono>
#include <climits>
#include <iomanip>
#include <map>
#include <mockcpp/mockcpp.hpp>
#include <nlohmann/json.hpp>
#include <set>
#include <sstream>
#include <string>
#include <thread>
#include <vector>
#include "file_system.h"
using Json = nlohmann::json;
namespace mindie_llm {
class CommonUtilsTest : public ::testing::Test {
public:
std::string configPath_;
const char* mindieLlmPath;
const char* mindieMiesPath;
protected:
void SetUp() override {
setenv("MINDIE_LLM_HOME_PATH", MINDIE_LLM_HOME_PATH_TEST, 1);
const char* mindieLlmPathEnv = getenv("MINDIE_LLM_HOME_PATH");
if (mindieLlmPathEnv != nullptr) {
mindieLlmPath = mindieLlmPathEnv;
}
setenv("MIES_INSTALL_PATH", MINDIE_LLM_HOME_PATH_TEST, 1);
const char* mindieMiesPathEnv = getenv("MIES_INSTALL_PATH");
if (mindieMiesPathEnv != nullptr) {
mindieMiesPath = mindieMiesPathEnv;
}
SetConfigPath();
}
void TearDown() override {}
void SetConfigPath() {
std::string homePath;
GetLlmPath(homePath);
configPath_ = homePath + "/conf/config.json";
}
};
TEST_F(CommonUtilsTest, TestGetDurationSuccess) {
auto start = std::chrono::steady_clock::now();
std::this_thread::sleep_for(std::chrono::milliseconds(100));
auto end = std::chrono::steady_clock::now();
size_t duration = GetDuration(end, start);
EXPECT_GE(duration, static_cast<size_t>(100));
}
TEST_F(CommonUtilsTest, TestGetCurTimeSuccess) {
std::string timeStr = GetCurTime();
auto now = std::chrono::system_clock::now();
std::time_t nowC = std::chrono::system_clock::to_time_t(now);
tm* parts = std::localtime(&nowC);
std::stringstream expectedTime;
expectedTime << std::put_time(parts, "%Y-%m-%d %H:%M:%S");
constexpr size_t dataStart = 0;
constexpr size_t dataEnd = 10;
constexpr size_t timeStart = 11;
constexpr size_t timeEnd = 5;
EXPECT_EQ(timeStr.substr(dataStart, dataEnd), expectedTime.str().substr(dataStart, dataEnd));
EXPECT_EQ(timeStr.substr(timeStart, timeEnd), expectedTime.str().substr(timeStart, timeEnd));
}
TEST_F(CommonUtilsTest, TestSplitByBasicStrSuccess) {
std::string splitStr = "llm,service";
char delim = ',';
std::vector<std::string> result = Split(splitStr, delim);
constexpr size_t expectedSize = 2;
ASSERT_EQ(result.size(), static_cast<size_t>(expectedSize));
EXPECT_EQ(result[0], "llm");
EXPECT_EQ(result[1], "service");
}
TEST_F(CommonUtilsTest, TestSplitBySingleStrSuccess) {
std::string splitStr = "llm";
char delim = ',';
std::vector<std::string> result = Split(splitStr, delim);
ASSERT_EQ(result.size(), static_cast<size_t>(1));
EXPECT_EQ(result[0], "llm");
}
TEST_F(CommonUtilsTest, TestSplitByEmptyStrSuccess) {
std::string splitStr = "";
char delim = ',';
std::vector<std::string> result = Split(splitStr, delim);
ASSERT_EQ(result.size(), static_cast<size_t>(0));
}
TEST_F(CommonUtilsTest, TestCanonicalPathByEmptyPathFail) {
std::string path = "";
EXPECT_FALSE(CanonicalPath(path));
}
TEST_F(CommonUtilsTest, TestCanonicalByValidPathSuccess) {
const char* homePath = getenv("HOME");
if (homePath != nullptr) {
std::string path = homePath;
bool result = CanonicalPath(path);
EXPECT_TRUE(result);
EXPECT_EQ(path, homePath);
}
}
TEST_F(CommonUtilsTest, TestCanonicalByPathTooLongFail) {
std::string path(PATH_MAX + 1, 'a');
EXPECT_FALSE(CanonicalPath(path));
}
TEST_F(CommonUtilsTest, TestGetHomePathSuccess) {
std::string homePath;
Error result = GetHomePath(homePath);
EXPECT_TRUE(result.IsOk());
}
TEST_F(CommonUtilsTest, TestGetLlmPathSuccess) {
std::string llmPath;
Error result = GetLlmPath(llmPath);
EXPECT_TRUE(result.IsOk());
}
TEST_F(CommonUtilsTest, TestGetLlmPathByInvalidEnvFail) {
EnvUtil::GetInstance().SetEnvVar("MIES_INSTALL_PATH", "");
std::string llmPath;
Error result = GetLlmPath(llmPath);
EnvUtil::GetInstance().SetEnvVar("MIES_INSTALL_PATH", MINDIE_LLM_HOME_PATH_TEST);
EXPECT_FALSE(result.IsOk());
}
TEST_F(CommonUtilsTest, TestIsNumberByEmptyStringFail) { EXPECT_FALSE(IsNumber("")); }
TEST_F(CommonUtilsTest, TestIsNumberByValidNumberSuccess) {
EXPECT_TRUE(IsNumber("123"));
EXPECT_TRUE(IsNumber("-123"));
EXPECT_TRUE(IsNumber("0"));
}
TEST_F(CommonUtilsTest, TestIsNumberByInvalidNumberFail) {
EXPECT_FALSE(IsNumber("123a"));
EXPECT_FALSE(IsNumber("-123a"));
EXPECT_FALSE(IsNumber("12 3"));
EXPECT_FALSE(IsNumber(" 123"));
}
TEST_F(CommonUtilsTest, TestGetConfigPathWithoutEnvSuccess) {
std::string outConfigPath;
Error result = GetConfigPath(outConfigPath);
EXPECT_TRUE(result.IsOk());
}
TEST_F(CommonUtilsTest, TestGetConfigPathWithEnvSuccess) {
setenv("MIES_CONFIG_JSON_PATH", configPath_.c_str(), 1);
std::string outConfigPath;
Error result = GetConfigPath(outConfigPath);
unsetenv("MIES_CONFIG_JSON_PATH");
EXPECT_TRUE(result.IsOk());
}
TEST_F(CommonUtilsTest, TestGetModelInfoSuccess) {
std::string modelName;
size_t serverCount = 0;
size_t tp = 0;
GetModelInfo(configPath_, modelName, tp, serverCount);
EXPECT_EQ(modelName, "llama_65b");
}
TEST_F(CommonUtilsTest, TestCheckSystemConfigSuccess) {
Json backendJsonData;
bool result = CheckSystemConfig(configPath_, backendJsonData, "BackendConfig");
EXPECT_TRUE(result);
}
TEST_F(CommonUtilsTest, TestTrimSpaceSuccess) {
EXPECT_EQ(mindie_llm::TrimSpace(" hello world "), "hello world");
EXPECT_EQ(mindie_llm::TrimSpace(" hello"), "hello");
EXPECT_EQ(mindie_llm::TrimSpace("hello "), "hello");
EXPECT_EQ(mindie_llm::TrimSpace("hello"), "hello");
EXPECT_EQ(mindie_llm::TrimSpace(" "), "");
EXPECT_EQ(mindie_llm::TrimSpace(""), "");
}
TEST_F(CommonUtilsTest, TestToLowerSuccess) {
EXPECT_EQ(mindie_llm::ToLower("HELLO WORLD"), "hello world");
EXPECT_EQ(mindie_llm::ToLower("Hello123"), "hello123");
EXPECT_EQ(mindie_llm::ToLower("hello"), "hello");
EXPECT_EQ(mindie_llm::ToLower(""), "");
}
TEST_F(CommonUtilsTest, TestToUpperSuccess) {
EXPECT_EQ(mindie_llm::ToUpper("hello world"), "HELLO WORLD");
EXPECT_EQ(mindie_llm::ToUpper("Hello123"), "HELLO123");
EXPECT_EQ(mindie_llm::ToUpper("HELLO"), "HELLO");
EXPECT_EQ(mindie_llm::ToUpper(""), "");
}
TEST_F(CommonUtilsTest, TestGetHostIPSuccess) {
std::vector<std::string> ips = mindie_llm::GetHostIP(true);
EXPECT_FALSE(ips.empty());
std::vector<std::string> ipsWithLoopback = mindie_llm::GetHostIP(false);
EXPECT_FALSE(ipsWithLoopback.empty());
}
TEST_F(CommonUtilsTest, TestGetBinaryPathSuccess) {
std::string binaryPath;
bool result = mindie_llm::GetBinaryPath(binaryPath);
EXPECT_TRUE(result);
EXPECT_FALSE(binaryPath.empty());
}
TEST_F(CommonUtilsTest, TestJoinStringsSuccess) {
std::vector<std::string> strings = {"hello", "world", "test"};
std::string result = mindie_llm::JoinStrings(strings, ",");
EXPECT_EQ(result, "hello,world,test");
std::vector<std::string> emptyStrings;
std::string emptyResult = mindie_llm::JoinStrings(emptyStrings, ",");
EXPECT_EQ(emptyResult, "");
std::vector<std::string> singleString = {"hello"};
std::string singleResult = mindie_llm::JoinStrings(singleString, ",");
EXPECT_EQ(singleResult, "hello");
}
TEST_F(CommonUtilsTest, TestRandomNumberSuccess) {
uint32_t maxNumber = 100;
uint32_t randomNum = mindie_llm::RandomNumber(maxNumber);
EXPECT_LE(randomNum, maxNumber);
uint32_t zeroResult = mindie_llm::RandomNumber(0);
EXPECT_EQ(zeroResult, 0);
}
TEST_F(CommonUtilsTest, TestSerializeSetSuccess) {
std::set<uint32_t> testSet = {1, 2, 3, 5, 8};
std::string serialized = mindie_llm::SerializeSet(testSet);
EXPECT_EQ(serialized, "1,2,3,5,8");
std::set<uint32_t> emptySet;
std::string emptySerialized = mindie_llm::SerializeSet(emptySet);
EXPECT_EQ(emptySerialized, "");
std::set<uint32_t> singleSet = {42};
std::string singleSerialized = mindie_llm::SerializeSet(singleSet);
EXPECT_EQ(singleSerialized, "42");
}
TEST_F(CommonUtilsTest, TestDeserializeSetSuccess) {
std::string data = "1,2,3,5,8";
std::set<size_t> result = mindie_llm::DeserializeSet(data);
std::set<size_t> expected = {1, 2, 3, 5, 8};
EXPECT_EQ(result, expected);
std::set<size_t> emptyResult = mindie_llm::DeserializeSet("");
EXPECT_TRUE(emptyResult.empty());
std::set<size_t> singleResult = mindie_llm::DeserializeSet("42");
std::set<size_t> singleExpected = {42};
EXPECT_EQ(singleResult, singleExpected);
}
TEST_F(CommonUtilsTest, TestParsePortFromIpSuccess) {
uint32_t port;
bool result = mindie_llm::ParsePortFromIp("192.168.1.1;8080", port);
EXPECT_TRUE(result);
EXPECT_EQ(port, 8080);
bool noPortResult = mindie_llm::ParsePortFromIp("192.168.1.1", port);
EXPECT_FALSE(noPortResult);
}
TEST_F(CommonUtilsTest, TestReverseDpInstIdSuccess) {
uint64_t dpInstanceId = 1234500067;
auto result = mindie_llm::ReverseDpInstId(dpInstanceId);
EXPECT_EQ(result.first, 123450);
EXPECT_EQ(result.second, 67);
}
TEST_F(CommonUtilsTest, TestCleanStringForJsonSuccess) {
std::string normalStr = "Hello World";
std::string cleaned = mindie_llm::CleanStringForJson(normalStr);
EXPECT_EQ(cleaned, "Hello World");
std::string controlStr = "Hello\x01World\x02";
std::string controlCleaned = mindie_llm::CleanStringForJson(controlStr);
EXPECT_EQ(controlCleaned, "HelloWorld");
std::string newlineStr = "Hello\nWorld\r\nTest";
std::string newlineCleaned = mindie_llm::CleanStringForJson(newlineStr);
EXPECT_EQ(newlineCleaned, "Hello\nWorld\r\nTest");
std::string emptyCleaned = mindie_llm::CleanStringForJson("");
EXPECT_EQ(emptyCleaned, "");
}
TEST_F(CommonUtilsTest, TestIsFloatEqualsSuccess) {
EXPECT_TRUE(mindie_llm::IsFloatEquals(1.0f, 1.0f));
EXPECT_TRUE(mindie_llm::IsFloatEquals(1.0f, 1.000001f));
EXPECT_FALSE(mindie_llm::IsFloatEquals(1.0f, 1.1f));
EXPECT_TRUE(mindie_llm::IsFloatEquals(0.0f, 0.0f));
EXPECT_TRUE(mindie_llm::IsFloatEquals(-1.0f, -1.0f));
}
TEST_F(CommonUtilsTest, TestSplitStringSuccess) {
std::string testStr = "hello,world,test";
std::vector<std::string> result = mindie_llm::SplitString(testStr, ',');
std::vector<std::string> expected = {"hello", "world", "test"};
EXPECT_EQ(result, expected);
std::vector<std::string> emptyResult = mindie_llm::SplitString("", ',');
EXPECT_TRUE(emptyResult.empty());
std::vector<std::string> noDelimResult = mindie_llm::SplitString("hello", ',');
std::vector<std::string> noDelimExpected = {"hello"};
EXPECT_EQ(noDelimResult, noDelimExpected);
}
TEST_F(CommonUtilsTest, TestSplitPathSuccess) {
std::string path = "/usr/local/bin";
std::vector<std::string> result = mindie_llm::SplitPath(path);
std::vector<std::string> expected = {"usr", "local", "bin"};
EXPECT_EQ(result, expected);
std::vector<std::string> rootResult = mindie_llm::SplitPath("/");
EXPECT_TRUE(rootResult.empty());
std::vector<std::string> relativeResult = mindie_llm::SplitPath("usr/local");
std::vector<std::string> relativeExpected = {"usr", "local"};
EXPECT_EQ(relativeResult, relativeExpected);
}
TEST_F(CommonUtilsTest, TestAbsoluteToAnonymousPathSuccess) {
std::string path = "/usr/local/bin";
std::string result = mindie_llm::AbsoluteToAnonymousPath(path);
EXPECT_EQ(result, "/******/******/bin");
std::string relativePath = "usr/local/bin";
std::string relativeResult = mindie_llm::AbsoluteToAnonymousPath(relativePath);
EXPECT_EQ(relativeResult, "");
std::string rootResult = mindie_llm::AbsoluteToAnonymousPath("/");
EXPECT_EQ(rootResult, "/");
std::string singleResult = mindie_llm::AbsoluteToAnonymousPath("/usr");
EXPECT_EQ(singleResult, "/******");
}
TEST_F(CommonUtilsTest, TestAbsoluteToRelativePathSuccess) {
std::string absPath = "/usr/local/bin/test";
std::string absDir = "/usr/local";
std::string result = mindie_llm::AbsoluteToRelativePath(absPath, absDir);
EXPECT_EQ(result, "/******/******/bin/test");
std::string emptyResult = mindie_llm::AbsoluteToRelativePath("", "/usr");
EXPECT_TRUE(emptyResult.empty());
std::string mismatchResult = mindie_llm::AbsoluteToRelativePath("/usr/local/bin", "/opt");
EXPECT_TRUE(mismatchResult.find("******") != std::string::npos);
}
TEST_F(CommonUtilsTest, TestVectorToStringSuccess) {
std::vector<int> intVec = {1, 2, 3, 4, 5};
std::string result = mindie_llm::VectorToString(intVec);
EXPECT_EQ(result, "[1, 2, 3, 4, 5]");
std::vector<std::string> strVec = {"hello", "world"};
std::string strResult = mindie_llm::VectorToString(strVec);
EXPECT_EQ(strResult, "[hello, world]");
std::vector<int> emptyVec;
std::string emptyResult = mindie_llm::VectorToString(emptyVec);
EXPECT_EQ(emptyResult, "[]");
}
TEST_F(CommonUtilsTest, TestMapToStringSuccess) {
std::map<int, std::string> testMap = {{1, "one"}, {2, "two"}};
std::string result = mindie_llm::MapToString(testMap);
EXPECT_TRUE(result.find("1: one") != std::string::npos);
EXPECT_TRUE(result.find("2: two") != std::string::npos);
std::map<int, std::vector<std::string>> complexMap = {{1, {"a", "b"}}, {2, {"c", "d"}}};
std::string complexResult = mindie_llm::MapToString(complexMap);
EXPECT_TRUE(complexResult.find("1: [a, b]") != std::string::npos);
EXPECT_TRUE(complexResult.find("2: [c, d]") != std::string::npos);
}
TEST_F(CommonUtilsTest, TestMergeMapsSuccess) {
std::map<int, int> totalMap = {{1, 10}, {2, 20}};
std::map<int, int> subMap = {{1, 5}, {3, 30}};
mindie_llm::MergeMaps(totalMap, subMap);
EXPECT_EQ(totalMap[1], 15);
EXPECT_EQ(totalMap[2], 20);
EXPECT_EQ(totalMap[3], 30);
}
TEST_F(CommonUtilsTest, TestRemoveMapElementsSuccess) {
std::map<int, std::string> inputMap = {{1, "one"}, {2, "two"}, {3, "three"}};
std::vector<int> keysToRemove = {1, 3};
std::map<int, std::string> result = mindie_llm::RemoveMapElements(inputMap, keysToRemove);
EXPECT_EQ(result.size(), 1);
EXPECT_TRUE(result.find(2) != result.end());
EXPECT_EQ(result[2], "two");
}
TEST_F(CommonUtilsTest, TestCheckIPV4Success) {
EXPECT_TRUE(mindie_llm::CheckIPV4("192.168.1.1", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIPV4("10.0.0.1", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIPV4("172.16.0.1", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIPV4("127.0.0.1", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIPV4("255.255.255.255", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIPV4("0.0.0.0", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIPV4("0.0.0.0", "testIP", false));
}
TEST_F(CommonUtilsTest, TestCheckIPV4Fail) {
EXPECT_FALSE(mindie_llm::CheckIPV4("256.1.2.3", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIPV4("1.2.3.256", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIPV4("192.168.1", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIPV4("192.168.1.1.1", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIPV4("abc.def.ghi.jkl", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIPV4("192.168.001.001", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIPV4("", "testIP", true));
std::string longIP(33, '1');
longIP[3] = longIP[7] = longIP[11] = longIP[15] = '.';
EXPECT_FALSE(mindie_llm::CheckIPV4(longIP, "testIP", true));
}
TEST_F(CommonUtilsTest, TestCheckIPV6Success) {
EXPECT_TRUE(mindie_llm::CheckIPV6("::1", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIPV6("2001:db8::1", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIPV6("2001:db8:0:0:0:0:0:1", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIPV6("2001:db8::1:0:0:0:1", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIPV6("[2001:db8::1]", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIPV6("::", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIPV6("::", "testIP", false));
}
TEST_F(CommonUtilsTest, TestCheckIPV6Fail) {
EXPECT_FALSE(mindie_llm::CheckIPV6("2001:db8::1::1", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIPV6("2001:db8:g::1", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIPV6("2001:db8::1:", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIPV6(":2001:db8::1", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIPV6("2001:db8::1:1:1:1:1:1:1", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIPV6("", "testIP", true));
std::string longIP(129, '1');
EXPECT_FALSE(mindie_llm::CheckIPV6(longIP, "testIP", true));
}
TEST_F(CommonUtilsTest, TestCheckIpSuccess) {
EXPECT_TRUE(mindie_llm::CheckIp("192.168.1.1", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIp("10.0.0.1", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIp("127.0.0.1", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIp("::1", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIp("2001:db8::1", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIp("[2001:db8::1]", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIp("0.0.0.0", "testIP", true));
EXPECT_TRUE(mindie_llm::CheckIp("::", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("0.0.0.0", "testIP", false));
EXPECT_FALSE(mindie_llm::CheckIp("::", "testIP", false));
}
TEST_F(CommonUtilsTest, TestCheckIpFail) {
EXPECT_FALSE(mindie_llm::CheckIp("", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("localhost", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("example.com", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("192.168.1", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("2001:db8", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("256.1.2.3", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("192.168.001.001", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("2001:db8::1::1", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("2001:db8:g::1", "testIP", true));
}
TEST_F(CommonUtilsTest, TestCheckIpEdgeCases) {
EXPECT_FALSE(mindie_llm::CheckIp("192.168.1:8080", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("2001:db8.1.2.3", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("192.168.1.1@", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("2001:db8::1#", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp(" 192.168.1.1", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("192.168.1.1 ", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp(" 2001:db8::1 ", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("192.168.1.1:8080", "testIP", true));
EXPECT_FALSE(mindie_llm::CheckIp("[2001:db8::1]:8080", "testIP", true));
}
TEST_F(CommonUtilsTest, TestGetHomePathWhlPkgSuccess) {
std::string homePath;
auto existsMock = MOCKER(mindie_llm::FileSystem::Exists);
existsMock.stubs().with(any()).will(returnValue(true));
Error result = GetHomePath(homePath);
EXPECT_TRUE(result.IsOk());
}
}