mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 20:56:02 +00:00
- Move cpinfo related code out of pal.h and into getcpinfo.h - Use static cpinfo struct (not pointer) in test and pass address - Whitespace cleanup
35 lines
841 B
C++
35 lines
841 B
C++
//! @file test-getcpinfo.cpp
|
|
//! @author Aaron Ktaz <v-aakatz@microsoft.com>
|
|
//! @brief Implements Unit test for GetCPInfoW
|
|
|
|
#include <gtest/gtest.h>
|
|
#include "getcpinfo.h"
|
|
|
|
TEST(GetCPInfo, CodePageIsUTF8)
|
|
{
|
|
CPINFO cpinfo;
|
|
BOOL result = GetCPInfoW(const_cpinfo::UTF8, &cpinfo);
|
|
|
|
// first make sure that the function worked
|
|
ASSERT_EQ(TRUE, result);
|
|
|
|
// now compare the actual values
|
|
EXPECT_EQ(cpinfo.DefaultChar[0], '?');
|
|
EXPECT_EQ(cpinfo.DefaultChar[1], '0');
|
|
EXPECT_EQ(cpinfo.MaxCharSize, 4);
|
|
|
|
for (int i = 0; i < const_cpinfo::MAX_LEADBYTES; i++)
|
|
{
|
|
EXPECT_EQ(cpinfo.LeadByte[i], '0');
|
|
}
|
|
}
|
|
|
|
TEST(GetCPInfo, CodePageIsNotUTF8)
|
|
{
|
|
CPINFO cpinfo;
|
|
BOOL result = GetCPInfoW(const_cpinfo::UTF8+1, &cpinfo);
|
|
|
|
ASSERT_EQ(FALSE, result);
|
|
ASSERT_EQ(ERROR_INVALID_PARAMETER, errno);
|
|
}
|