Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ts-utf8.cpp « tests - github.com/windirstat/simpleini.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9208648cf3bf01639b9c92c802f37fed826b6f2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "pch.h"
#include "../SimpleIni.h"

class TestUTF8 : public ::testing::Test {
protected:
	void TestUTF8::SetUp() override;
protected:
	CSimpleIniA ini;
};

void TestUTF8::SetUp() {
	ini.SetUnicode();
	SI_Error err = ini.LoadFile("tests.ini");
	ASSERT_EQ(err, SI_OK);
}

TEST_F(TestUTF8, TestSectionAKeyAValA) {
	const char* result = ini.GetValue("section1", "key1");
	ASSERT_STREQ(result, "value1");
}

TEST_F(TestUTF8, TestSectionAKeyAValU) {
	const char tesuto2[] = u8"テスト2"; 
	const char* result = ini.GetValue("section2", "test2");
	ASSERT_STREQ(result, tesuto2);
}

TEST_F(TestUTF8, TestSectionAKeyUValA) {
	const char tesuto[] = u8"テスト";
	const char* result = ini.GetValue("section2", tesuto);
	ASSERT_STREQ(result, "test");
}

TEST_F(TestUTF8, TestSectionAKeyUValU) {
	const char tesuto2[] = u8"テスト2";
	const char tesutoni[] = u8"テスト二";
	const char* result = ini.GetValue("section2", tesuto2);
	ASSERT_STREQ(result, tesutoni);
}

TEST_F(TestUTF8, TestSectionUKeyAValA) {
	const char kensa[] = u8"検査";
	const char* result = ini.GetValue(kensa, "key2");
	ASSERT_STREQ(result, "value2");
}

TEST_F(TestUTF8, TestSectionUKeyAValU) {
	const char kensa[] = u8"検査";
	const char tesuto2[] = u8"テスト2";
	const char* result = ini.GetValue(kensa, "test2");
	ASSERT_STREQ(result, tesuto2);
}

TEST_F(TestUTF8, TestSectionUKeyUValA) {
	const char kensa[] = u8"検査";
	const char tesuto[] = u8"テスト";
	const char* result = ini.GetValue(kensa, tesuto);
	ASSERT_STREQ(result, "test");
}

TEST_F(TestUTF8, TestSectionUKeyUValU) {
	const char kensa[] = u8"検査";
	const char tesuto2[] = u8"テスト2";
	const char tesutoni[] = u8"テスト二";
	const char* result = ini.GetValue(kensa, tesuto2);
	ASSERT_STREQ(result, tesutoni);
}