1 #include <gtest/gtest.h>
6 // The fixture for testing paths functions.
7 class CharsetsTest : public testing::Test
10 // You can remove any or all of the following functions if its body
15 // You can do set-up work for each test here.
18 virtual ~CharsetsTest()
20 // You can do clean-up work that doesn't throw exceptions here.
23 // If the constructor and destructor are not enough for setting up
24 // and cleaning up each test, you can define the following methods:
28 // Code here will be called immediately after the constructor (right
32 virtual void TearDown()
34 // Code here will be called immediately after each test (right
35 // before the destructor).
38 // Objects declared here can be used by all tests in the test case for Foo.
41 TEST_F(CharsetsTest, name_to_codepage)
43 EXPECT_EQ(65001, GetEncodingCodePageFromId(GetEncodingIdFromName("UTF-8")));
44 EXPECT_EQ(65001, GetEncodingCodePageFromName("utf-8"));
45 EXPECT_EQ(0, GetEncodingIdFromName("abc"));
46 EXPECT_EQ(0, GetEncodingCodePageFromId(GetEncodingIdFromName("abc")));
47 EXPECT_EQ(0, GetEncodingCodePageFromName("abc"));
50 TEST_F(CharsetsTest, codepage_to_name)
52 EXPECT_EQ("utf-8", GetEncodingNameFromId(GetEncodingIdFromCodePage(65001)));
53 EXPECT_EQ("utf-8", GetEncodingNameFromCodePage(65001));
54 EXPECT_EQ(0, GetEncodingNameFromId(GetEncodingIdFromCodePage(99999)));
55 EXPECT_EQ(NULL, GetEncodingNameFromCodePage(99999));