Skip to content

Commit 340cee1

Browse files
committed
Use type names
1 parent 60be566 commit 340cee1

File tree

14 files changed

+111
-111
lines changed

14 files changed

+111
-111
lines changed

libcxx/test/std/utilities/text_encoding/text_encoding.ctor/default.pass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#include <type_traits>
2020

2121
constexpr bool test() {
22-
constexpr auto te = std::text_encoding();
23-
assert(te.mib() == std::text_encoding::id::unknown);
22+
std::text_encoding te = std::text_encoding();
23+
assert(te.mib() == std::text_encoding::unknown);
2424
assert(std::string_view("") == te.name());
2525

2626
return true;
@@ -35,8 +35,8 @@ int main(int, char**) {
3535

3636
// 2. Default constructing a text_encoding object makes it so that mib() == id::unknown, and its name is empty
3737
{
38+
test();
3839
static_assert(test());
39-
assert(test());
4040
}
4141

4242
return 0;

libcxx/test/std/utilities/text_encoding/text_encoding.ctor/id.pass.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
#include "../test_text_encoding.h"
2222

23-
using te_id = std::text_encoding::id;
23+
using id = std::text_encoding::id;
2424

25-
constexpr bool id_ctor(te_id i, te_id expect_id, std::string_view expect_name) {
26-
auto te = std::text_encoding(i);
25+
constexpr bool id_ctor(id i, id expect_id, std::string_view expect_name) {
26+
std::text_encoding te = std::text_encoding(i);
2727

2828
assert(te.mib() == expect_id);
2929
assert(expect_name == te.name());
@@ -34,23 +34,24 @@ constexpr bool id_ctor(te_id i, te_id expect_id, std::string_view expect_name) {
3434

3535
constexpr bool id_ctors() {
3636
for (auto pair : unique_encoding_data) {
37-
assert(id_ctor(te_id(pair.mib), te_id(pair.mib), pair.name));
37+
assert(id_ctor(id(pair.mib), id(pair.mib), pair.name));
3838
}
3939
return true;
4040
}
4141

4242
constexpr bool test_unknown_other() {
4343
{
44-
constexpr auto te = std::text_encoding(te_id::other);
44+
std::text_encoding te = std::text_encoding(id::other);
4545

46-
assert(te.mib() == te_id::other);
46+
assert(te.mib() == id::other);
4747
assert(std::string_view("") == te.name());
4848
assert(std::ranges::empty(te.aliases()));
4949
}
5050

5151
{
52-
constexpr auto te = std::text_encoding(te_id::unknown);
53-
assert(te.mib() == te_id::unknown);
52+
std::text_encoding te = std::text_encoding(id::unknown);
53+
54+
assert(te.mib() == id::unknown);
5455
assert(std::string_view("") == te.name());
5556
assert(std::ranges::empty(te.aliases()));
5657
}
@@ -79,8 +80,8 @@ int main(int, char**) {
7980
}
8081

8182
{
83+
tests();
8284
static_assert(tests());
83-
assert(tests());
8485
}
8586

8687
return 0;

libcxx/test/std/utilities/text_encoding/text_encoding.ctor/string_view.pass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "../test_text_encoding.h"
2323

2424
constexpr bool test_ctor(std::string_view str, std::string_view expect, std::text_encoding::id expect_id) {
25-
auto te = std::text_encoding(str);
25+
std::text_encoding te = std::text_encoding(str);
2626
bool success = true;
2727

2828
assert(te.mib() == expect_id);
@@ -33,7 +33,7 @@ constexpr bool test_ctor(std::string_view str, std::string_view expect, std::tex
3333

3434
constexpr bool test_primary_encoding_spellings() {
3535
for (auto& data : unique_encoding_data) {
36-
auto te = std::text_encoding(data.name);
36+
std::text_encoding te = std::text_encoding(data.name);
3737

3838
assert(te.mib() == std::text_encoding::id(data.mib));
3939
assert(te.name() == data.name);
@@ -43,7 +43,7 @@ constexpr bool test_primary_encoding_spellings() {
4343

4444
constexpr bool test_others() {
4545
for (auto& name : other_names) {
46-
auto te = std::text_encoding(name);
46+
std::text_encoding te = std::text_encoding(name);
4747

4848
assert(te.mib() == std::text_encoding::other);
4949
assert(te.name() == name);
@@ -95,8 +95,8 @@ int main(int, char**) {
9595
}
9696

9797
{
98+
tests();
9899
static_assert(tests());
99-
assert(tests());
100100
}
101101

102102
return 0;

libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.id.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ using id = std::text_encoding::id;
2222

2323
constexpr bool test_primary_encodings() {
2424
for (auto& data : unique_encoding_data) {
25-
auto te = std::text_encoding(id(data.mib));
25+
std::text_encoding te = std::text_encoding(id(data.mib));
2626
assert(te == id(data.mib));
2727
}
2828

@@ -32,7 +32,7 @@ constexpr bool test_primary_encodings() {
3232
constexpr bool tests() {
3333
// 1. operator==(const text_encoding&, id) must be noexcept
3434
{
35-
auto te = std::text_encoding();
35+
std::text_encoding te = std::text_encoding();
3636
ASSERT_NOEXCEPT(te == id::UTF8);
3737
}
3838

libcxx/test/std/utilities/text_encoding/text_encoding.eq/equal.pass.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,47 +22,46 @@ using id = std::text_encoding::id;
2222
constexpr bool tests() {
2323
// 1. operator==(const text_encoding&, const text_encoding&) must be noexcept
2424
{
25-
constexpr auto te1 = std::text_encoding();
26-
constexpr auto te2 = std::text_encoding();
25+
std::text_encoding te1 = std::text_encoding();
26+
std::text_encoding te2 = std::text_encoding();
2727
assert(te1 == te2);
2828
ASSERT_NOEXCEPT(te1 == te2);
2929
}
3030

3131
// 2. operator==(const text_encoding&, const text_encoding&) returns true if both text_encoding ids are equal
3232
{
33-
constexpr auto te1 = std::text_encoding(id::UTF8);
34-
constexpr auto te2 = std::text_encoding(id::UTF8);
33+
std::text_encoding te1 = std::text_encoding(id::UTF8);
34+
std::text_encoding te2 = std::text_encoding(id::UTF8);
3535
assert(te1 == te2);
3636
}
3737

3838
// 3. operator==(const text_encoding&, const text_encoding&) for text_encodings with ids of "other" return true if the names are equal
3939
{
40-
constexpr auto other_te1 = std::text_encoding("foo");
41-
constexpr auto other_te2 = std::text_encoding("foo");
40+
std::text_encoding other_te1 = std::text_encoding("foo");
41+
std::text_encoding other_te2 = std::text_encoding("foo");
4242
assert(other_te1 == other_te2);
4343
}
4444

4545
// 4. operator==(const text_encoding&, const text_encoding&) returns false when comparingtext_encodings with different ids
4646
{
47-
constexpr auto te1 = std::text_encoding(id::UTF8);
48-
constexpr auto te2 = std::text_encoding(id::UTF16);
47+
std::text_encoding te1 = std::text_encoding(id::UTF8);
48+
std::text_encoding te2 = std::text_encoding(id::UTF16);
4949
assert(!(te1 == te2));
5050
}
5151

5252
// 5. operator==(const text_encoding&, const text_encoding&) for text_encodings with ids of "other" returns false if the names are not equal
5353
{
54-
constexpr auto other_te1 = std::text_encoding("foo");
55-
constexpr auto other_te2 = std::text_encoding("bar");
54+
std::text_encoding other_te1 = std::text_encoding("foo");
55+
std::text_encoding other_te2 = std::text_encoding("bar");
5656
assert(!(other_te1 == other_te2));
5757
}
5858

5959
return true;
6060
}
6161

6262
int main(int, char**) {
63-
{
64-
static_assert(tests());
65-
assert(tests());
66-
}
63+
tests();
64+
static_assert(tests());
65+
6766
return 0;
6867
}

libcxx/test/std/utilities/text_encoding/text_encoding.hash/hash.pass.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,30 @@ bool test_te_hash() {
2222
using H = std::hash<T>;
2323

2424
{
25-
const T te(std::text_encoding::ASCII);
25+
const T te(T::ASCII);
2626
const H h{};
2727
assert(h(te) == h(te));
2828
static_assert(std::is_same_v<decltype(h(te)), std::size_t>);
2929
}
3030

3131
{
32-
const T te1(std::text_encoding::ASCII);
33-
const T te2(std::text_encoding::UTF8);
32+
const T te1(T::ASCII);
33+
const T te2(T::UTF8);
3434
const H h{};
3535

3636
assert(h(te1) != h(te2));
3737
}
3838

3939
{
40-
const T te1(std::text_encoding::unknown);
41-
const T te2(std::text_encoding::unknown);
40+
const T te1(T::unknown);
41+
const T te2(T::unknown);
4242
const H h{};
4343
assert(h(te1) == h(te2));
4444
}
4545

4646
{
47-
const T te1(std::text_encoding::other);
48-
const T te2(std::text_encoding::other);
47+
const T te1(T::other);
48+
const T te2(T::other);
4949
const H h{};
5050
assert(h(te1) == h(te2));
5151
}
@@ -54,9 +54,7 @@ bool test_te_hash() {
5454
}
5555

5656
int main(int, char**) {
57-
{
58-
assert(test_te_hash());
59-
}
57+
test_te_hash();
6058

6159
return 0;
6260
}

libcxx/test/std/utilities/text_encoding/text_encoding.members/environment.pass.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424
#include "../test_text_encoding.h"
2525
#include "platform_support.h"
2626

27-
using id = std::text_encoding::id;
2827
int main(int, char**) {
29-
auto te = std::text_encoding::environment();
28+
std::text_encoding te = std::text_encoding::environment();
3029
// 1. Depending on the platform's default, verify that environment() returns the corresponding text encoding.
3130
{
3231
#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)
@@ -42,7 +41,7 @@ int main(int, char**) {
4241
{
4342
std::setlocale(LC_ALL, LOCALE_en_US_UTF_8);
4443

45-
auto te2 = std::text_encoding::environment();
44+
std::text_encoding te2 = std::text_encoding::environment();
4645
assert(te2 != std::text_encoding::UTF8);
4746
assert(te == te2);
4847
}

libcxx/test/std/utilities/text_encoding/text_encoding.members/literal.pass.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <text_encoding>
1717

1818
constexpr bool test() {
19-
auto te = std::text_encoding::literal();
19+
std::text_encoding te = std::text_encoding::literal();
2020
#ifdef __GNUC_EXECUTION_CHARSET_NAME
2121
assert(std::string_view(te.name()) == std::string_view(__GNUC_EXECUTION_CHARSET_NAME));
2222
#elif defined(__clang_literal_encoding__)
@@ -29,9 +29,8 @@ constexpr bool test() {
2929
}
3030

3131
int main(int, char**) {
32-
{
33-
static_assert(test());
34-
assert(test());
35-
}
32+
test();
33+
static_assert(test());
34+
3635
return 0;
3736
}

libcxx/test/std/utilities/text_encoding/text_encoding.members/nodiscard.verify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <text_encoding>
1616

1717
int main(int, char**) {
18-
auto te = std::text_encoding();
18+
std::text_encoding te = std::text_encoding();
1919
// expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}}
2020
te.mib();
2121
// expected-warning@+1 {{ignoring return value of function declared with 'nodiscard' attribute}}

libcxx/test/std/utilities/text_encoding/text_encoding.members/text_encoding.aliases_view/begin.pass.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,37 @@
1616
#include <ranges>
1717
#include <text_encoding>
1818

19-
using id = std::text_encoding::id;
20-
2119
constexpr bool tests() {
2220
// 1. begin() of an aliases_view from a single text_encoding object are the same.
2321
{
24-
auto te = std::text_encoding(id::UTF8);
25-
auto view1 = te.aliases();
26-
auto view2 = te.aliases();
22+
std::text_encoding te = std::text_encoding(std::text_encoding::UTF8);
23+
24+
std::text_encoding::aliases_view view1 = te.aliases();
25+
std::text_encoding::aliases_view view2 = te.aliases();
2726

2827
assert(std::ranges::begin(view1) == std::ranges::begin(view2));
2928
assert(view1.begin() == view2.begin());
3029
}
3130

3231
// 2. begin() of aliases_views of two text_encoding objects that represent the same ID but hold different names are the same.
3332
{
34-
auto te1 = std::text_encoding("ANSI_X3.4-1968");
35-
auto te2 = std::text_encoding("ANSI_X3.4-1986");
33+
std::text_encoding te1 = std::text_encoding("ANSI_X3.4-1968");
34+
std::text_encoding te2 = std::text_encoding("ANSI_X3.4-1986");
3635

37-
auto view1 = te1.aliases();
38-
auto view2 = te2.aliases();
36+
std::text_encoding::aliases_view view1 = te1.aliases();
37+
std::text_encoding::aliases_view view2 = te2.aliases();
3938

4039
assert(view1.begin() == view2.begin());
4140
assert(std::ranges::begin(view1) == std::ranges::begin(view2));
4241
}
4342

4443
// 3. begin() of aliases_views of two text_encoding objects that represent different IDs are different.
4544
{
46-
auto te1 = std::text_encoding(id::UTF8);
47-
auto te2 = std::text_encoding(id::ASCII);
45+
std::text_encoding te1 = std::text_encoding(std::text_encoding::UTF8);
46+
std::text_encoding te2 = std::text_encoding(std::text_encoding::ASCII);
4847

49-
auto view1 = te1.aliases();
50-
auto view2 = te2.aliases();
48+
std::text_encoding::aliases_view view1 = te1.aliases();
49+
std::text_encoding::aliases_view view2 = te2.aliases();
5150

5251
assert(!(view1.begin() == view2.begin()));
5352
assert(!(std::ranges::begin(view1) == std::ranges::begin(view2)));
@@ -57,9 +56,8 @@ constexpr bool tests() {
5756
}
5857

5958
int main(int, char**) {
60-
{
61-
static_assert(tests());
62-
assert(tests());
63-
}
59+
tests();
60+
static_assert(tests());
61+
6462
return 0;
6563
}

0 commit comments

Comments
 (0)