Skip to content

Commit 3ce357f

Browse files
committed
bool -> void where possible, fix more comments
1 parent 340cee1 commit 3ce357f

File tree

8 files changed

+30
-49
lines changed

8 files changed

+30
-49
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
// <text_encoding>
1212

13-
// struct text_encoding
14-
1513
// text_encoding::text_encoding() noexcept
1614

1715
#include <cassert>

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,21 @@
2222

2323
using id = std::text_encoding::id;
2424

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

2828
assert(te.mib() == expect_id);
2929
assert(expect_name == te.name());
3030
assert(std::ranges::contains(te.aliases(), expect_name));
31-
32-
return true;
3331
}
3432

35-
constexpr bool id_ctors() {
33+
constexpr void id_ctors() {
3634
for (auto pair : unique_encoding_data) {
37-
assert(id_ctor(id(pair.mib), id(pair.mib), pair.name));
35+
id_ctor(id(pair.mib), id(pair.mib), pair.name);
3836
}
39-
return true;
4037
}
4138

42-
constexpr bool test_unknown_other() {
39+
constexpr void test_unknown_other() {
4340
{
4441
std::text_encoding te = std::text_encoding(id::other);
4542

@@ -55,18 +52,17 @@ constexpr bool test_unknown_other() {
5552
assert(std::string_view("") == te.name());
5653
assert(std::ranges::empty(te.aliases()));
5754
}
58-
return true;
5955
}
6056

6157
constexpr bool tests() {
6258
{
6359
// 2. Constructing an object with a valid id must set mib() and the name to the corresponding value.
64-
assert(id_ctors());
60+
id_ctors();
6561
}
6662

6763
{
6864
// 3. Constructing an object using id::unknown or id::other must set mib() to id::unknown or id::other, respectively, and the name to an empty string.
69-
assert(test_unknown_other());
65+
test_unknown_other();
7066
}
7167

7268
return true;

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

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,68 +21,63 @@
2121

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

24-
constexpr bool test_ctor(std::string_view str, std::string_view expect, std::text_encoding::id expect_id) {
24+
constexpr void test_ctor(std::string_view str, std::string_view expect, std::text_encoding::id expect_id) {
2525
std::text_encoding te = std::text_encoding(str);
26-
bool success = true;
2726

2827
assert(te.mib() == expect_id);
2928
assert(te.name() == expect);
30-
31-
return success;
3229
}
3330

34-
constexpr bool test_primary_encoding_spellings() {
31+
constexpr void test_primary_encoding_spellings() {
3532
for (auto& data : unique_encoding_data) {
3633
std::text_encoding te = std::text_encoding(data.name);
3734

3835
assert(te.mib() == std::text_encoding::id(data.mib));
3936
assert(te.name() == data.name);
4037
}
41-
return true;
4238
}
4339

44-
constexpr bool test_others() {
40+
constexpr void test_others() {
4541
for (auto& name : other_names) {
4642
std::text_encoding te = std::text_encoding(name);
4743

4844
assert(te.mib() == std::text_encoding::other);
4945
assert(te.name() == name);
5046
}
51-
return true;
5247
}
5348

5449
constexpr bool tests() {
5550
// happy paths
5651
{
57-
assert(test_primary_encoding_spellings());
52+
test_primary_encoding_spellings();
5853
}
5954

6055
{
61-
assert(test_ctor("U_T_F-8", "U_T_F-8", std::text_encoding::UTF8));
56+
test_ctor("U_T_F-8", "U_T_F-8", std::text_encoding::UTF8);
6257
}
6358

6459
{
65-
assert(test_ctor("utf8", "utf8", std::text_encoding::UTF8));
60+
test_ctor("utf8", "utf8", std::text_encoding::UTF8);
6661
}
6762

6863
{
69-
assert(test_ctor("u.t.f-008", "u.t.f-008", std::text_encoding::UTF8));
64+
test_ctor("u.t.f-008", "u.t.f-008", std::text_encoding::UTF8);
7065
}
7166

7267
{
73-
assert(test_ctor("utf-80", "utf-80", std::text_encoding::other));
68+
test_ctor("utf-80", "utf-80", std::text_encoding::other);
7469
}
7570

7671
{
77-
assert(test_ctor("iso885931988", "iso885931988", std::text_encoding::ISOLatin3));
72+
test_ctor("iso885931988", "iso885931988", std::text_encoding::ISOLatin3);
7873
}
7974

8075
{
81-
assert(test_ctor("iso00885931988", "iso00885931988", std::text_encoding::ISOLatin3));
76+
test_ctor("iso00885931988", "iso00885931988", std::text_encoding::ISOLatin3);
8277
}
8378

8479
{
85-
assert(test_others());
80+
test_others();
8681
}
8782

8883
return true;

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// <text_encoding>
1212

13-
// text_encoding operator==(const text_encoding&, id) noexcept
13+
// bool text_encoding::operator==(const text_encoding&, id) noexcept
1414

1515
#include <cassert>
1616
#include <text_encoding>
@@ -20,13 +20,11 @@
2020

2121
using id = std::text_encoding::id;
2222

23-
constexpr bool test_primary_encodings() {
23+
constexpr void test_primary_encodings() {
2424
for (auto& data : unique_encoding_data) {
2525
std::text_encoding te = std::text_encoding(id(data.mib));
2626
assert(te == id(data.mib));
2727
}
28-
29-
return true;
3028
}
3129

3230
constexpr bool tests() {
@@ -62,16 +60,15 @@ constexpr bool tests() {
6260
}
6361

6462
{
65-
assert(test_primary_encodings());
63+
test_primary_encodings();
6664
}
6765

6866
return true;
6967
}
7068

7169
int main(int, char**) {
72-
{
73-
static_assert(tests());
74-
assert(tests());
75-
}
70+
tests();
71+
static_assert(tests());
72+
7673
return 0;
7774
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// <text_encoding>
1212

13-
// text_encoding operator==(const text_encoding&, const text_encoding&) noexcept
13+
// bool text_encoding::operator==(const text_encoding&, const text_encoding&) noexcept
1414

1515
#include <cassert>
1616
#include <text_encoding>

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <text_encoding>
1818
#include <type_traits>
1919

20-
bool test_te_hash() {
20+
void test_te_hash() {
2121
using T = std::text_encoding;
2222
using H = std::hash<T>;
2323

@@ -49,8 +49,6 @@ bool test_te_hash() {
4949
const H h{};
5050
assert(h(te1) == h(te2));
5151
}
52-
53-
return true;
5452
}
5553

5654
int main(int, char**) {

libcxx/test/std/utilities/text_encoding/text_encoding.members/aliases.compile.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// <text_encoding>
1212

13-
// text_encoding text_encoding::aliases();
13+
// text_encoding::aliases_view;
1414

1515
#include <concepts>
1616
#include <text_encoding>

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
using id = std::text_encoding::id;
2323

24-
constexpr bool test_other_unknown() {
24+
constexpr void test_other_unknown() {
2525
{
2626
std::text_encoding te_other = std::text_encoding(id::other);
2727

@@ -40,11 +40,9 @@ constexpr bool test_other_unknown() {
4040
assert(unknown_range.empty());
4141
assert(!bool(unknown_range));
4242
}
43-
44-
return true;
4543
}
4644

47-
constexpr bool test_primary_encodings() {
45+
constexpr void test_primary_encodings() {
4846
for (auto& data : unique_encoding_data) {
4947
std::text_encoding te = std::text_encoding(id(data.mib));
5048

@@ -54,18 +52,17 @@ constexpr bool test_primary_encodings() {
5452
assert(!range.empty());
5553
assert(bool(range));
5654
}
57-
return true;
5855
}
5956

6057
constexpr bool tests() {
6158
// 1. An alias_view of a text_encoding object for "other" and "unknown" are empty
6259
{
63-
assert(test_other_unknown());
60+
test_other_unknown();
6461
}
6562

6663
// 2. An alias_view of a text_encoding object for a known encoding e.g. "UTF-8" is not empty
6764
{
68-
assert(test_primary_encodings());
65+
test_primary_encodings();
6966
}
7067

7168
return true;

0 commit comments

Comments
 (0)