summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-04-01 20:58:27 +0300
committerLinus Groh <mail@linusgroh.de>2022-04-01 21:24:45 +0100
commit086969277e74d8ba065bf8145d3aeb0dec0bfee5 (patch)
tree02b3699a66735ef806d9b46353491f18f8e4e7b4 /Tests
parent0376c127f6e98e03607700d0b3f5154b7014b2f8 (diff)
downloadserenity-086969277e74d8ba065bf8145d3aeb0dec0bfee5.zip
Everywhere: Run clang-format
Diffstat (limited to 'Tests')
-rw-r--r--Tests/AK/TestArray.cpp2
-rw-r--r--Tests/AK/TestBase64.cpp4
-rw-r--r--Tests/AK/TestBinarySearch.cpp4
-rw-r--r--Tests/AK/TestBitmap.cpp2
-rw-r--r--Tests/AK/TestDoublyLinkedList.cpp2
-rw-r--r--Tests/AK/TestFormat.cpp6
-rw-r--r--Tests/AK/TestHashFunctions.cpp8
-rw-r--r--Tests/AK/TestHashMap.cpp2
-rw-r--r--Tests/AK/TestHashTable.cpp4
-rw-r--r--Tests/AK/TestIPv4Address.cpp12
-rw-r--r--Tests/AK/TestJSON.cpp4
-rw-r--r--Tests/AK/TestMACAddress.cpp8
-rw-r--r--Tests/AK/TestMemoryStream.cpp14
-rw-r--r--Tests/AK/TestNeverDestroyed.cpp2
-rw-r--r--Tests/AK/TestOptional.cpp4
-rw-r--r--Tests/AK/TestQuickSort.cpp4
-rw-r--r--Tests/AK/TestSinglyLinkedList.cpp12
-rw-r--r--Tests/AK/TestSourceLocation.cpp2
-rw-r--r--Tests/AK/TestSpan.cpp10
-rw-r--r--Tests/AK/TestStringView.cpp2
-rw-r--r--Tests/AK/TestTuple.cpp4
-rw-r--r--Tests/AK/TestTypeTraits.cpp2
-rw-r--r--Tests/AK/TestTypedTransfer.cpp4
-rw-r--r--Tests/AK/TestVector.cpp14
-rw-r--r--Tests/Kernel/TestKernelPledge.cpp2
-rw-r--r--Tests/Kernel/bind-local-socket-to-symlink.cpp2
-rw-r--r--Tests/Kernel/elf-execve-mmap-race.cpp2
-rw-r--r--Tests/Kernel/fuzz-syscalls.cpp8
-rw-r--r--Tests/Kernel/kill-pidtid-confusion.cpp4
-rw-r--r--Tests/Kernel/mprotect-multi-region-mprotect.cpp2
-rw-r--r--Tests/Kernel/nanosleep-race-outbuf-munmap.cpp2
-rw-r--r--Tests/Kernel/pthread-cond-timedwait-example.cpp4
-rw-r--r--Tests/Kernel/setpgid-across-sessions-without-leader.cpp4
-rw-r--r--Tests/Kernel/siginfo-example.cpp2
-rw-r--r--Tests/Kernel/stress-truncate.cpp2
-rw-r--r--Tests/Kernel/stress-writeread.cpp2
-rw-r--r--Tests/LibC/TestIo.cpp4
-rw-r--r--Tests/LibC/TestLibCMkTemp.cpp6
-rw-r--r--Tests/LibC/TestLibCSetjmp.cpp12
-rw-r--r--Tests/LibC/TestLibCTime.cpp2
-rw-r--r--Tests/LibC/TestMemmem.cpp12
-rw-r--r--Tests/LibC/TestQsort.cpp14
-rw-r--r--Tests/LibC/TestRealpath.cpp2
-rw-r--r--Tests/LibC/TestScanf.cpp16
-rw-r--r--Tests/LibC/TestSearch.cpp10
-rw-r--r--Tests/LibC/TestSnprintf.cpp48
-rw-r--r--Tests/LibC/TestStrlcpy.cpp10
-rw-r--r--Tests/LibC/TestStrtodAccuracy.cpp14
-rw-r--r--Tests/LibC/TestWchar.cpp24
-rw-r--r--Tests/LibCompress/TestDeflate.cpp34
-rw-r--r--Tests/LibCompress/TestGzip.cpp18
-rw-r--r--Tests/LibCompress/TestZlib.cpp4
-rw-r--r--Tests/LibCpp/test-cpp-parser.cpp2
-rw-r--r--Tests/LibCrypto/TestAES.cpp2
-rw-r--r--Tests/LibCrypto/TestRSA.cpp2
-rw-r--r--Tests/LibGfx/BenchmarkGfxPainter.cpp12
-rw-r--r--Tests/LibGfx/TestFontHandling.cpp8
-rw-r--r--Tests/LibIMAP/TestQuotedPrintable.cpp4
-rw-r--r--Tests/LibM/test-math.cpp4
-rw-r--r--Tests/LibRegex/RegexLibC.cpp18
-rw-r--r--Tests/LibSQL/TestSqlStatementExecution.cpp2
-rw-r--r--Tests/LibTLS/TestTLSHandshake.cpp6
-rw-r--r--Tests/LibWasm/test-wasm.cpp10
-rw-r--r--Tests/UserspaceEmulator/ue-write-oob.cpp8
64 files changed, 238 insertions, 238 deletions
diff --git a/Tests/AK/TestArray.cpp b/Tests/AK/TestArray.cpp
index a1eab1e1f0..03038a9958 100644
--- a/Tests/AK/TestArray.cpp
+++ b/Tests/AK/TestArray.cpp
@@ -8,7 +8,7 @@
#include <AK/Array.h>
-static constexpr int constexpr_sum(const Span<const int> span)
+static constexpr int constexpr_sum(Span<int const> const span)
{
int sum = 0;
for (auto value : span)
diff --git a/Tests/AK/TestBase64.cpp b/Tests/AK/TestBase64.cpp
index 25c1c6ada7..ce0ccffe84 100644
--- a/Tests/AK/TestBase64.cpp
+++ b/Tests/AK/TestBase64.cpp
@@ -12,7 +12,7 @@
TEST_CASE(test_decode)
{
- auto decode_equal = [&](const char* input, const char* expected) {
+ auto decode_equal = [&](char const* input, char const* expected) {
auto decoded_option = decode_base64(StringView(input));
EXPECT(!decoded_option.is_error());
auto decoded = decoded_option.release_value();
@@ -41,7 +41,7 @@ TEST_CASE(test_decode_invalid)
TEST_CASE(test_encode)
{
- auto encode_equal = [&](const char* input, const char* expected) {
+ auto encode_equal = [&](char const* input, char const* expected) {
auto encoded = encode_base64({ input, strlen(input) });
EXPECT(encoded == String(expected));
EXPECT_EQ(StringView(expected).length(), calculate_base64_encoded_length(StringView(input).bytes()));
diff --git a/Tests/AK/TestBinarySearch.cpp b/Tests/AK/TestBinarySearch.cpp
index bf7cdb76ae..f5a63eac33 100644
--- a/Tests/AK/TestBinarySearch.cpp
+++ b/Tests/AK/TestBinarySearch.cpp
@@ -54,7 +54,7 @@ TEST_CASE(vector_strings)
strings.append("cat");
strings.append("dog");
- auto string_compare = [](const String& a, const String& b) -> int {
+ auto string_compare = [](String const& a, String const& b) -> int {
return strcmp(a.characters(), b.characters());
};
auto test1 = *binary_search(strings, String("bat"), nullptr, string_compare);
@@ -108,7 +108,7 @@ TEST_CASE(constexpr_array_search)
TEST_CASE(unsigned_to_signed_regression)
{
- const Array<u32, 5> input { 0, 1, 2, 3, 4 };
+ Array<u32, 5> const input { 0, 1, 2, 3, 4 };
// The algorithm computes 1 - input[2] = -1, and if this is (incorrectly) cast
// to an unsigned then it will look in the wrong direction and miss the 1.
diff --git a/Tests/AK/TestBitmap.cpp b/Tests/AK/TestBitmap.cpp
index 8eac72aa16..56fba7fd79 100644
--- a/Tests/AK/TestBitmap.cpp
+++ b/Tests/AK/TestBitmap.cpp
@@ -216,7 +216,7 @@ TEST_CASE(count_in_range)
bitmap.set(i, true);
}
- auto count_bits_slow = [](const Bitmap& b, size_t start, size_t len, bool value) -> size_t {
+ auto count_bits_slow = [](Bitmap const& b, size_t start, size_t len, bool value) -> size_t {
size_t count = 0;
for (size_t i = start; i < start + len; i++) {
if (b.get(i) == value)
diff --git a/Tests/AK/TestDoublyLinkedList.cpp b/Tests/AK/TestDoublyLinkedList.cpp
index 407484e443..480b0c585d 100644
--- a/Tests/AK/TestDoublyLinkedList.cpp
+++ b/Tests/AK/TestDoublyLinkedList.cpp
@@ -35,7 +35,7 @@ TEST_CASE(should_find_mutable)
TEST_CASE(should_find_const)
{
- const auto sut = make_list();
+ auto const sut = make_list();
EXPECT_EQ(4, *sut.find(4));
diff --git a/Tests/AK/TestFormat.cpp b/Tests/AK/TestFormat.cpp
index 61923da842..29c922316d 100644
--- a/Tests/AK/TestFormat.cpp
+++ b/Tests/AK/TestFormat.cpp
@@ -14,7 +14,7 @@
TEST_CASE(is_integral_works_properly)
{
- EXPECT(!IsIntegral<const char*>);
+ EXPECT(!IsIntegral<char const*>);
EXPECT(IsIntegral<unsigned long>);
}
@@ -186,7 +186,7 @@ TEST_CASE(ensure_that_format_works)
TEST_CASE(format_string_literal_as_pointer)
{
- const char* literal = "abc";
+ char const* literal = "abc";
EXPECT_EQ(String::formatted("{:p}", literal), String::formatted("{:p}", reinterpret_cast<FlatPtr>(literal)));
}
@@ -228,7 +228,7 @@ TEST_CASE(file_descriptor)
rewind(file);
Array<u8, 256> buffer;
- const auto nread = fread(buffer.data(), 1, buffer.size(), file);
+ auto const nread = fread(buffer.data(), 1, buffer.size(), file);
EXPECT_EQ("Hello, World!\nfoobar\n"sv, StringView { buffer.span().trim(nread) });
diff --git a/Tests/AK/TestHashFunctions.cpp b/Tests/AK/TestHashFunctions.cpp
index 6fbb0ab6f7..f5750c887e 100644
--- a/Tests/AK/TestHashFunctions.cpp
+++ b/Tests/AK/TestHashFunctions.cpp
@@ -42,14 +42,14 @@ TEST_CASE(ptr_hash)
EXPECT_EQ(ptr_hash(FlatPtr(42)), 2824066580u);
EXPECT_EQ(ptr_hash(FlatPtr(0)), 954888656u);
- EXPECT_EQ(ptr_hash(reinterpret_cast<const void*>(42)), 2824066580u);
- EXPECT_EQ(ptr_hash(reinterpret_cast<const void*>(0)), 954888656u);
+ EXPECT_EQ(ptr_hash(reinterpret_cast<void const*>(42)), 2824066580u);
+ EXPECT_EQ(ptr_hash(reinterpret_cast<void const*>(0)), 954888656u);
} else {
EXPECT_EQ(ptr_hash(FlatPtr(42)), 3564735745u);
EXPECT_EQ(ptr_hash(FlatPtr(0)), 1177991625u);
- EXPECT_EQ(ptr_hash(reinterpret_cast<const void*>(42)), 3564735745u);
- EXPECT_EQ(ptr_hash(reinterpret_cast<const void*>(0)), 1177991625u);
+ EXPECT_EQ(ptr_hash(reinterpret_cast<void const*>(42)), 3564735745u);
+ EXPECT_EQ(ptr_hash(reinterpret_cast<void const*>(0)), 1177991625u);
}
}
diff --git a/Tests/AK/TestHashMap.cpp b/Tests/AK/TestHashMap.cpp
index 25e248b7a6..b7a284a8cd 100644
--- a/Tests/AK/TestHashMap.cpp
+++ b/Tests/AK/TestHashMap.cpp
@@ -111,7 +111,7 @@ TEST_CASE(case_insensitive)
TEST_CASE(hashmap_of_nonnullownptr_get)
{
struct Object {
- Object(const String& s)
+ Object(String const& s)
: string(s)
{
}
diff --git a/Tests/AK/TestHashTable.cpp b/Tests/AK/TestHashTable.cpp
index 4f5aa422b5..02c94c6b62 100644
--- a/Tests/AK/TestHashTable.cpp
+++ b/Tests/AK/TestHashTable.cpp
@@ -136,7 +136,7 @@ TEST_CASE(many_strings)
TEST_CASE(many_collisions)
{
struct StringCollisionTraits : public GenericTraits<String> {
- static unsigned hash(const String&) { return 0; }
+ static unsigned hash(String const&) { return 0; }
};
HashTable<String, StringCollisionTraits> strings;
@@ -158,7 +158,7 @@ TEST_CASE(many_collisions)
TEST_CASE(space_reuse)
{
struct StringCollisionTraits : public GenericTraits<String> {
- static unsigned hash(const String&) { return 0; }
+ static unsigned hash(String const&) { return 0; }
};
HashTable<String, StringCollisionTraits> strings;
diff --git a/Tests/AK/TestIPv4Address.cpp b/Tests/AK/TestIPv4Address.cpp
index b8f07d1e3c..4f3055ebd4 100644
--- a/Tests/AK/TestIPv4Address.cpp
+++ b/Tests/AK/TestIPv4Address.cpp
@@ -66,7 +66,7 @@ TEST_CASE(should_convert_to_string)
TEST_CASE(should_make_ipv4_address_from_string)
{
- const auto addr = IPv4Address::from_string("192.168.0.1");
+ auto const addr = IPv4Address::from_string("192.168.0.1");
EXPECT(addr.has_value());
EXPECT_EQ(192, addr.value()[0]);
@@ -77,21 +77,21 @@ TEST_CASE(should_make_ipv4_address_from_string)
TEST_CASE(should_make_empty_optional_from_bad_string)
{
- const auto addr = IPv4Address::from_string("bad string");
+ auto const addr = IPv4Address::from_string("bad string");
EXPECT(!addr.has_value());
}
TEST_CASE(should_make_empty_optional_from_out_of_range_values)
{
- const auto addr = IPv4Address::from_string("192.168.0.500");
+ auto const addr = IPv4Address::from_string("192.168.0.500");
EXPECT(!addr.has_value());
}
TEST_CASE(should_fill_d_octet_from_1_part)
{
- const auto addr = IPv4Address::from_string("1");
+ auto const addr = IPv4Address::from_string("1");
EXPECT(addr.has_value());
EXPECT_EQ(0, addr.value()[0]);
@@ -102,7 +102,7 @@ TEST_CASE(should_fill_d_octet_from_1_part)
TEST_CASE(should_fill_a_and_d_octets_from_2_parts)
{
- const auto addr = IPv4Address::from_string("192.1");
+ auto const addr = IPv4Address::from_string("192.1");
EXPECT(addr.has_value());
EXPECT_EQ(192, addr.value()[0]);
@@ -113,7 +113,7 @@ TEST_CASE(should_fill_a_and_d_octets_from_2_parts)
TEST_CASE(should_fill_a_b_d_octets_from_3_parts)
{
- const auto addr = IPv4Address::from_string("192.168.1");
+ auto const addr = IPv4Address::from_string("192.168.1");
EXPECT(addr.has_value());
EXPECT_EQ(192, addr.value()[0]);
diff --git a/Tests/AK/TestJSON.cpp b/Tests/AK/TestJSON.cpp
index 0627b110c1..36f0b8cebc 100644
--- a/Tests/AK/TestJSON.cpp
+++ b/Tests/AK/TestJSON.cpp
@@ -46,7 +46,7 @@ TEST_CASE(load_form)
auto widgets = form_json.as_object().get("widgets").as_array();
- widgets.for_each([&](const JsonValue& widget_value) {
+ widgets.for_each([&](JsonValue const& widget_value) {
auto& widget_object = widget_value.as_object();
auto widget_class = widget_object.get("class").as_string();
widget_object.for_each_member([&]([[maybe_unused]] auto& property_name, [[maybe_unused]] const JsonValue& property_value) {
@@ -87,7 +87,7 @@ TEST_CASE(json_utf8_multibyte)
{
auto json_or_error = JsonValue::from_string("\"ลก\"");
EXPECT_EQ(json_or_error.is_error(), false);
-
+
auto& json = json_or_error.value();
EXPECT_EQ(json.type(), JsonValue::Type::String);
EXPECT_EQ(json.as_string().is_null(), false);
diff --git a/Tests/AK/TestMACAddress.cpp b/Tests/AK/TestMACAddress.cpp
index 258f1ac0e0..55767f8551 100644
--- a/Tests/AK/TestMACAddress.cpp
+++ b/Tests/AK/TestMACAddress.cpp
@@ -85,7 +85,7 @@ TEST_CASE(should_string_format)
TEST_CASE(should_make_mac_address_from_string_numbers)
{
- const auto sut = MACAddress::from_string("01:02:03:04:05:06");
+ auto const sut = MACAddress::from_string("01:02:03:04:05:06");
EXPECT(sut.has_value());
EXPECT_EQ(1, sut.value()[0]);
@@ -98,7 +98,7 @@ TEST_CASE(should_make_mac_address_from_string_numbers)
TEST_CASE(should_make_mac_address_from_string_letters)
{
- const auto sut = MACAddress::from_string("de:ad:be:ee:ee:ef");
+ auto const sut = MACAddress::from_string("de:ad:be:ee:ee:ef");
EXPECT(sut.has_value());
EXPECT_EQ(u8 { 0xDE }, sut.value()[0]);
@@ -111,14 +111,14 @@ TEST_CASE(should_make_mac_address_from_string_letters)
TEST_CASE(should_make_empty_optional_from_bad_string)
{
- const auto sut = MACAddress::from_string("bad string");
+ auto const sut = MACAddress::from_string("bad string");
EXPECT(!sut.has_value());
}
TEST_CASE(should_make_empty_optional_from_out_of_range_values)
{
- const auto sut = MACAddress::from_string("de:ad:be:ee:ee:fz");
+ auto const sut = MACAddress::from_string("de:ad:be:ee:ee:fz");
EXPECT(!sut.has_value());
}
diff --git a/Tests/AK/TestMemoryStream.cpp b/Tests/AK/TestMemoryStream.cpp
index 90512fe456..3c774c70b3 100644
--- a/Tests/AK/TestMemoryStream.cpp
+++ b/Tests/AK/TestMemoryStream.cpp
@@ -63,7 +63,7 @@ TEST_CASE(recoverable_error)
TEST_CASE(chain_stream_operator)
{
- const Array<u8, 4> expected { 0, 1, 2, 3 };
+ Array<u8, 4> const expected { 0, 1, 2, 3 };
Array<u8, 4> actual;
InputMemoryStream stream { expected };
@@ -76,10 +76,10 @@ TEST_CASE(chain_stream_operator)
TEST_CASE(seeking_slicing_offset)
{
- const Array<u8, 8> input { 0, 1, 2, 3, 4, 5, 6, 7 };
- const Array<u8, 4> expected0 { 0, 1, 2, 3 };
- const Array<u8, 4> expected1 { 4, 5, 6, 7 };
- const Array<u8, 4> expected2 { 1, 2, 3, 4 };
+ Array<u8, 8> const input { 0, 1, 2, 3, 4, 5, 6, 7 };
+ Array<u8, 4> const expected0 { 0, 1, 2, 3 };
+ Array<u8, 4> const expected1 { 4, 5, 6, 7 };
+ Array<u8, 4> const expected2 { 1, 2, 3, 4 };
Array<u8, 4> actual0 {}, actual1 {}, actual2 {};
@@ -140,7 +140,7 @@ TEST_CASE(duplex_large_buffer)
TEST_CASE(read_endian_values)
{
- const Array<u8, 8> input { 0, 1, 2, 3, 4, 5, 6, 7 };
+ Array<u8, 8> const input { 0, 1, 2, 3, 4, 5, 6, 7 };
InputMemoryStream stream { input };
LittleEndian<u32> value1;
@@ -153,7 +153,7 @@ TEST_CASE(read_endian_values)
TEST_CASE(write_endian_values)
{
- const Array<u8, 8> expected { 4, 3, 2, 1, 1, 2, 3, 4 };
+ Array<u8, 8> const expected { 4, 3, 2, 1, 1, 2, 3, 4 };
DuplexMemoryStream stream;
stream << LittleEndian<u32> { 0x01020304 } << BigEndian<u32> { 0x01020304 };
diff --git a/Tests/AK/TestNeverDestroyed.cpp b/Tests/AK/TestNeverDestroyed.cpp
index 329eaa8ebd..43ea3e65f6 100644
--- a/Tests/AK/TestNeverDestroyed.cpp
+++ b/Tests/AK/TestNeverDestroyed.cpp
@@ -14,7 +14,7 @@ struct Counter {
~Counter() { ++num_destroys; }
- Counter(const Counter&)
+ Counter(Counter const&)
{
++num_copies;
}
diff --git a/Tests/AK/TestOptional.cpp b/Tests/AK/TestOptional.cpp
index 2e71ce7f32..e96c12a23c 100644
--- a/Tests/AK/TestOptional.cpp
+++ b/Tests/AK/TestOptional.cpp
@@ -159,7 +159,7 @@ TEST_CASE(test_copy_ctor_and_dtor_called)
{
}
- CopyChecker(const CopyChecker& other)
+ CopyChecker(CopyChecker const& other)
: m_was_copy_constructed(other.m_was_copy_constructed)
{
m_was_copy_constructed = true;
@@ -182,7 +182,7 @@ TEST_CASE(test_copy_ctor_and_dtor_called)
{
}
- MoveChecker(const MoveChecker& other)
+ MoveChecker(MoveChecker const& other)
: m_was_move_constructed(other.m_was_move_constructed)
{
EXPECT(false);
diff --git a/Tests/AK/TestQuickSort.cpp b/Tests/AK/TestQuickSort.cpp
index 12cbf18c7f..fbbd72326e 100644
--- a/Tests/AK/TestQuickSort.cpp
+++ b/Tests/AK/TestQuickSort.cpp
@@ -50,7 +50,7 @@ TEST_CASE(sorts_without_copy)
// So it provides no strong guarantees about the properties of quick_sort.
TEST_CASE(maximum_stack_depth)
{
- const int size = 256;
+ int const size = 256;
int* data = new int[size];
for (int i = 0; i < size; i++) {
@@ -72,7 +72,7 @@ TEST_CASE(maximum_stack_depth)
: max_depth(max_depth)
{
}
- DepthMeasurer(const DepthMeasurer& obj)
+ DepthMeasurer(DepthMeasurer const& obj)
: max_depth(obj.max_depth)
{
depth = obj.depth + 1;
diff --git a/Tests/AK/TestSinglyLinkedList.cpp b/Tests/AK/TestSinglyLinkedList.cpp
index 750940f74e..308e59f15a 100644
--- a/Tests/AK/TestSinglyLinkedList.cpp
+++ b/Tests/AK/TestSinglyLinkedList.cpp
@@ -37,14 +37,14 @@ TEST_CASE(should_find_mutable_with_predicate)
{
auto sut = make_list();
- EXPECT_EQ(4, *sut.find_if([](const auto v) { return v == 4; }));
+ EXPECT_EQ(4, *sut.find_if([](auto const v) { return v == 4; }));
- EXPECT_EQ(sut.end(), sut.find_if([](const auto v) { return v == 42; }));
+ EXPECT_EQ(sut.end(), sut.find_if([](auto const v) { return v == 42; }));
}
TEST_CASE(should_find_const)
{
- const auto sut = make_list();
+ auto const sut = make_list();
EXPECT_EQ(4, *sut.find(4));
@@ -53,11 +53,11 @@ TEST_CASE(should_find_const)
TEST_CASE(should_find_const_with_predicate)
{
- const auto sut = make_list();
+ auto const sut = make_list();
- EXPECT_EQ(4, *sut.find_if([](const auto v) { return v == 4; }));
+ EXPECT_EQ(4, *sut.find_if([](auto const v) { return v == 4; }));
- EXPECT_EQ(sut.end(), sut.find_if([](const auto v) { return v == 42; }));
+ EXPECT_EQ(sut.end(), sut.find_if([](auto const v) { return v == 42; }));
}
TEST_CASE(removal_during_iteration)
diff --git a/Tests/AK/TestSourceLocation.cpp b/Tests/AK/TestSourceLocation.cpp
index 8fc7f97426..1f8e6b2359 100644
--- a/Tests/AK/TestSourceLocation.cpp
+++ b/Tests/AK/TestSourceLocation.cpp
@@ -18,7 +18,7 @@ TEST_CASE(basic_scenario)
EXPECT_EQ(StringView(__FILE__), location.filename());
}
-static StringView test_default_arg(const SourceLocation& loc = SourceLocation::current())
+static StringView test_default_arg(SourceLocation const& loc = SourceLocation::current())
{
return loc.function_name();
}
diff --git a/Tests/AK/TestSpan.cpp b/Tests/AK/TestSpan.cpp
index c34e02b4bb..7cac637cc9 100644
--- a/Tests/AK/TestSpan.cpp
+++ b/Tests/AK/TestSpan.cpp
@@ -115,23 +115,23 @@ TEST_CASE(span_from_void_pointer)
{
int value = 0;
[[maybe_unused]] Bytes bytes0 { reinterpret_cast<void*>(value), 4 };
- [[maybe_unused]] ReadonlyBytes bytes1 { reinterpret_cast<const void*>(value), 4 };
+ [[maybe_unused]] ReadonlyBytes bytes1 { reinterpret_cast<void const*>(value), 4 };
}
TEST_CASE(span_from_c_string)
{
- const char* str = "Serenity";
+ char const* str = "Serenity";
[[maybe_unused]] ReadonlyBytes bytes { str, strlen(str) };
}
TEST_CASE(starts_with)
{
- const char* str = "HeyFriends!";
+ char const* str = "HeyFriends!";
ReadonlyBytes bytes { str, strlen(str) };
- const char* str_hey = "Hey";
+ char const* str_hey = "Hey";
ReadonlyBytes hey_bytes { str_hey, strlen(str_hey) };
EXPECT(bytes.starts_with(hey_bytes));
- const char* str_nah = "Nah";
+ char const* str_nah = "Nah";
ReadonlyBytes nah_bytes { str_nah, strlen(str_nah) };
EXPECT(!bytes.starts_with(nah_bytes));
diff --git a/Tests/AK/TestStringView.cpp b/Tests/AK/TestStringView.cpp
index c2c81aa5e6..6623081c3c 100644
--- a/Tests/AK/TestStringView.cpp
+++ b/Tests/AK/TestStringView.cpp
@@ -19,7 +19,7 @@ TEST_CASE(construct_empty)
TEST_CASE(view_literal)
{
- const char* truth = "cats rule dogs drool";
+ char const* truth = "cats rule dogs drool";
StringView view(truth);
EXPECT_EQ(view.is_null(), false);
EXPECT_EQ(view.characters_without_null_termination(), truth);
diff --git a/Tests/AK/TestTuple.cpp b/Tests/AK/TestTuple.cpp
index 6084819ade..9e7f82b724 100644
--- a/Tests/AK/TestTuple.cpp
+++ b/Tests/AK/TestTuple.cpp
@@ -97,8 +97,8 @@ TEST_CASE(apply)
// With const reference, taken from a const tuple
{
bool was_called = false;
- const auto& args_ref = args;
- args_ref.apply_as_args([&](const int& a, const int& b, const String& c) {
+ auto const& args_ref = args;
+ args_ref.apply_as_args([&](int const& a, int const& b, String const& c) {
was_called = true;
EXPECT_EQ(a, 1);
EXPECT_EQ(b, 2);
diff --git a/Tests/AK/TestTypeTraits.cpp b/Tests/AK/TestTypeTraits.cpp
index 59df08e38e..b1c464c90c 100644
--- a/Tests/AK/TestTypeTraits.cpp
+++ b/Tests/AK/TestTypeTraits.cpp
@@ -220,7 +220,7 @@ TEST_CASE(IsConstructible)
};
EXPECT_VARIADIC_TRAIT_TRUE(IsConstructible, D, int);
EXPECT_VARIADIC_TRAIT_TRUE(IsConstructible, D, char);
- EXPECT_VARIADIC_TRAIT_FALSE(IsConstructible, D, const char*);
+ EXPECT_VARIADIC_TRAIT_FALSE(IsConstructible, D, char const*);
EXPECT_VARIADIC_TRAIT_FALSE(IsConstructible, D, void);
}
diff --git a/Tests/AK/TestTypedTransfer.cpp b/Tests/AK/TestTypedTransfer.cpp
index 5a0c347092..392d6a6600 100644
--- a/Tests/AK/TestTypedTransfer.cpp
+++ b/Tests/AK/TestTypedTransfer.cpp
@@ -20,7 +20,7 @@ struct NonPrimitiveIntWrapper {
TEST_CASE(overlapping_source_and_destination_1)
{
- const Array<NonPrimitiveIntWrapper, 6> expected { 3, 4, 5, 6, 5, 6 };
+ Array<NonPrimitiveIntWrapper, 6> const expected { 3, 4, 5, 6, 5, 6 };
Array<NonPrimitiveIntWrapper, 6> actual { 1, 2, 3, 4, 5, 6 };
AK::TypedTransfer<NonPrimitiveIntWrapper>::copy(actual.data(), actual.data() + 2, 4);
@@ -31,7 +31,7 @@ TEST_CASE(overlapping_source_and_destination_1)
TEST_CASE(overlapping_source_and_destination_2)
{
- const Array<NonPrimitiveIntWrapper, 6> expected { 1, 2, 1, 2, 3, 4 };
+ Array<NonPrimitiveIntWrapper, 6> const expected { 1, 2, 1, 2, 3, 4 };
Array<NonPrimitiveIntWrapper, 6> actual { 1, 2, 3, 4, 5, 6 };
AK::TypedTransfer<NonPrimitiveIntWrapper>::copy(actual.data() + 2, actual.data(), 4);
diff --git a/Tests/AK/TestVector.cpp b/Tests/AK/TestVector.cpp
index 74038f3788..3216c24a3c 100644
--- a/Tests/AK/TestVector.cpp
+++ b/Tests/AK/TestVector.cpp
@@ -43,14 +43,14 @@ TEST_CASE(strings)
strings.append("DEF");
int loop_counter = 0;
- for (const String& string : strings) {
+ for (String const& string : strings) {
EXPECT(!string.is_null());
EXPECT(!string.is_empty());
++loop_counter;
}
loop_counter = 0;
- for (auto& string : (const_cast<const Vector<String>&>(strings))) {
+ for (auto& string : (const_cast<Vector<String> const&>(strings))) {
EXPECT(!string.is_null());
EXPECT(!string.is_empty());
++loop_counter;
@@ -402,7 +402,7 @@ TEST_CASE(should_find_value)
{
Vector<int> v { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
- const auto expected = v.begin() + 4;
+ auto const expected = v.begin() + 4;
EXPECT_EQ(expected, v.find(0));
}
@@ -411,9 +411,9 @@ TEST_CASE(should_find_predicate)
{
Vector<int> v { 1, 2, 3, 4, 0, 6, 7, 8, 0, 0 };
- const auto expected = v.begin() + 4;
+ auto const expected = v.begin() + 4;
- EXPECT_EQ(expected, v.find_if([](const auto v) { return v == 0; }));
+ EXPECT_EQ(expected, v.find_if([](auto const v) { return v == 0; }));
}
TEST_CASE(should_find_index)
@@ -548,8 +548,8 @@ TEST_CASE(rend)
{
Vector<int> v { 1, 2, 3, 4, 5, 6, 7, 8, 0 };
- const auto expected = v.end() - 5;
- const auto expected_in_reverse = v.rend() - 5;
+ auto const expected = v.end() - 5;
+ auto const expected_in_reverse = v.rend() - 5;
EXPECT_EQ(*expected, *expected_in_reverse);
}
diff --git a/Tests/Kernel/TestKernelPledge.cpp b/Tests/Kernel/TestKernelPledge.cpp
index 3a90450c2e..88bd5beac7 100644
--- a/Tests/Kernel/TestKernelPledge.cpp
+++ b/Tests/Kernel/TestKernelPledge.cpp
@@ -18,7 +18,7 @@ TEST_CASE(test_nonexistent_pledge)
TEST_CASE(test_pledge_argument_validation)
{
- const auto long_argument = String::repeated('a', 2048);
+ auto const long_argument = String::repeated('a', 2048);
auto res = pledge(long_argument.characters(), "stdio");
EXPECT_EQ(res, -1);
diff --git a/Tests/Kernel/bind-local-socket-to-symlink.cpp b/Tests/Kernel/bind-local-socket-to-symlink.cpp
index fed92a90a9..78f8f3994a 100644
--- a/Tests/Kernel/bind-local-socket-to-symlink.cpp
+++ b/Tests/Kernel/bind-local-socket-to-symlink.cpp
@@ -13,7 +13,7 @@
int main(int, char**)
{
- constexpr const char* path = "/tmp/foo";
+ constexpr char const* path = "/tmp/foo";
int rc = symlink("bar", path);
if (rc < 0) {
perror("symlink");
diff --git a/Tests/Kernel/elf-execve-mmap-race.cpp b/Tests/Kernel/elf-execve-mmap-race.cpp
index 5254fac3e5..931551e69a 100644
--- a/Tests/Kernel/elf-execve-mmap-race.cpp
+++ b/Tests/Kernel/elf-execve-mmap-race.cpp
@@ -16,7 +16,7 @@
#include <sys/wait.h>
#include <unistd.h>
-volatile bool hax = false;
+bool volatile hax = false;
int main()
{
diff --git a/Tests/Kernel/fuzz-syscalls.cpp b/Tests/Kernel/fuzz-syscalls.cpp
index 3b7a812c41..ba06429a0c 100644
--- a/Tests/Kernel/fuzz-syscalls.cpp
+++ b/Tests/Kernel/fuzz-syscalls.cpp
@@ -32,7 +32,7 @@ static bool is_nosys_syscall(int fn)
return fn == SC_futex || fn == SC_emuctl;
}
-static bool is_bad_idea(int fn, const size_t* direct_sc_args, const size_t* fake_sc_params, const char* some_string)
+static bool is_bad_idea(int fn, size_t const* direct_sc_args, size_t const* fake_sc_params, char const* some_string)
{
switch (fn) {
case SC_mprotect:
@@ -78,7 +78,7 @@ static void do_systematic_tests()
VERIFY(rc == -ENOSYS);
}
-static void randomize_from(size_t* buffer, size_t len, const Vector<size_t>& values)
+static void randomize_from(size_t* buffer, size_t len, Vector<size_t> const& values)
{
for (size_t i = 0; i < len; ++i) {
buffer[i] = values[get_random_uniform(values.size())];
@@ -122,7 +122,7 @@ static void do_random_tests()
size_t direct_sc_args[3] = { 0 };
// Isolate to a separate region to make corruption less likely, because we will write to it:
auto* fake_sc_params = reinterpret_cast<size_t*>(mmap(nullptr, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_RANDOMIZED, 0, 0));
- const char* some_string = "Hello, world!";
+ char const* some_string = "Hello, world!";
Vector<size_t> interesting_values = {
0,
1,
@@ -134,7 +134,7 @@ static void do_random_tests()
0xffffffff,
};
dbgln("Doing a few random syscalls with:");
- for (const auto& interesting_value : interesting_values) {
+ for (auto const& interesting_value : interesting_values) {
dbgln(" {0} ({0:p})", interesting_value);
}
for (size_t i = 0; i < fuzz_syscall_count; ++i) {
diff --git a/Tests/Kernel/kill-pidtid-confusion.cpp b/Tests/Kernel/kill-pidtid-confusion.cpp
index f75add2f02..be50df5797 100644
--- a/Tests/Kernel/kill-pidtid-confusion.cpp
+++ b/Tests/Kernel/kill-pidtid-confusion.cpp
@@ -55,7 +55,7 @@ static void fork_into(void(fn)())
static void thread_into(void* (*fn)(void*))
{
pthread_t tid;
- const int rc = pthread_create(&tid, nullptr, fn, nullptr);
+ int const rc = pthread_create(&tid, nullptr, fn, nullptr);
if (rc < 0) {
perror("pthread_create");
exit(1);
@@ -64,7 +64,7 @@ static void thread_into(void* (*fn)(void*))
static void sleep_steps(useconds_t steps)
{
- const int rc = usleep(steps * STEP_SIZE);
+ int const rc = usleep(steps * STEP_SIZE);
if (rc < 0) {
perror("usleep");
VERIFY_NOT_REACHED();
diff --git a/Tests/Kernel/mprotect-multi-region-mprotect.cpp b/Tests/Kernel/mprotect-multi-region-mprotect.cpp
index 6e36859338..07e278a3de 100644
--- a/Tests/Kernel/mprotect-multi-region-mprotect.cpp
+++ b/Tests/Kernel/mprotect-multi-region-mprotect.cpp
@@ -67,7 +67,7 @@ int main()
return 1;
}
- //cleanup
+ // cleanup
munmap(map1, 6 * PAGE_SIZE);
outln("PASS");
diff --git a/Tests/Kernel/nanosleep-race-outbuf-munmap.cpp b/Tests/Kernel/nanosleep-race-outbuf-munmap.cpp
index e598b22083..a86da20130 100644
--- a/Tests/Kernel/nanosleep-race-outbuf-munmap.cpp
+++ b/Tests/Kernel/nanosleep-race-outbuf-munmap.cpp
@@ -19,7 +19,7 @@ static void signal_printer(int)
typedef struct yank_shared_t {
timespec* remaining_sleep;
// TODO: Be nice and use thread ID
- //pthread_t sleeper_thread;
+ // pthread_t sleeper_thread;
} yank_shared_t;
static void* yanker_fn(void* shared_)
diff --git a/Tests/Kernel/pthread-cond-timedwait-example.cpp b/Tests/Kernel/pthread-cond-timedwait-example.cpp
index 799b0fa6b3..c2bd2b62c5 100644
--- a/Tests/Kernel/pthread-cond-timedwait-example.cpp
+++ b/Tests/Kernel/pthread-cond-timedwait-example.cpp
@@ -14,7 +14,7 @@
#include <unistd.h>
struct worker_t {
- const char* name;
+ char const* name;
int count;
pthread_t thread;
pthread_mutex_t lock;
@@ -45,7 +45,7 @@ static void* run_worker(void* args)
return nullptr;
}
-static void init_worker(worker_t* worker, const char* name, long int wait_time)
+static void init_worker(worker_t* worker, char const* name, long int wait_time)
{
worker->name = name;
worker->wait_time = wait_time;
diff --git a/Tests/Kernel/setpgid-across-sessions-without-leader.cpp b/Tests/Kernel/setpgid-across-sessions-without-leader.cpp
index e22c041880..0626c4b458 100644
--- a/Tests/Kernel/setpgid-across-sessions-without-leader.cpp
+++ b/Tests/Kernel/setpgid-across-sessions-without-leader.cpp
@@ -57,7 +57,7 @@ static void fork_into(void (*fn)(void*), void* arg)
exit(1);
}
if (rc > 0) {
- const int disown_rc = disown(rc);
+ int const disown_rc = disown(rc);
if (disown_rc < 0) {
perror("disown");
dbgln("This might cause PA1 to remain in the Zombie state, "
@@ -73,7 +73,7 @@ static void fork_into(void (*fn)(void*), void* arg)
static void sleep_steps(useconds_t steps)
{
- const int rc = usleep(steps * STEP_SIZE);
+ int const rc = usleep(steps * STEP_SIZE);
if (rc < 0) {
perror("usleep");
VERIFY_NOT_REACHED();
diff --git a/Tests/Kernel/siginfo-example.cpp b/Tests/Kernel/siginfo-example.cpp
index 75cf4745f9..6495570eca 100644
--- a/Tests/Kernel/siginfo-example.cpp
+++ b/Tests/Kernel/siginfo-example.cpp
@@ -17,7 +17,7 @@ volatile ucontext_t saved_ucontext;
siginfo_t* sig_info_addr;
ucontext_t* ucontext_addr;
void* stack_ptr;
-volatile bool signal_was_delivered = false;
+bool volatile signal_was_delivered = false;
static void signal_handler(int sig, siginfo_t* sig_info, void* u_context)
{
diff --git a/Tests/Kernel/stress-truncate.cpp b/Tests/Kernel/stress-truncate.cpp
index 8c683477bd..7164bb05b2 100644
--- a/Tests/Kernel/stress-truncate.cpp
+++ b/Tests/Kernel/stress-truncate.cpp
@@ -13,7 +13,7 @@
int main(int argc, char** argv)
{
- const char* target = nullptr;
+ char const* target = nullptr;
int max_file_size = 1024 * 1024;
int count = 1024;
diff --git a/Tests/Kernel/stress-writeread.cpp b/Tests/Kernel/stress-writeread.cpp
index 6ae5bf5c46..07666b5ed6 100644
--- a/Tests/Kernel/stress-writeread.cpp
+++ b/Tests/Kernel/stress-writeread.cpp
@@ -60,7 +60,7 @@ bool write_block(int fd, int seed, off_t block, AK::ByteBuffer& buffer)
int main(int argc, char** argv)
{
- const char* target = nullptr;
+ char const* target = nullptr;
int min_block_offset = 0;
int block_length = 2048;
int block_size = 512;
diff --git a/Tests/LibC/TestIo.cpp b/Tests/LibC/TestIo.cpp
index bd47d7d6c8..b8c833ecca 100644
--- a/Tests/LibC/TestIo.cpp
+++ b/Tests/LibC/TestIo.cpp
@@ -348,9 +348,9 @@ TEST_CASE(writev)
EXPECT(rc == 0);
iovec iov[2];
- iov[0].iov_base = const_cast<void*>((const void*)"Hello");
+ iov[0].iov_base = const_cast<void*>((void const*)"Hello");
iov[0].iov_len = 5;
- iov[1].iov_base = const_cast<void*>((const void*)"Friends");
+ iov[1].iov_base = const_cast<void*>((void const*)"Friends");
iov[1].iov_len = 7;
int nwritten = writev(pipefds[1], iov, 2);
EXPECT_EQ(nwritten, 12);
diff --git a/Tests/LibC/TestLibCMkTemp.cpp b/Tests/LibC/TestLibCMkTemp.cpp
index 03d377642b..80f279adaa 100644
--- a/Tests/LibC/TestLibCMkTemp.cpp
+++ b/Tests/LibC/TestLibCMkTemp.cpp
@@ -33,7 +33,7 @@ TEST_CASE(test_mktemp_unique_filename)
} else {
wait(NULL);
- auto path1 = String::formatted("{}", reinterpret_cast<const char*>(ptr));
+ auto path1 = String::formatted("{}", reinterpret_cast<char const*>(ptr));
char path[] = "/tmp/test.mktemp.XXXXXX";
auto path2 = String::formatted("{}", mktemp(path));
@@ -63,7 +63,7 @@ TEST_CASE(test_mkdtemp_unique_filename)
} else {
wait(NULL);
- auto path1 = String::formatted("{}", reinterpret_cast<const char*>(ptr));
+ auto path1 = String::formatted("{}", reinterpret_cast<char const*>(ptr));
char path[] = "/tmp/test.mkdtemp.XXXXXX";
auto path2 = String::formatted("{}", mkdtemp(path));
@@ -101,7 +101,7 @@ TEST_CASE(test_mkstemp_unique_filename)
} else {
wait(NULL);
- auto path1 = String::formatted("{}", reinterpret_cast<const char*>(ptr));
+ auto path1 = String::formatted("{}", reinterpret_cast<char const*>(ptr));
char path[] = "/tmp/test.mkstemp.XXXXXX";
auto fd = mkstemp(path);
diff --git a/Tests/LibC/TestLibCSetjmp.cpp b/Tests/LibC/TestLibCSetjmp.cpp
index 8e4facddd9..1519f5d743 100644
--- a/Tests/LibC/TestLibCSetjmp.cpp
+++ b/Tests/LibC/TestLibCSetjmp.cpp
@@ -12,7 +12,7 @@
TEST_CASE(setjmp)
{
jmp_buf env;
- volatile int set = 1;
+ int volatile set = 1;
if (setjmp(env)) {
EXPECT_EQ(set, 0);
@@ -29,7 +29,7 @@ TEST_CASE(setjmp)
TEST_CASE(setjmp_zero)
{
jmp_buf env;
- volatile int set = 1;
+ int volatile set = 1;
switch (setjmp(env)) {
case 0:
@@ -50,7 +50,7 @@ TEST_CASE(setjmp_zero)
TEST_CASE(setjmp_value)
{
jmp_buf env;
- volatile int set = 1;
+ int volatile set = 1;
switch (setjmp(env)) {
case 0:
@@ -71,7 +71,7 @@ TEST_CASE(setjmp_value)
TEST_CASE(sigsetjmp)
{
sigjmp_buf env;
- volatile int set = 1;
+ int volatile set = 1;
if (sigsetjmp(env, 0)) {
EXPECT_EQ(set, 0);
@@ -88,7 +88,7 @@ TEST_CASE(sigsetjmp)
TEST_CASE(sigsetjmp_zero)
{
sigjmp_buf env;
- volatile int set = 1;
+ int volatile set = 1;
switch (sigsetjmp(env, 0)) {
case 0:
@@ -109,7 +109,7 @@ TEST_CASE(sigsetjmp_zero)
TEST_CASE(sigsetjmp_value)
{
sigjmp_buf env;
- volatile int set = 1;
+ int volatile set = 1;
switch (sigsetjmp(env, 0)) {
case 0:
diff --git a/Tests/LibC/TestLibCTime.cpp b/Tests/LibC/TestLibCTime.cpp
index 72e0777b2c..6534e9e0c1 100644
--- a/Tests/LibC/TestLibCTime.cpp
+++ b/Tests/LibC/TestLibCTime.cpp
@@ -8,7 +8,7 @@
#include <LibTest/TestCase.h>
#include <time.h>
-const auto expected_epoch = "Thu Jan 1 00:00:00 1970\n"sv;
+auto const expected_epoch = "Thu Jan 1 00:00:00 1970\n"sv;
class TimeZoneGuard {
public:
diff --git a/Tests/LibC/TestMemmem.cpp b/Tests/LibC/TestMemmem.cpp
index f266b53dad..a6aefe388e 100644
--- a/Tests/LibC/TestMemmem.cpp
+++ b/Tests/LibC/TestMemmem.cpp
@@ -10,19 +10,19 @@
#include <string.h>
struct TestCase {
- const u8* haystack;
+ u8 const* haystack;
size_t haystack_length;
- const u8* needle;
+ u8 const* needle;
size_t needle_length;
ssize_t matching_offset { -1 };
};
const static TestCase g_test_cases[] = {
- { (const u8*) {}, 0u, (const u8*) {}, 0u, 0 },
+ { (u8 const*) {}, 0u, (u8 const*) {}, 0u, 0 },
{ (const u8[]) { 1, 2, 3 }, 3u, (const u8[]) { 1, 2, 3 }, 3u, 0 },
{ (const u8[]) { 1, 2, 4 }, 3u, (const u8[]) { 1, 2, 3 }, 3u, -1 },
- { (const u8*)"abcdef", 6u, (const u8[]) {}, 0u, 0 },
- { (const u8*)"abcdef", 6u, (const u8*)"de", 2u, 3 },
+ { (u8 const*)"abcdef", 6u, (const u8[]) {}, 0u, 0 },
+ { (u8 const*)"abcdef", 6u, (u8 const*)"de", 2u, 3 },
{ (const u8[]) { 0, 1, 2, 5, 2, 5 }, 6u, (const u8[]) { 1 }, 1u, 1 },
{ (const u8[]) { 0, 1, 2, 5, 2, 5 }, 6u, (const u8[]) { 1, 2 }, 2u, 1 },
{ (const u8[]) { 0, 1, 1, 2 }, 4u, (const u8[]) { 1, 5 }, 2u, -1 },
@@ -33,7 +33,7 @@ const static TestCase g_test_cases[] = {
TEST_CASE(memmem_search)
{
size_t i = 0;
- for (const auto& test_case : g_test_cases) {
+ for (auto const& test_case : g_test_cases) {
auto expected = test_case.matching_offset >= 0 ? test_case.haystack + test_case.matching_offset : nullptr;
auto result = memmem(test_case.haystack, test_case.haystack_length, test_case.needle, test_case.needle_length);
if (result != expected) {
diff --git a/Tests/LibC/TestQsort.cpp b/Tests/LibC/TestQsort.cpp
index 5a194d6b24..12df7b644f 100644
--- a/Tests/LibC/TestQsort.cpp
+++ b/Tests/LibC/TestQsort.cpp
@@ -19,10 +19,10 @@ struct SortableObject {
int m_payload;
};
-static int compare_sortable_object(const void* a, const void* b)
+static int compare_sortable_object(void const* a, void const* b)
{
- const int key1 = static_cast<const SortableObject*>(a)->m_key;
- const int key2 = static_cast<const SortableObject*>(b)->m_key;
+ int const key1 = static_cast<SortableObject const*>(a)->m_key;
+ int const key2 = static_cast<SortableObject const*>(b)->m_key;
if (key1 < key2) {
return -1;
} else if (key1 == key2) {
@@ -60,16 +60,16 @@ TEST_CASE(quick_sort)
qsort(test_objects.data(), test_objects.size(), sizeof(SortableObject), compare_sortable_object);
// Check that the objects are sorted by key
for (auto i = 0u; i + 1 < test_objects.size(); ++i) {
- const auto& key1 = test_objects[i].m_key;
- const auto& key2 = test_objects[i + 1].m_key;
+ auto const& key1 = test_objects[i].m_key;
+ auto const& key2 = test_objects[i + 1].m_key;
if (key1 > key2) {
FAIL(String::formatted("saw key {} before key {}\n", key1, key2));
}
}
// Check that the object's payloads have not been corrupted
for (auto i = 0u; i < test_objects.size(); ++i) {
- const auto expected = calc_payload_for_pos(i);
- const auto payload = test_objects[i].m_payload;
+ auto const expected = calc_payload_for_pos(i);
+ auto const payload = test_objects[i].m_payload;
if (payload != expected) {
FAIL(String::formatted("Expected payload {} for pos {}, got payload {}", expected, i, payload));
}
diff --git a/Tests/LibC/TestRealpath.cpp b/Tests/LibC/TestRealpath.cpp
index c0fb283890..21a1d527f8 100644
--- a/Tests/LibC/TestRealpath.cpp
+++ b/Tests/LibC/TestRealpath.cpp
@@ -21,7 +21,7 @@ static constexpr char PATH_LOREM_250[] = "This-is-an-annoyingly-long-name-that-s
static constexpr size_t ITERATION_DEPTH = 17;
-static void check_result(const char* what, const String& expected, const char* actual)
+static void check_result(char const* what, String const& expected, char const* actual)
{
if (expected != actual)
FAIL(String::formatted("Expected {} to be \"{}\" ({} characters)", what, actual, actual ? strlen(actual) : 0));
diff --git a/Tests/LibC/TestScanf.cpp b/Tests/LibC/TestScanf.cpp
index 5209088400..5c1a1c934a 100644
--- a/Tests/LibC/TestScanf.cpp
+++ b/Tests/LibC/TestScanf.cpp
@@ -65,7 +65,7 @@ constexpr static Array<unsigned char, 32> to_value_t(T x)
}
template<size_t N>
-constexpr static Array<unsigned char, 32> str_to_value_t(const char (&x)[N])
+constexpr static Array<unsigned char, 32> str_to_value_t(char const (&x)[N])
{
Array<unsigned char, 32> value { 0 };
for (size_t i = 0; i < N; ++i)
@@ -78,7 +78,7 @@ struct Argument {
void* data;
};
-static Array<u8, 32> arg_to_value_t(const Argument& arg)
+static Array<u8, 32> arg_to_value_t(Argument const& arg)
{
if (arg.size == 1)
return to_value_t(*(u8*)arg.data);
@@ -140,8 +140,8 @@ Argument charstararg1 { sizeof(charstar), &_charstararg1[0] };
Argument charstararg2 { sizeof(charstar), &_charstararg2[0] };
struct TestSuite {
- const char* format;
- const char* input;
+ char const* format;
+ char const* input;
int expected_return_value;
size_t argument_count;
Argument arguments[8];
@@ -184,7 +184,7 @@ const TestSuite test_suites[] {
bool g_any_failed = false;
-static bool check_value_conformance(const TestSuite& test)
+static bool check_value_conformance(TestSuite const& test)
{
bool fail = false;
for (size_t i = 0; i < test.argument_count; ++i) {
@@ -192,8 +192,8 @@ static bool check_value_conformance(const TestSuite& test)
auto arg_value = arg_to_value_t(arg);
auto& value = test.expected_values[i];
if (arg_value != value) {
- auto arg_ptr = (const u32*)arg_value.data();
- auto value_ptr = (const u32*)value.data();
+ auto arg_ptr = (u32 const*)arg_value.data();
+ auto value_ptr = (u32 const*)value.data();
printf(" value %zu FAIL,\n", i);
printf(" expected %08x%08x%08x%08x%08x%08x%08x%08x\n",
value_ptr[0], value_ptr[1], value_ptr[2], value_ptr[3],
@@ -210,7 +210,7 @@ static bool check_value_conformance(const TestSuite& test)
return !fail;
}
-static void do_one_test(const TestSuite& test)
+static void do_one_test(TestSuite const& test)
{
printf("Testing '%s' against '%s'...\n", test.input, test.format);
diff --git a/Tests/LibC/TestSearch.cpp b/Tests/LibC/TestSearch.cpp
index 892295d42c..1b30076580 100644
--- a/Tests/LibC/TestSearch.cpp
+++ b/Tests/LibC/TestSearch.cpp
@@ -13,11 +13,11 @@
#define NODE(node) static_cast<struct search_tree_node*>(node)
#define ROOTP(root) reinterpret_cast<void**>(root)
-#define COMP(func) reinterpret_cast<int (*)(const void*, const void*)>(func)
+#define COMP(func) reinterpret_cast<int (*)(void const*, void const*)>(func)
#define U8(value) static_cast<u8>(value)
struct twalk_test_entry {
- const void* node;
+ void const* node;
VISIT order;
int depth;
};
@@ -30,7 +30,7 @@ TEST_CASE(tsearch)
{
struct search_tree_node* root = nullptr;
void* ret;
- const char* key;
+ char const* key;
char* search;
// Try a nullptr rootp.
@@ -150,8 +150,8 @@ TEST_CASE(tfind)
delete_node_recursive(root);
}
-void twalk_action(const void* node, VISIT order, int depth);
-void twalk_action(const void* node, VISIT order, int depth)
+void twalk_action(void const* node, VISIT order, int depth);
+void twalk_action(void const* node, VISIT order, int depth)
{
static int count = 0;
static const struct twalk_test_entry* tests = nullptr;
diff --git a/Tests/LibC/TestSnprintf.cpp b/Tests/LibC/TestSnprintf.cpp
index 125f045c6b..0ab31f79d1 100644
--- a/Tests/LibC/TestSnprintf.cpp
+++ b/Tests/LibC/TestSnprintf.cpp
@@ -18,16 +18,16 @@
template<typename TArg>
struct Testcase {
- const char* dest;
+ char const* dest;
size_t dest_n;
- const char* fmt;
+ char const* fmt;
const TArg arg;
int expected_return;
- const char* dest_expected;
+ char const* dest_expected;
size_t dest_expected_n; // == dest_n
};
-static String show(const ByteBuffer& buf)
+static String show(ByteBuffer const& buf)
{
StringBuilder builder;
for (size_t i = 0; i < buf.size(); ++i) {
@@ -46,7 +46,7 @@ static String show(const ByteBuffer& buf)
}
template<typename TArg>
-static bool test_single(const Testcase<TArg>& testcase)
+static bool test_single(Testcase<TArg> const& testcase)
{
constexpr size_t SANDBOX_CANARY_SIZE = 8;
@@ -109,41 +109,41 @@ static bool test_single(const Testcase<TArg>& testcase)
// Drop the NUL terminator added by the C++ compiler.
#define LITERAL(x) x, (sizeof(x) - 1)
-static const char* const POISON = (const char*)1;
+static char const* const POISON = (char const*)1;
TEST_CASE(golden_path)
{
- EXPECT(test_single<const char*>({ LITERAL("Hello World!\0\0\0"), "Hello Friend!", POISON, 13, LITERAL("Hello Friend!\0\0") }));
- EXPECT(test_single<const char*>({ LITERAL("Hello World!\0\0\0"), "Hello %s!", "Friend", 13, LITERAL("Hello Friend!\0\0") }));
- EXPECT(test_single<const char*>({ LITERAL("aaaaaaaaaa"), "whf", POISON, 3, LITERAL("whf\0aaaaaa") }));
- EXPECT(test_single<const char*>({ LITERAL("aaaaaaaaaa"), "w%sf", "h", 3, LITERAL("whf\0aaaaaa") }));
+ EXPECT(test_single<char const*>({ LITERAL("Hello World!\0\0\0"), "Hello Friend!", POISON, 13, LITERAL("Hello Friend!\0\0") }));
+ EXPECT(test_single<char const*>({ LITERAL("Hello World!\0\0\0"), "Hello %s!", "Friend", 13, LITERAL("Hello Friend!\0\0") }));
+ EXPECT(test_single<char const*>({ LITERAL("aaaaaaaaaa"), "whf", POISON, 3, LITERAL("whf\0aaaaaa") }));
+ EXPECT(test_single<char const*>({ LITERAL("aaaaaaaaaa"), "w%sf", "h", 3, LITERAL("whf\0aaaaaa") }));
}
TEST_CASE(border_cases)
{
- EXPECT(test_single<const char*>({ LITERAL("Hello World!\0\0"), "Hello Friend!", POISON, 13, LITERAL("Hello Friend!\0") }));
- EXPECT(test_single<const char*>({ LITERAL("AAAA"), "whf", POISON, 3, LITERAL("whf\0") }));
- EXPECT(test_single<const char*>({ LITERAL("AAAA"), "%s", "whf", 3, LITERAL("whf\0") }));
+ EXPECT(test_single<char const*>({ LITERAL("Hello World!\0\0"), "Hello Friend!", POISON, 13, LITERAL("Hello Friend!\0") }));
+ EXPECT(test_single<char const*>({ LITERAL("AAAA"), "whf", POISON, 3, LITERAL("whf\0") }));
+ EXPECT(test_single<char const*>({ LITERAL("AAAA"), "%s", "whf", 3, LITERAL("whf\0") }));
}
TEST_CASE(too_long)
{
- EXPECT(test_single<const char*>({ LITERAL("Hello World!\0"), "Hello Friend!", POISON, 13, LITERAL("Hello Friend\0") }));
- EXPECT(test_single<const char*>({ LITERAL("Hello World!\0"), "This source is %s too long!", "just *way*", 35, LITERAL("This source \0") }));
- EXPECT(test_single<const char*>({ LITERAL("x"), "This source is %s too long!", "just *way*", 35, LITERAL("\0") }));
+ EXPECT(test_single<char const*>({ LITERAL("Hello World!\0"), "Hello Friend!", POISON, 13, LITERAL("Hello Friend\0") }));
+ EXPECT(test_single<char const*>({ LITERAL("Hello World!\0"), "This source is %s too long!", "just *way*", 35, LITERAL("This source \0") }));
+ EXPECT(test_single<char const*>({ LITERAL("x"), "This source is %s too long!", "just *way*", 35, LITERAL("\0") }));
}
TEST_CASE(special_cases)
{
- EXPECT(test_single<const char*>({ LITERAL(""), "Hello Friend!", POISON, 13, LITERAL("") }));
+ EXPECT(test_single<char const*>({ LITERAL(""), "Hello Friend!", POISON, 13, LITERAL("") }));
EXPECT_EQ(snprintf(nullptr, 0, "Hello, friend!"), 14);
- EXPECT(test_single<const char*>({ LITERAL(""), "", POISON, 0, LITERAL("") }));
- EXPECT(test_single<const char*>({ LITERAL("x"), "", POISON, 0, LITERAL("\0") }));
- EXPECT(test_single<const char*>({ LITERAL("xx"), "", POISON, 0, LITERAL("\0x") }));
- EXPECT(test_single<const char*>({ LITERAL("xxx"), "", POISON, 0, LITERAL("\0xx") }));
- EXPECT(test_single<const char*>({ LITERAL(""), "whf", POISON, 3, LITERAL("") }));
- EXPECT(test_single<const char*>({ LITERAL("x"), "whf", POISON, 3, LITERAL("\0") }));
- EXPECT(test_single<const char*>({ LITERAL("xx"), "whf", POISON, 3, LITERAL("w\0") }));
+ EXPECT(test_single<char const*>({ LITERAL(""), "", POISON, 0, LITERAL("") }));
+ EXPECT(test_single<char const*>({ LITERAL("x"), "", POISON, 0, LITERAL("\0") }));
+ EXPECT(test_single<char const*>({ LITERAL("xx"), "", POISON, 0, LITERAL("\0x") }));
+ EXPECT(test_single<char const*>({ LITERAL("xxx"), "", POISON, 0, LITERAL("\0xx") }));
+ EXPECT(test_single<char const*>({ LITERAL(""), "whf", POISON, 3, LITERAL("") }));
+ EXPECT(test_single<char const*>({ LITERAL("x"), "whf", POISON, 3, LITERAL("\0") }));
+ EXPECT(test_single<char const*>({ LITERAL("xx"), "whf", POISON, 3, LITERAL("w\0") }));
}
TEST_CASE(octal_values)
diff --git a/Tests/LibC/TestStrlcpy.cpp b/Tests/LibC/TestStrlcpy.cpp
index 9458710600..407c307e2f 100644
--- a/Tests/LibC/TestStrlcpy.cpp
+++ b/Tests/LibC/TestStrlcpy.cpp
@@ -14,15 +14,15 @@
#include <string.h>
struct Testcase {
- const char* dest;
+ char const* dest;
size_t dest_n;
- const char* src;
+ char const* src;
size_t src_n;
- const char* dest_expected;
+ char const* dest_expected;
size_t dest_expected_n; // == dest_n
};
-static String show(const ByteBuffer& buf)
+static String show(ByteBuffer const& buf)
{
StringBuilder builder;
for (size_t i = 0; i < buf.size(); ++i) {
@@ -40,7 +40,7 @@ static String show(const ByteBuffer& buf)
return builder.build();
}
-static bool test_single(const Testcase& testcase)
+static bool test_single(Testcase const& testcase)
{
constexpr size_t SANDBOX_CANARY_SIZE = 8;
diff --git a/Tests/LibC/TestStrtodAccuracy.cpp b/Tests/LibC/TestStrtodAccuracy.cpp
index 5f57769299..f251b441ad 100644
--- a/Tests/LibC/TestStrtodAccuracy.cpp
+++ b/Tests/LibC/TestStrtodAccuracy.cpp
@@ -18,10 +18,10 @@ static constexpr char TEXT_RESET[] = "\x1b[0m";
static constexpr long long LENIENCY = 8;
struct Testcase {
- const char* test_name;
+ char const* test_name;
int should_consume;
- const char* hex;
- const char* test_string;
+ char const* hex;
+ char const* test_string;
};
static Testcase TESTCASES[] = {
@@ -231,7 +231,7 @@ static Testcase TESTCASES[] = {
constexpr size_t NUM_TESTCASES = sizeof(TESTCASES) / sizeof(TESTCASES[0]);
-typedef double (*strtod_fn_t)(const char* str, char** endptr);
+typedef double (*strtod_fn_t)(char const* str, char** endptr);
static long long cast_ll(double d)
{
@@ -250,7 +250,7 @@ static long long cast_ll(double d)
return readable.as_ll;
}
-static bool is_strtod_close(strtod_fn_t strtod_fn, const char* test_string, const char* expect_hex, int expect_consume, long long expect_ll)
+static bool is_strtod_close(strtod_fn_t strtod_fn, char const* test_string, char const* expect_hex, int expect_consume, long long expect_ll)
{
union readable_t {
double as_double;
@@ -277,7 +277,7 @@ static bool is_strtod_close(strtod_fn_t strtod_fn, const char* test_string, cons
if (endptr < test_string) {
actual_consume = 999;
} else {
- const char* max_endptr = test_string + strlen(test_string);
+ char const* max_endptr = test_string + strlen(test_string);
actual_consume_possible = endptr <= max_endptr;
actual_consume = endptr - test_string;
}
@@ -303,7 +303,7 @@ static bool is_strtod_close(strtod_fn_t strtod_fn, const char* test_string, cons
return !(wrong_hex || error_cns || wrong_cns);
}
-static long long hex_to_ll(const char* hex)
+static long long hex_to_ll(char const* hex)
{
long long result = 0;
for (int i = 0; i < 16; ++i) {
diff --git a/Tests/LibC/TestWchar.cpp b/Tests/LibC/TestWchar.cpp
index 05c4f24bb6..d8b7c0c236 100644
--- a/Tests/LibC/TestWchar.cpp
+++ b/Tests/LibC/TestWchar.cpp
@@ -13,7 +13,7 @@
TEST_CASE(wcspbrk)
{
- const wchar_t* input;
+ wchar_t const* input;
wchar_t* ret;
// Test empty haystack.
@@ -40,7 +40,7 @@ TEST_CASE(wcspbrk)
TEST_CASE(wcsstr)
{
- const wchar_t* input = L"abcde";
+ wchar_t const* input = L"abcde";
wchar_t* ret;
// Empty needle should return haystack.
@@ -70,7 +70,7 @@ TEST_CASE(wcsstr)
TEST_CASE(wmemchr)
{
- const wchar_t* input = L"abcde";
+ wchar_t const* input = L"abcde";
wchar_t* ret;
// Empty haystack returns nothing.
@@ -102,7 +102,7 @@ TEST_CASE(wmemchr)
TEST_CASE(wmemcpy)
{
- const wchar_t* input = L"abc\0def";
+ wchar_t const* input = L"abc\0def";
auto buf = static_cast<wchar_t*>(malloc(8 * sizeof(wchar_t)));
if (!buf) {
@@ -142,7 +142,7 @@ TEST_CASE(wmemset)
TEST_CASE(wmemmove)
{
wchar_t* ret;
- const wchar_t* string = L"abc\0def";
+ wchar_t const* string = L"abc\0def";
auto buf = static_cast<wchar_t*>(calloc(32, sizeof(wchar_t)));
if (!buf) {
@@ -324,7 +324,7 @@ TEST_CASE(wcsrtombs)
char buf[MB_LEN_MAX * 4];
const wchar_t good_chars[] = { L'\U0001F41E', L'\U0001F41E', L'\0' };
const wchar_t bad_chars[] = { L'\U0001F41E', static_cast<wchar_t>(0x1111F41E), L'\0' };
- const wchar_t* src;
+ wchar_t const* src;
size_t ret = 0;
// Convert normal and valid wchar_t values.
@@ -369,7 +369,7 @@ TEST_CASE(wcsnrtombs)
{
mbstate_t state = {};
const wchar_t good_chars[] = { L'\U0001F41E', L'\U0001F41E', L'\0' };
- const wchar_t* src;
+ wchar_t const* src;
size_t ret = 0;
// Convert nothing.
@@ -395,9 +395,9 @@ TEST_CASE(mbsrtowcs)
{
mbstate_t state = {};
wchar_t buf[4];
- const char good_chars[] = "\xf0\x9f\x90\x9e\xf0\x9f\x90\x9e";
- const char bad_chars[] = "\xf0\x9f\x90\x9e\xf0\xff\x90\x9e";
- const char* src;
+ char const good_chars[] = "\xf0\x9f\x90\x9e\xf0\x9f\x90\x9e";
+ char const bad_chars[] = "\xf0\x9f\x90\x9e\xf0\xff\x90\x9e";
+ char const* src;
size_t ret = 0;
// Convert normal and valid multibyte sequences.
@@ -445,8 +445,8 @@ TEST_CASE(mbsrtowcs)
TEST_CASE(mbsnrtowcs)
{
mbstate_t state = {};
- const char good_chars[] = "\xf0\x9f\x90\x9e\xf0\x9f\x90\x9e";
- const char* src;
+ char const good_chars[] = "\xf0\x9f\x90\x9e\xf0\x9f\x90\x9e";
+ char const* src;
size_t ret = 0;
// Convert nothing.
diff --git a/Tests/LibCompress/TestDeflate.cpp b/Tests/LibCompress/TestDeflate.cpp
index b325ffa3db..d2bc4e82c6 100644
--- a/Tests/LibCompress/TestDeflate.cpp
+++ b/Tests/LibCompress/TestDeflate.cpp
@@ -14,19 +14,19 @@
TEST_CASE(canonical_code_simple)
{
- const Array<u8, 32> code {
+ Array<u8, 32> const code {
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05
};
- const Array<u8, 6> input {
+ Array<u8, 6> const input {
0x00, 0x42, 0x84, 0xa9, 0xb0, 0x15
};
- const Array<u32, 9> output {
+ Array<u32, 9> const output {
0x00, 0x01, 0x01, 0x02, 0x03, 0x05, 0x08, 0x0d, 0x15
};
- const auto huffman = Compress::CanonicalCode::from_bytes(code).value();
+ auto const huffman = Compress::CanonicalCode::from_bytes(code).value();
auto memory_stream = InputMemoryStream { input };
auto bit_stream = InputBitStream { memory_stream };
@@ -36,17 +36,17 @@ TEST_CASE(canonical_code_simple)
TEST_CASE(canonical_code_complex)
{
- const Array<u8, 6> code {
+ Array<u8, 6> const code {
0x03, 0x02, 0x03, 0x03, 0x02, 0x03
};
- const Array<u8, 4> input {
+ Array<u8, 4> const input {
0xa1, 0xf3, 0xa1, 0xf3
};
- const Array<u32, 12> output {
+ Array<u32, 12> const output {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05
};
- const auto huffman = Compress::CanonicalCode::from_bytes(code).value();
+ auto const huffman = Compress::CanonicalCode::from_bytes(code).value();
auto memory_stream = InputMemoryStream { input };
auto bit_stream = InputBitStream { memory_stream };
@@ -56,7 +56,7 @@ TEST_CASE(canonical_code_complex)
TEST_CASE(deflate_decompress_compressed_block)
{
- const Array<u8, 28> compressed {
+ Array<u8, 28> const compressed {
0x0B, 0xC9, 0xC8, 0x2C, 0x56, 0x00, 0xA2, 0x44, 0x85, 0xE2, 0xCC, 0xDC,
0x82, 0x9C, 0x54, 0x85, 0x92, 0xD4, 0x8A, 0x12, 0x85, 0xB4, 0x4C, 0x20,
0xCB, 0x4A, 0x13, 0x00
@@ -64,26 +64,26 @@ TEST_CASE(deflate_decompress_compressed_block)
const u8 uncompressed[] = "This is a simple text file :)";
- const auto decompressed = Compress::DeflateDecompressor::decompress_all(compressed);
+ auto const decompressed = Compress::DeflateDecompressor::decompress_all(compressed);
EXPECT(decompressed.value().bytes() == ReadonlyBytes({ uncompressed, sizeof(uncompressed) - 1 }));
}
TEST_CASE(deflate_decompress_uncompressed_block)
{
- const Array<u8, 18> compressed {
+ Array<u8, 18> const compressed {
0x01, 0x0d, 0x00, 0xf2, 0xff, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20,
0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21
};
const u8 uncompressed[] = "Hello, World!";
- const auto decompressed = Compress::DeflateDecompressor::decompress_all(compressed);
+ auto const decompressed = Compress::DeflateDecompressor::decompress_all(compressed);
EXPECT(decompressed.value().bytes() == (ReadonlyBytes { uncompressed, sizeof(uncompressed) - 1 }));
}
TEST_CASE(deflate_decompress_multiple_blocks)
{
- const Array<u8, 84> compressed {
+ Array<u8, 84> const compressed {
0x00, 0x1f, 0x00, 0xe0, 0xff, 0x54, 0x68, 0x65, 0x20, 0x66, 0x69, 0x72,
0x73, 0x74, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x69, 0x73, 0x20,
0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64,
@@ -94,20 +94,20 @@ TEST_CASE(deflate_decompress_multiple_blocks)
const u8 uncompressed[] = "The first block is uncompressed and the second block is compressed.";
- const auto decompressed = Compress::DeflateDecompressor::decompress_all(compressed);
+ auto const decompressed = Compress::DeflateDecompressor::decompress_all(compressed);
EXPECT(decompressed.value().bytes() == (ReadonlyBytes { uncompressed, sizeof(uncompressed) - 1 }));
}
TEST_CASE(deflate_decompress_zeroes)
{
- const Array<u8, 20> compressed {
+ Array<u8, 20> const compressed {
0xed, 0xc1, 0x01, 0x0d, 0x00, 0x00, 0x00, 0xc2, 0xa0, 0xf7, 0x4f, 0x6d,
0x0f, 0x07, 0x14, 0x00, 0x00, 0x00, 0xf0, 0x6e
};
- const Array<u8, 4096> uncompressed { 0 };
+ Array<u8, 4096> const uncompressed { 0 };
- const auto decompressed = Compress::DeflateDecompressor::decompress_all(compressed);
+ auto const decompressed = Compress::DeflateDecompressor::decompress_all(compressed);
EXPECT(uncompressed == decompressed.value().bytes());
}
diff --git a/Tests/LibCompress/TestGzip.cpp b/Tests/LibCompress/TestGzip.cpp
index ca1d043aa0..7ec312874c 100644
--- a/Tests/LibCompress/TestGzip.cpp
+++ b/Tests/LibCompress/TestGzip.cpp
@@ -12,7 +12,7 @@
TEST_CASE(gzip_decompress_simple)
{
- const Array<u8, 33> compressed {
+ Array<u8, 33> const compressed {
0x1f, 0x8b, 0x08, 0x00, 0x77, 0xff, 0x47, 0x5f, 0x02, 0xff, 0x2b, 0xcf,
0x2f, 0x4a, 0x31, 0x54, 0x48, 0x4c, 0x4a, 0x56, 0x28, 0x07, 0xb2, 0x8c,
0x00, 0xc2, 0x1d, 0x22, 0x15, 0x0f, 0x00, 0x00, 0x00
@@ -20,13 +20,13 @@ TEST_CASE(gzip_decompress_simple)
const u8 uncompressed[] = "word1 abc word2";
- const auto decompressed = Compress::GzipDecompressor::decompress_all(compressed);
+ auto const decompressed = Compress::GzipDecompressor::decompress_all(compressed);
EXPECT(decompressed.value().bytes() == (ReadonlyBytes { uncompressed, sizeof(uncompressed) - 1 }));
}
TEST_CASE(gzip_decompress_multiple_members)
{
- const Array<u8, 52> compressed {
+ Array<u8, 52> const compressed {
0x1f, 0x8b, 0x08, 0x00, 0xe0, 0x03, 0x48, 0x5f, 0x02, 0xff, 0x4b, 0x4c,
0x4a, 0x4e, 0x4c, 0x4a, 0x06, 0x00, 0x4c, 0x99, 0x6e, 0x72, 0x06, 0x00,
0x00, 0x00, 0x1f, 0x8b, 0x08, 0x00, 0xe0, 0x03, 0x48, 0x5f, 0x02, 0xff,
@@ -36,13 +36,13 @@ TEST_CASE(gzip_decompress_multiple_members)
const u8 uncompressed[] = "abcabcabcabc";
- const auto decompressed = Compress::GzipDecompressor::decompress_all(compressed);
+ auto const decompressed = Compress::GzipDecompressor::decompress_all(compressed);
EXPECT(decompressed.value().bytes() == (ReadonlyBytes { uncompressed, sizeof(uncompressed) - 1 }));
}
TEST_CASE(gzip_decompress_zeroes)
{
- const Array<u8, 161> compressed {
+ Array<u8, 161> const compressed {
0x1f, 0x8b, 0x08, 0x00, 0x6e, 0x7a, 0x4b, 0x5f, 0x02, 0xff, 0xed, 0xc1,
0x31, 0x01, 0x00, 0x00, 0x00, 0xc2, 0xa0, 0xf5, 0x4f, 0xed, 0x61, 0x0d,
0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -59,15 +59,15 @@ TEST_CASE(gzip_decompress_zeroes)
0x7e, 0x00, 0x00, 0x02, 0x00
};
- const Array<u8, 128 * 1024> uncompressed = { 0 };
+ Array<u8, 128 * 1024> const uncompressed = { 0 };
- const auto decompressed = Compress::GzipDecompressor::decompress_all(compressed);
+ auto const decompressed = Compress::GzipDecompressor::decompress_all(compressed);
EXPECT(uncompressed == decompressed.value().bytes());
}
TEST_CASE(gzip_decompress_repeat_around_buffer)
{
- const Array<u8, 70> compressed {
+ Array<u8, 70> const compressed {
0x1f, 0x8b, 0x08, 0x00, 0xc6, 0x74, 0x53, 0x5f, 0x02, 0xff, 0xed, 0xc1,
0x01, 0x0d, 0x00, 0x00, 0x0c, 0x02, 0xa0, 0xdb, 0xbf, 0xf4, 0x37, 0x6b,
0x08, 0x24, 0xdb, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -81,7 +81,7 @@ TEST_CASE(gzip_decompress_repeat_around_buffer)
uncompressed.span().slice(0x0100, 0x7e00).fill(0);
uncompressed.span().slice(0x7f00, 0x0100).fill(1);
- const auto decompressed = Compress::GzipDecompressor::decompress_all(compressed);
+ auto const decompressed = Compress::GzipDecompressor::decompress_all(compressed);
EXPECT(uncompressed == decompressed.value().bytes());
}
diff --git a/Tests/LibCompress/TestZlib.cpp b/Tests/LibCompress/TestZlib.cpp
index 8ab5b81a95..4565bdd6f8 100644
--- a/Tests/LibCompress/TestZlib.cpp
+++ b/Tests/LibCompress/TestZlib.cpp
@@ -11,7 +11,7 @@
TEST_CASE(zlib_decompress_simple)
{
- const Array<u8, 40> compressed {
+ Array<u8, 40> const compressed {
0x78, 0x01, 0x01, 0x1D, 0x00, 0xE2, 0xFF, 0x54, 0x68, 0x69, 0x73, 0x20,
0x69, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6D, 0x70, 0x6C, 0x65, 0x20,
0x74, 0x65, 0x78, 0x74, 0x20, 0x66, 0x69, 0x6C, 0x65, 0x20, 0x3A, 0x29,
@@ -20,6 +20,6 @@ TEST_CASE(zlib_decompress_simple)
const u8 uncompressed[] = "This is a simple text file :)";
- const auto decompressed = Compress::Zlib::decompress_all(compressed);
+ auto const decompressed = Compress::Zlib::decompress_all(compressed);
EXPECT(decompressed.value().bytes() == (ReadonlyBytes { uncompressed, sizeof(uncompressed) - 1 }));
}
diff --git a/Tests/LibCpp/test-cpp-parser.cpp b/Tests/LibCpp/test-cpp-parser.cpp
index 4f0f6ae7da..18eb0dcff1 100644
--- a/Tests/LibCpp/test-cpp-parser.cpp
+++ b/Tests/LibCpp/test-cpp-parser.cpp
@@ -72,7 +72,7 @@ TEST_CASE(test_regression)
fclose(input_stream);
- String content { reinterpret_cast<const char*>(buffer.data()), buffer.size() };
+ String content { reinterpret_cast<char const*>(buffer.data()), buffer.size() };
auto equal = content == target_ast;
EXPECT(equal);
diff --git a/Tests/LibCrypto/TestAES.cpp b/Tests/LibCrypto/TestAES.cpp
index bfcd1626e1..c20ab686ed 100644
--- a/Tests/LibCrypto/TestAES.cpp
+++ b/Tests/LibCrypto/TestAES.cpp
@@ -10,7 +10,7 @@
#include <LibTest/TestCase.h>
#include <cstring>
-static ReadonlyBytes operator""_b(const char* string, size_t length)
+static ReadonlyBytes operator""_b(char const* string, size_t length)
{
return ReadonlyBytes(string, length);
}
diff --git a/Tests/LibCrypto/TestRSA.cpp b/Tests/LibCrypto/TestRSA.cpp
index 307ed609c7..04c72f8f42 100644
--- a/Tests/LibCrypto/TestRSA.cpp
+++ b/Tests/LibCrypto/TestRSA.cpp
@@ -10,7 +10,7 @@
#include <LibTest/TestCase.h>
#include <cstring>
-static ByteBuffer operator""_b(const char* string, size_t length)
+static ByteBuffer operator""_b(char const* string, size_t length)
{
return ByteBuffer::copy(string, length).release_value();
}
diff --git a/Tests/LibGfx/BenchmarkGfxPainter.cpp b/Tests/LibGfx/BenchmarkGfxPainter.cpp
index a9c8707c3d..000de1cfd7 100644
--- a/Tests/LibGfx/BenchmarkGfxPainter.cpp
+++ b/Tests/LibGfx/BenchmarkGfxPainter.cpp
@@ -22,8 +22,8 @@ static struct FontDatabaseSpoofer {
BENCHMARK_CASE(diagonal_lines)
{
- const int run_count = 50;
- const int bitmap_size = 2000;
+ int const run_count = 50;
+ int const bitmap_size = 2000;
auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { bitmap_size, bitmap_size }).release_value_but_fixme_should_propagate_errors();
Gfx::Painter painter(bitmap);
@@ -38,8 +38,8 @@ BENCHMARK_CASE(diagonal_lines)
BENCHMARK_CASE(fill)
{
- const int run_count = 1000;
- const int bitmap_size = 2000;
+ int const run_count = 1000;
+ int const bitmap_size = 2000;
auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { bitmap_size, bitmap_size }).release_value_but_fixme_should_propagate_errors();
Gfx::Painter painter(bitmap);
@@ -51,8 +51,8 @@ BENCHMARK_CASE(fill)
BENCHMARK_CASE(fill_with_gradient)
{
- const int run_count = 50;
- const int bitmap_size = 2000;
+ int const run_count = 50;
+ int const bitmap_size = 2000;
auto bitmap = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, { bitmap_size, bitmap_size }).release_value_but_fixme_should_propagate_errors();
Gfx::Painter painter(bitmap);
diff --git a/Tests/LibGfx/TestFontHandling.cpp b/Tests/LibGfx/TestFontHandling.cpp
index 5dad37a112..19b8b927aa 100644
--- a/Tests/LibGfx/TestFontHandling.cpp
+++ b/Tests/LibGfx/TestFontHandling.cpp
@@ -14,7 +14,7 @@
TEST_CASE(test_fontdatabase_get_by_name)
{
- const char* name = "Liza 10 400 0";
+ char const* name = "Liza 10 400 0";
auto& font_database = Gfx::FontDatabase::the();
EXPECT(!font_database.get_by_name(name)->name().is_null());
}
@@ -28,7 +28,7 @@ TEST_CASE(test_fontdatabase_get)
TEST_CASE(test_fontdatabase_for_each_font)
{
auto& font_database = Gfx::FontDatabase::the();
- font_database.for_each_font([&](const Gfx::Font& font) {
+ font_database.for_each_font([&](Gfx::Font const& font) {
EXPECT(!font.name().is_null());
EXPECT(!font.qualified_name().is_null());
EXPECT(!font.family().is_null());
@@ -55,7 +55,7 @@ TEST_CASE(test_set_name)
u8 glyph_width = 1;
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, 256);
- const char* name = "my newly created font";
+ char const* name = "my newly created font";
font->set_name(name);
EXPECT(!font->name().is_null());
@@ -68,7 +68,7 @@ TEST_CASE(test_set_family)
u8 glyph_width = 1;
auto font = Gfx::BitmapFont::create(glyph_height, glyph_width, true, 256);
- const char* family = "my newly created font family";
+ char const* family = "my newly created font family";
font->set_family(family);
EXPECT(!font->family().is_null());
diff --git a/Tests/LibIMAP/TestQuotedPrintable.cpp b/Tests/LibIMAP/TestQuotedPrintable.cpp
index e89c5b06f3..92171bd376 100644
--- a/Tests/LibIMAP/TestQuotedPrintable.cpp
+++ b/Tests/LibIMAP/TestQuotedPrintable.cpp
@@ -10,12 +10,12 @@
TEST_CASE(test_decode)
{
- auto decode_equal = [](const char* input, const char* expected) {
+ auto decode_equal = [](char const* input, char const* expected) {
auto decoded = IMAP::decode_quoted_printable(StringView(input));
EXPECT(String::copy(decoded) == String(expected));
};
- auto decode_equal_byte_buffer = [](const char* input, const char* expected, size_t expected_length) {
+ auto decode_equal_byte_buffer = [](char const* input, char const* expected, size_t expected_length) {
auto decoded = IMAP::decode_quoted_printable(StringView(input));
EXPECT(decoded == ByteBuffer::copy(expected, expected_length).value());
};
diff --git a/Tests/LibM/test-math.cpp b/Tests/LibM/test-math.cpp
index fcd37d9063..422e7347d5 100644
--- a/Tests/LibM/test-math.cpp
+++ b/Tests/LibM/test-math.cpp
@@ -120,7 +120,7 @@ union Extractor {
};
double d;
- bool operator==(const Extractor& other) const
+ bool operator==(Extractor const& other) const
{
return other.sign == sign && other.exponent == exponent && other.mantissa == mantissa;
}
@@ -227,7 +227,7 @@ TEST_CASE(gamma)
EXPECT(isnan(tgamma(-5)));
// TODO: investigate Stirling approximation implementation of gamma function
- //EXPECT_APPROXIMATE(tgamma(0.5), sqrt(M_PI));
+ // EXPECT_APPROXIMATE(tgamma(0.5), sqrt(M_PI));
EXPECT_EQ(tgammal(21.0l), 2'432'902'008'176'640'000.0l);
EXPECT_EQ(tgamma(19.0), 6'402'373'705'728'000.0);
EXPECT_EQ(tgammaf(11.0f), 3628800.0f);
diff --git a/Tests/LibRegex/RegexLibC.cpp b/Tests/LibRegex/RegexLibC.cpp
index 2b212c23d9..05bc755613 100644
--- a/Tests/LibRegex/RegexLibC.cpp
+++ b/Tests/LibRegex/RegexLibC.cpp
@@ -407,7 +407,7 @@ TEST_CASE(parens_qualifier_questionmark)
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
- const char* match_str;
+ char const* match_str;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@@ -437,7 +437,7 @@ TEST_CASE(parens_qualifier_asterisk)
regex_t regex;
static constexpr int num_matches { 6 };
regmatch_t matches[num_matches];
- const char* match_str;
+ char const* match_str;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@@ -483,7 +483,7 @@ TEST_CASE(parens_qualifier_asterisk_2)
regex_t regex;
static constexpr int num_matches { 6 };
regmatch_t matches[num_matches];
- const char* match_str;
+ char const* match_str;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@@ -527,7 +527,7 @@ TEST_CASE(mulit_parens_qualifier_too_less_result_values)
regex_t regex;
static constexpr int num_matches { 4 };
regmatch_t matches[num_matches];
- const char* match_str;
+ char const* match_str;
matches[3] = { -2, -2, 100 };
@@ -591,7 +591,7 @@ TEST_CASE(multi_parens_qualifier_questionmark)
regex_t regex;
static constexpr int num_matches { 8 };
regmatch_t matches[num_matches];
- const char* match_str;
+ char const* match_str;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@@ -682,7 +682,7 @@ TEST_CASE(alternative_match_groups)
regex_t regex;
static constexpr int num_matches { 8 };
regmatch_t matches[num_matches];
- const char* match_str;
+ char const* match_str;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@@ -788,7 +788,7 @@ TEST_CASE(parens_qualifier_exact)
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
- const char* match_str;
+ char const* match_str;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@@ -835,7 +835,7 @@ TEST_CASE(parens_qualifier_minimum)
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
- const char* match_str;
+ char const* match_str;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@@ -893,7 +893,7 @@ TEST_CASE(parens_qualifier_maximum)
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
- const char* match_str;
+ char const* match_str;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
diff --git a/Tests/LibSQL/TestSqlStatementExecution.cpp b/Tests/LibSQL/TestSqlStatementExecution.cpp
index d3a5d145be..a5ca80aae2 100644
--- a/Tests/LibSQL/TestSqlStatementExecution.cpp
+++ b/Tests/LibSQL/TestSqlStatementExecution.cpp
@@ -19,7 +19,7 @@
namespace {
-constexpr const char* db_name = "/tmp/test.db";
+constexpr char const* db_name = "/tmp/test.db";
SQL::ResultOr<SQL::ResultSet> try_execute(NonnullRefPtr<SQL::Database> database, String const& sql)
{
diff --git a/Tests/LibTLS/TestTLSHandshake.cpp b/Tests/LibTLS/TestTLSHandshake.cpp
index c9bd3845a8..a02a668884 100644
--- a/Tests/LibTLS/TestTLSHandshake.cpp
+++ b/Tests/LibTLS/TestTLSHandshake.cpp
@@ -11,12 +11,12 @@
#include <LibTLS/TLSv12.h>
#include <LibTest/TestCase.h>
-static const char* ca_certs_file = "./ca_certs.ini";
+static char const* ca_certs_file = "./ca_certs.ini";
static int port = 443;
-constexpr const char* DEFAULT_SERVER { "www.google.com" };
+constexpr char const* DEFAULT_SERVER { "www.google.com" };
-static ByteBuffer operator""_b(const char* string, size_t length)
+static ByteBuffer operator""_b(char const* string, size_t length)
{
return ByteBuffer::copy(string, length).release_value();
}
diff --git a/Tests/LibWasm/test-wasm.cpp b/Tests/LibWasm/test-wasm.cpp
index f6e14a7d9e..2e7254abac 100644
--- a/Tests/LibWasm/test-wasm.cpp
+++ b/Tests/LibWasm/test-wasm.cpp
@@ -170,10 +170,10 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::get_export)
return JS::Value(static_cast<unsigned long>(ptr->value()));
if (auto v = value.get_pointer<Wasm::GlobalAddress>()) {
return m_machine.store().get(*v)->value().value().visit(
- [&](const auto& value) -> JS::Value { return JS::Value(static_cast<double>(value)); },
+ [&](auto const& value) -> JS::Value { return JS::Value(static_cast<double>(value)); },
[&](i32 value) { return JS::Value(static_cast<double>(value)); },
[&](i64 value) -> JS::Value { return JS::js_bigint(vm, Crypto::SignedBigInteger::create_from(value)); },
- [&](const Wasm::Reference& reference) -> JS::Value {
+ [&](Wasm::Reference const& reference) -> JS::Value {
return reference.ref().visit(
[&](const Wasm::Reference::Null&) -> JS::Value { return JS::js_null(); },
[&](const auto& ref) -> JS::Value { return JS::Value(static_cast<double>(ref.address.value())); });
@@ -193,7 +193,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke)
if (!function_instance)
return vm.throw_completion<JS::TypeError>(global_object, "Invalid function address");
- const Wasm::FunctionType* type { nullptr };
+ Wasm::FunctionType const* type { nullptr };
function_instance->visit([&](auto& value) { type = &value.type(); });
if (!type)
return vm.throw_completion<JS::TypeError>(global_object, "Invalid function found at given address");
@@ -249,10 +249,10 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke)
JS::Value return_value;
result.values().first().value().visit(
- [&](const auto& value) { return_value = JS::Value(static_cast<double>(value)); },
+ [&](auto const& value) { return_value = JS::Value(static_cast<double>(value)); },
[&](i32 value) { return_value = JS::Value(static_cast<double>(value)); },
[&](i64 value) { return_value = JS::Value(JS::js_bigint(vm, Crypto::SignedBigInteger::create_from(value))); },
- [&](const Wasm::Reference& reference) {
+ [&](Wasm::Reference const& reference) {
reference.ref().visit(
[&](const Wasm::Reference::Null&) { return_value = JS::js_null(); },
[&](const auto& ref) { return_value = JS::Value(static_cast<double>(ref.address.value())); });
diff --git a/Tests/UserspaceEmulator/ue-write-oob.cpp b/Tests/UserspaceEmulator/ue-write-oob.cpp
index 811d7199ec..70663a24f8 100644
--- a/Tests/UserspaceEmulator/ue-write-oob.cpp
+++ b/Tests/UserspaceEmulator/ue-write-oob.cpp
@@ -11,10 +11,10 @@
#include <stdlib.h>
#include <sys/mman.h>
-static void write8(void* ptr) { *(volatile uint8_t*)ptr = 1; }
-static void write16(void* ptr) { *(volatile uint16_t*)ptr = 1; }
-static void write32(void* ptr) { *(volatile uint32_t*)ptr = 1; }
-static void write64(void* ptr) { *(volatile double*)ptr = 1.0; }
+static void write8(void* ptr) { *(uint8_t volatile*)ptr = 1; }
+static void write16(void* ptr) { *(uint16_t volatile*)ptr = 1; }
+static void write32(void* ptr) { *(uint32_t volatile*)ptr = 1; }
+static void write64(void* ptr) { *(double volatile*)ptr = 1.0; }
// A u64 write might be translated by the compiler as a 32-then-32-bit write:
// static void write64_bad(void* ptr) { *(volatile uint64_t*)ptr = 1.0; }
// Let's hope this won't be translated like that.