Skip to content

Commit e361ba2

Browse files
committed
Fix EOF new line warning
1 parent 6173a95 commit e361ba2

File tree

4 files changed

+129
-153
lines changed

4 files changed

+129
-153
lines changed

test/hashmap/hashmap_find.cpp

Lines changed: 126 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -10,162 +10,138 @@ GTEST_TEST(hashmap, find_in_empty_hashmap)
1010
GTEST_TEST(hashmap, find_in_hashmap_trivial_type)
1111
{
1212

13-
hud_test::for_each_value(std::make_integer_sequence<usize, 128>(), []<usize maxx>()
14-
{
15-
const auto test = [](usize max)
16-
{
17-
using KeyType = usize;
18-
using ValueType = usize;
19-
hud::hashmap<KeyType, ValueType> map;
20-
21-
for (u32 index = 0; index < max; index++)
22-
{
23-
map.add(index, index * index);
24-
}
25-
26-
bool is_find_ok = true;
27-
// Find elements that exists
28-
for (u32 index = 0; index < max; index++)
29-
{
30-
const auto it = map.find(index);
31-
if (it == map.end())
32-
{
33-
is_find_ok = false;
34-
}
35-
if (it->key() != index)
36-
{
37-
is_find_ok = false;
38-
}
39-
if (it->value() != index * index)
40-
{
41-
is_find_ok = false;
42-
}
43-
}
44-
45-
// Find elements that not exists
46-
for (u32 index = max; index < max * 2; index++)
47-
{
48-
const auto it = map.find(index);
49-
if (it != map.end())
50-
{
51-
is_find_ok = false;
52-
}
53-
}
54-
return is_find_ok;
55-
};
56-
57-
// Non constant
58-
{
59-
const auto result = test(maxx);
60-
hud_assert_true(result);
13+
const auto test = [](usize max) {
14+
using KeyType = usize;
15+
using ValueType = usize;
16+
hud::hashmap<KeyType, ValueType> map;
17+
18+
for (u32 index = 0; index < max; index++) {
19+
map.add(index, index * index);
20+
}
21+
22+
bool is_find_ok = true;
23+
// Find elements that exists
24+
for (u32 index = 0; index < max; index++) {
25+
const auto it = map.find(index);
26+
if (it == map.end()) {
27+
is_find_ok = false;
6128
}
29+
if (it->key() != index) {
30+
is_find_ok = false;
31+
}
32+
if (it->value() != index * index) {
33+
is_find_ok = false;
34+
}
35+
}
6236

63-
// Constant
64-
{
65-
constexpr auto result = test(maxx);
66-
hud_assert_true(result);
67-
} });
37+
// Find elements that not exists
38+
for (u32 index = max; index < max * 2; index++) {
39+
const auto it = map.find(index);
40+
if (it != map.end()) {
41+
is_find_ok = false;
42+
}
43+
}
44+
return is_find_ok;
45+
};
46+
47+
// Non constant
48+
{
49+
const auto result = test(32768);
50+
hud_assert_true(result);
51+
}
52+
53+
// Constant
54+
{
55+
hud_test::for_each_value(std::make_integer_sequence<usize, 2>(), []<usize maxx>() {
56+
constexpr auto result = test(maxx);
57+
hud_assert_true(result);
58+
});
59+
}
6860
}
6961

7062
GTEST_TEST(hashmap, find_in_hashmap_non_trivial_type)
7163
{
72-
hud_test::for_each_value(std::make_integer_sequence<usize, 128>(), []<usize maxx>()
73-
{
74-
const auto test_1 = [](usize max)
75-
{
76-
using KeyType = hud_test::non_bitwise_type;
77-
using ValueType = hud_test::non_bitwise_type;
78-
hud::hashmap<KeyType, ValueType> map;
79-
for (u32 index = 0; index < max; index++)
80-
{
81-
map.add(index, index * index);
82-
}
83-
84-
bool is_find_ok = true;
85-
// Find elements that exists
86-
for (u32 index = 0; index < max; index++)
87-
{
88-
const auto it = map.find(index);
89-
if (it == map.end())
90-
{
91-
is_find_ok = false;
92-
}
93-
if (it->key() != index)
94-
{
95-
is_find_ok = false;
96-
}
97-
if (it->value() != index * index)
98-
{
99-
is_find_ok = false;
100-
}
101-
}
102-
103-
// Find elements that not exists
104-
for (u32 index = max; index < max * 2; index++)
105-
{
106-
const auto it = map.find(index);
107-
if (it != map.end())
108-
{
109-
is_find_ok = false;
110-
}
111-
}
112-
return is_find_ok;
113-
};
114-
115-
const auto test_2 = [](usize max)
116-
{
117-
using KeyType = hud_test::non_bitwise_type;
118-
using ValueType = hud_test::non_bitwise_type;
119-
hud::hashmap<KeyType, ValueType> map;
120-
for (u32 index = 0; index < max; index++)
121-
{
122-
map.add(index, index * index);
123-
}
124-
125-
bool is_find_ok = true;
126-
// Find elements that exists
127-
for (u32 index = 0; index < max; index++)
128-
{
129-
const auto it = map.find(KeyType(index));
130-
if (it == map.end())
131-
{
132-
is_find_ok = false;
133-
}
134-
if (it->key() != index)
135-
{
136-
is_find_ok = false;
137-
}
138-
if (it->value() != index * index)
139-
{
140-
is_find_ok = false;
141-
}
142-
}
143-
144-
// Find elements that not exists
145-
for (u32 index = max; index < max * 2; index++)
146-
{
147-
const auto it = map.find(KeyType(index));
148-
if (it != map.end())
149-
{
150-
is_find_ok = false;
151-
}
152-
}
153-
return is_find_ok;
154-
};
155-
156-
// Non constant
157-
{
158-
const auto result = test_1(maxx);
159-
hud_assert_true(result);
160-
auto result_2 = test_2(maxx);
161-
hud_assert_true(result_2);
64+
const auto test_1 = [](usize max) {
65+
using KeyType = hud_test::non_bitwise_type;
66+
using ValueType = hud_test::non_bitwise_type;
67+
hud::hashmap<KeyType, ValueType> map;
68+
for (u32 index = 0; index < max; index++) {
69+
map.add(index, index * index);
70+
}
71+
72+
bool is_find_ok = true;
73+
// Find elements that exists
74+
for (u32 index = 0; index < max; index++) {
75+
const auto it = map.find(index);
76+
if (it == map.end()) {
77+
is_find_ok = false;
16278
}
79+
if (it->key() != index) {
80+
is_find_ok = false;
81+
}
82+
if (it->value() != index * index) {
83+
is_find_ok = false;
84+
}
85+
}
16386

164-
// Constant
165-
{
166-
constexpr auto result = test_1(maxx);
167-
hud_assert_true(result);
168-
constexpr auto result_2 = test_2(maxx);
169-
hud_assert_true(result_2);
170-
} });
87+
// Find elements that not exists
88+
for (u32 index = max; index < max * 2; index++) {
89+
const auto it = map.find(index);
90+
if (it != map.end()) {
91+
is_find_ok = false;
92+
}
93+
}
94+
return is_find_ok;
95+
};
96+
97+
const auto test_2 = [](usize max) {
98+
using KeyType = hud_test::non_bitwise_type;
99+
using ValueType = hud_test::non_bitwise_type;
100+
hud::hashmap<KeyType, ValueType> map;
101+
for (u32 index = 0; index < max; index++) {
102+
map.add(index, index * index);
103+
}
104+
105+
bool is_find_ok = true;
106+
// Find elements that exists
107+
for (u32 index = 0; index < max; index++) {
108+
const auto it = map.find(KeyType(index));
109+
if (it == map.end()) {
110+
is_find_ok = false;
111+
}
112+
if (it->key() != index) {
113+
is_find_ok = false;
114+
}
115+
if (it->value() != index * index) {
116+
is_find_ok = false;
117+
}
118+
}
119+
120+
// Find elements that not exists
121+
for (u32 index = max; index < max * 2; index++) {
122+
const auto it = map.find(KeyType(index));
123+
if (it != map.end()) {
124+
is_find_ok = false;
125+
}
126+
}
127+
return is_find_ok;
128+
};
129+
130+
// Non constant
131+
{
132+
const auto result = test_1(32768);
133+
hud_assert_true(result);
134+
const auto result_2 = test_2(maxx);
135+
hud_assert_true(result_2);
136+
}
137+
138+
// Constant
139+
{
140+
hud_test::for_each_value(std::make_integer_sequence<usize, 2>(), []<usize maxx>() {
141+
constexpr auto result = test_1(maxx);
142+
hud_assert_true(result);
143+
constexpr auto result_2 = test_2(maxx);
144+
hud_assert_true(result_2);
145+
});
146+
}
171147
}

test/string/lipsum/arabic_lipsum.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@
5252
\
5353
دنو حلّت لهيمنة بولندا، أي, من أدوات استبدال التاريخ، أما, وبالرغم بولندا، عرض تم. عدد هو الشطر الشتاء, ولم كل أمام الأعمال. هامش ليبين الأرض بحث أم, عُقر غريمه أي كلّ. وقد أم أسيا أهّل بالفشل, العالمية استراليا، تحت إذ. أن ومن أكثر كانتا الإقتصادية, كل ببعض بهيئة بها. أضف ان شرسة علاقة لإنعدام.\
5454
\
55-
بلا قد اكتوبر العاصمة المبرمة, التحالف الأوروبيّون أما ما. ليركز وأزيز دنو عل. ولم بـ فرنسا بولندا، ماليزيا،. أم تحرير أوروبا أما."
55+
بلا قد اكتوبر العاصمة المبرمة, التحالف الأوروبيّون أما ما. ليركز وأزيز دنو عل. ولم بـ فرنسا بولندا، ماليزيا،. أم تحرير أوروبا أما."

test/string/lipsum/chinese_lipsum.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
\
99
類指興唱秋授通動朝商教経推比検決。主読止給終中禁探留菓志変堅文晴脱励。究整図麓順暮同息日首住能納。芸省止夜真日結輔天型真身地落日配。民南算改記室候根愛編月購活構経新快思田。準副感報聞投居代磨那配島県都松。青掲資引範毎況抗図進就平後頑。提人談月次日集代摩遇訪速。著入庭誉下踊泰深維真塔副更送知改工。\
1010
\
11-
販評師狸掲午止悼見告条二揃思然指。容治経警見入祭考津行公過。手無経文賠早告旬感開能打回。町軽禁氏遂覧町配権転億策報藤台状走芸政聴。集社質社築朝施早球者旅番接撮。最願丸高考理掲聞名南聞作必分堀止断締。抱野供分無厚保外全新州特集個変料選容。社動観生分供持企佳情検統宇真。得一買務場察報局臓市情数聞熱速役覇具足。"
11+
販評師狸掲午止悼見告条二揃思然指。容治経警見入祭考津行公過。手無経文賠早告旬感開能打回。町軽禁氏遂覧町配権転億策報藤台状走芸政聴。集社質社築朝施早球者旅番接撮。最願丸高考理掲聞名南聞作必分堀止断締。抱野供分無厚保外全新州特集個変料選容。社動観生分供持企佳情検統宇真。得一買務場察報局臓市情数聞熱速役覇具足。"

test/string/lipsum/russian_lipsum.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
\
1919
Те еос иллуд цопиосае, иллуд омнес лаудем ест ет. Ут цум долоре дисцере? Мел цонсул видерер делецтус ад, вис дицта иисяуе мандамус ин? Еум солута иисяуе ат, яуо ан реферрентур пхилосопхиа, пурто афферт меи цу!\
2020
\
21-
Салутанди десеруиссе нецесситатибус сед еи, убияуе персиус маиестатис иус ид. Не темпор граеци делицата нец, инцоррупте аццоммодаре ат при. Еу синт дисцере доценди усу, ан дицтас перпетуа при. Про суавитате сцрибентур цу, сед ад ассум аперири."
21+
Салутанди десеруиссе нецесситатибус сед еи, убияуе персиус маиестатис иус ид. Не темпор граеци делицата нец, инцоррупте аццоммодаре ат при. Еу синт дисцере доценди усу, ан дицтас перпетуа при. Про суавитате сцрибентур цу, сед ад ассум аперири."

0 commit comments

Comments
 (0)