Apply clang-format across the whole tree
Run clang-format (the repo's .clang-format: LLVM base, 120 cols, tabs, Allman functions) over every source file so the tree is formatter-clean. Whitespace only -- no behavior change; full x64 + x86 suites pass. Also set SortIncludes: false in .clang-format. Windows include order is load-bearing (windows.h must precede tlhelp32.h / mmreg.h / xinput.h / dinput.h; winsock2.h must precede windows.h), and the default alphabetical sort reorders tlhelp32.h ahead of windows.h -- a build break. Leaving order alone keeps the manual, correct grouping.
This commit is contained in:
@@ -13,15 +13,13 @@
|
||||
|
||||
using namespace coop;
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace {
|
||||
|
||||
int g_failures = 0;
|
||||
|
||||
void check(bool ok, const char* what)
|
||||
{
|
||||
if (!ok)
|
||||
{
|
||||
if (!ok) {
|
||||
std::printf(" FAIL: %s\n", what);
|
||||
++g_failures;
|
||||
}
|
||||
@@ -49,8 +47,7 @@ int main()
|
||||
check(!audio_ring_format_ready(*h), "format not ready before set");
|
||||
audio_ring_set_format(*h, 48000, 2, 32, 3 /*IEEE_FLOAT*/, 8);
|
||||
check(audio_ring_format_ready(*h), "format ready after set");
|
||||
check(h->sample_rate == 48000 && h->channels == 2 && h->bits == 32 && h->format_tag == 3 &&
|
||||
h->block_align == 8,
|
||||
check(h->sample_rate == 48000 && h->channels == 2 && h->bits == 32 && h->format_tag == 3 && h->block_align == 8,
|
||||
"format fields round-trip");
|
||||
}
|
||||
|
||||
@@ -60,8 +57,7 @@ int main()
|
||||
AudioRingHeader* h = make_ring(storage, 4096);
|
||||
|
||||
std::uint8_t src[256];
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
src[i] = static_cast<std::uint8_t>(i);
|
||||
}
|
||||
check(audio_ring_push(*h, src, sizeof(src), 32), "push 256 bytes");
|
||||
@@ -83,11 +79,9 @@ int main()
|
||||
std::uint8_t counter = 0;
|
||||
std::uint8_t expect = 0;
|
||||
const std::uint32_t chunk = 300; // not a divisor of cap, so offsets drift across the seam
|
||||
for (int iter = 0; iter < 50; ++iter)
|
||||
{
|
||||
for (int iter = 0; iter < 50; ++iter) {
|
||||
std::uint8_t buf[300];
|
||||
for (std::uint32_t i = 0; i < chunk; ++i)
|
||||
{
|
||||
for (std::uint32_t i = 0; i < chunk; ++i) {
|
||||
buf[i] = counter++;
|
||||
}
|
||||
check(audio_ring_push(*h, buf, chunk, chunk), "wrap push fits");
|
||||
@@ -95,8 +89,7 @@ int main()
|
||||
std::uint8_t out[300] = {};
|
||||
check(audio_ring_pop(*h, out, chunk) == chunk, "wrap pop full chunk");
|
||||
bool ok = true;
|
||||
for (std::uint32_t i = 0; i < chunk; ++i)
|
||||
{
|
||||
for (std::uint32_t i = 0; i < chunk; ++i) {
|
||||
ok = ok && out[i] == expect++;
|
||||
}
|
||||
check(ok, "wrap data integrity across the ring seam");
|
||||
@@ -142,8 +135,7 @@ int main()
|
||||
|
||||
// A 200-byte push now splits across the seam; it fits, so the data must survive the split.
|
||||
std::vector<std::uint8_t> wrap(200);
|
||||
for (std::uint32_t i = 0; i < 200; ++i)
|
||||
{
|
||||
for (std::uint32_t i = 0; i < 200; ++i) {
|
||||
wrap[i] = static_cast<std::uint8_t>(i);
|
||||
}
|
||||
check(audio_ring_push(*h, wrap.data(), 200, 1), "seam: a wrapping push that fits is accepted");
|
||||
@@ -160,8 +152,7 @@ int main()
|
||||
std::vector<std::uint8_t> out(200, 0);
|
||||
check(audio_ring_pop(*h, out.data(), 200) == 200, "seam: pop the wrapped payload");
|
||||
bool ok = true;
|
||||
for (std::uint32_t i = 0; i < 200; ++i)
|
||||
{
|
||||
for (std::uint32_t i = 0; i < 200; ++i) {
|
||||
ok = ok && out[i] == static_cast<std::uint8_t>(i);
|
||||
}
|
||||
check(ok, "seam: wrapping push/pop preserved data across the buffer seam");
|
||||
|
||||
Reference in New Issue
Block a user