mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
changed spacing and using std::string instead of TCHAR
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
|
||||
BOOL GetComputerName(LPTSTR name, LPDWORD len)
|
||||
{
|
||||
int host = gethostname(name, HOST_NAME_MAX);
|
||||
if(host == 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
int host = gethostname(name, HOST_NAME_MAX);
|
||||
if(host == 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -4,25 +4,24 @@
|
||||
TEST(GetComputerName,simple)
|
||||
{
|
||||
char hostname[HOST_NAME_MAX];
|
||||
TCHAR hostnameFunctionTest[HOST_NAME_MAX];
|
||||
std::string hostnameFunctionTest;
|
||||
DWORD hostSize = HOST_NAME_MAX;
|
||||
|
||||
BOOL getComputerName = GetComputerName(hostnameFunctionTest, &hostSize);
|
||||
BOOL getComputerName = GetComputerName(&hostnameFunctionTest[0], &hostSize);
|
||||
BOOL host = gethostname(hostname, sizeof hostname);
|
||||
|
||||
if(host == 0)
|
||||
{
|
||||
host = TRUE;
|
||||
host = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
host = FALSE;
|
||||
host = FALSE;
|
||||
}
|
||||
|
||||
std::string hostnameSting(hostname);
|
||||
std::string hostnameStingTest(hostnameFunctionTest);
|
||||
std::string hostnameString(hostname);
|
||||
std::string hostnameStringTest(&hostnameFunctionTest[0]);
|
||||
|
||||
ASSERT_TRUE(getComputerName == TRUE);
|
||||
ASSERT_EQ(host,TRUE);
|
||||
ASSERT_EQ(hostnameSting,hostnameFunctionTest);
|
||||
ASSERT_EQ(hostnameString,hostnameStringTest);
|
||||
}
|
||||
Reference in New Issue
Block a user