Files
PowerShell/tests/test-getcomputername.cpp
T

27 lines
697 B
C++
Raw Normal View History

//! @file test-getcomputername.cpp
2015-10-27 15:33:25 -07:00
//! @author George Fleming <v-geflem@microsoft.com>
//! @brief Unit tests for GetComputerName
#include <string>
#include <unistd.h>
#include <gtest/gtest.h>
#include "getcomputername.h"
//! Test fixture for GetComputerNameTest
2015-08-13 10:53:09 -07:00
class GetComputerNameTest : public ::testing::Test
{
protected:
2015-10-27 09:19:41 -07:00
char expectedComputerName[HOST_NAME_MAX];
//Get expected result from using linux call
2015-08-13 10:53:09 -07:00
GetComputerNameTest()
2015-08-17 17:02:40 -07:00
{
2015-10-27 09:19:41 -07:00
BOOL ret = gethostname(expectedComputerName, HOST_NAME_MAX);
EXPECT_EQ(0, ret);
}
};
2015-10-27 15:33:25 -07:00
TEST_F(GetComputerNameTest, ValidateLinuxGetHostnameSystemCall)
2015-08-13 10:53:09 -07:00
{
2015-10-27 10:48:31 -07:00
ASSERT_STREQ(GetComputerName(), expectedComputerName);
2015-07-30 12:47:10 -07:00
}