From 25e693cc46324b4ec588530de542bba8af6f47c6 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 31 Jan 2026 21:11:11 +0100 Subject: style: add vertical compression rules to clang-format - Enabled AllowShortFunctionsOnASingleLine: All - Enabled AllowShortBlocksOnASingleLine: Always - Enabled AllowShortIfStatementsOnASingleLine: Always - Enabled AllowShortLoopsOnASingleLine: true - Set MaxEmptyLinesToKeep: 1 - Applied formatting to all source files. --- src/tests/test_maths.cc | 19 ++++++------------- src/tests/test_sequence.cc | 16 ++++------------ 2 files changed, 10 insertions(+), 25 deletions(-) (limited to 'src/tests') diff --git a/src/tests/test_maths.cc b/src/tests/test_maths.cc index d9bc4d1..e7a686c 100644 --- a/src/tests/test_maths.cc +++ b/src/tests/test_maths.cc @@ -9,9 +9,7 @@ #include // Checks if two floats are approximately equal -bool near(float a, float b, float e = 0.001f) { - return std::abs(a - b) < e; -} +bool near(float a, float b, float e = 0.001f) { return std::abs(a - b) < e; } // Generic test runner for any vector type (vec2, vec3, vec4) template void test_vector_ops(int n) { @@ -24,19 +22,16 @@ template void test_vector_ops(int n) { // Add T c = a + b; - for (int i = 0; i < n; ++i) - assert(near(c[i], (float)(i + 1) + 10.0f)); + for (int i = 0; i < n; ++i) assert(near(c[i], (float)(i + 1) + 10.0f)); // Scale T s = a * 2.0f; - for (int i = 0; i < n; ++i) - assert(near(s[i], (float)(i + 1) * 2.0f)); + for (int i = 0; i < n; ++i) assert(near(s[i], (float)(i + 1) * 2.0f)); // Dot Product // vec3(1,2,3) . vec3(1,2,3) = 1+4+9 = 14 float expected_dot = 0; - for (int i = 0; i < n; ++i) - expected_dot += a[i] * a[i]; + for (int i = 0; i < n; ++i) expected_dot += a[i] * a[i]; assert(near(T::dot(a, a), expected_dot)); // Norm (Length) @@ -48,8 +43,7 @@ template void test_vector_ops(int n) { // Lerp T l = lerp(a, b, 0.3f); - for (int i = 0; i < n; ++i) - assert(near(l[i], .7 * (i + 1) + .3 * 10.0f)); + for (int i = 0; i < n; ++i) assert(near(l[i], .7 * (i + 1) + .3 * 10.0f)); } // Specific test for padding alignment in vec3 @@ -133,8 +127,7 @@ void test_spring() { std::cout << "Testing Spring..." << std::endl; float p = 0, v = 0; // Simulate approx 1 sec with 0.5s smooth time - for (int i = 0; i < 60; ++i) - spring::solve(p, v, 10.0f, 0.5f, 0.016f); + for (int i = 0; i < 60; ++i) spring::solve(p, v, 10.0f, 0.5f, 0.016f); assert(p > 8.5f); // Test vector spring diff --git a/src/tests/test_sequence.cc b/src/tests/test_sequence.cc index db66b8a..363846b 100644 --- a/src/tests/test_sequence.cc +++ b/src/tests/test_sequence.cc @@ -26,16 +26,13 @@ public: int end_calls = 0; bool is_pp = false; - DummyEffect(bool post_process = false) : is_pp(post_process) { - } + DummyEffect(bool post_process = false) : is_pp(post_process) {} void init(MainSequence *demo) override { init_calls++; (void)demo; } - void start() override { - start_calls++; - } + void start() override { start_calls++; } void render(WGPURenderPassEncoder pass, float time, float beat, float intensity, float aspect_ratio) override { render_calls++; @@ -53,12 +50,8 @@ public: (void)intensity; (void)aspect_ratio; } - void end() override { - end_calls++; - } - bool is_post_process() const override { - return is_pp; - } + void end() override { end_calls++; } + bool is_post_process() const override { return is_pp; } }; // --- Dummy PostProcessEffect for Tracking (unused in simplified tests) --- @@ -169,7 +162,6 @@ void test_simulate_until() { } int main() { - printf("Running Sequence/Effect System tests...\n"); // TODO: Re-enable and fix test_effect_lifecycle once GPU resource mocking is -- cgit v1.2.3