diff --git a/tests/test_framebuffer.cpp b/tests/test_framebuffer.cpp index 1f96481..c078af2 100644 --- a/tests/test_framebuffer.cpp +++ b/tests/test_framebuffer.cpp @@ -4,11 +4,13 @@ #include "soft_render/core/framebuffer.hpp" #include "soft_render/math/vec3.hpp" +using std::cout; +using std::endl; using namespace sr::core; using namespace sr::math; void test_framebuffer_clear() { - std::cout << "Running test_framebuffer_clear..." << std::endl; + cout << "Running test_framebuffer_clear..." << endl; int width = 10; int height = 10; @@ -26,7 +28,7 @@ void test_framebuffer_clear() { assert(pixels[i].a == 255); assert(depth[i] == std::numeric_limits::infinity()); } - std::cout << " Default clear passed" << std::endl; + cout << " Default clear passed" << endl; // Test clear with custom color Color customColor(1.0f, 0.5f, 0.25f); @@ -39,7 +41,7 @@ void test_framebuffer_clear() { assert(pixels[i].a == 255); assert(depth[i] == std::numeric_limits::infinity()); } - std::cout << " Custom color clear passed" << std::endl; + cout << " Custom color clear passed" << endl; // Test clear with out-of-bounds color values Color outOfBoundsColor(1.5f, -0.5f, 2.0f); @@ -52,20 +54,20 @@ void test_framebuffer_clear() { assert(pixels[i].a == 255); assert(depth[i] == std::numeric_limits::infinity()); } - std::cout << " Out-of-bounds color clear passed" << std::endl; + cout << " Out-of-bounds color clear passed" << endl; // Test depth test modifying depth, then clear fb.depthTest(0, 0, 0.5f); assert(fb.getDepth(0, 0) == 0.5f); fb.clear(); assert(fb.getDepth(0, 0) == std::numeric_limits::infinity()); - std::cout << " Depth buffer reset passed" << std::endl; + cout << " Depth buffer reset passed" << endl; - std::cout << "test_framebuffer_clear passed!" << std::endl; + cout << "test_framebuffer_clear passed!" << endl; } int main() { test_framebuffer_clear(); - std::cout << "All tests passed!" << std::endl; + cout << "All tests passed!" << endl; return 0; } diff --git a/tests/test_math.cpp b/tests/test_math.cpp index 5682303..0f4b918 100644 --- a/tests/test_math.cpp +++ b/tests/test_math.cpp @@ -4,10 +4,12 @@ #include #include +using std::cout; +using std::endl; using namespace sr::math; void test_vec4_perspective() { - std::cout << "Running test_vec4_perspective..." << std::endl; + cout << "Running test_vec4_perspective..." << endl; // Case 1: w = 1.0 (Identity) { @@ -16,7 +18,7 @@ void test_vec4_perspective() { assert(p.x == 1.0f); assert(p.y == 2.0f); assert(p.z == 3.0f); - std::cout << " w=1.0 passed" << std::endl; + cout << " w=1.0 passed" << endl; } // Case 2: w = 2.0 (Divide by 2) @@ -26,7 +28,7 @@ void test_vec4_perspective() { assert(p.x == 0.5f); assert(p.y == 1.0f); assert(p.z == 2.0f); - std::cout << " w=2.0 passed" << std::endl; + cout << " w=2.0 passed" << endl; } // Case 3: w = -1.0 (Negative w) @@ -36,7 +38,7 @@ void test_vec4_perspective() { assert(p.x == -1.0f); assert(p.y == 2.0f); assert(p.z == -3.0f); - std::cout << " w=-1.0 passed" << std::endl; + cout << " w=-1.0 passed" << endl; } // Case 4: w = 0.0 (Division by zero - should result in inf/nan) @@ -46,14 +48,14 @@ void test_vec4_perspective() { assert(std::isinf(p.x) || std::isnan(p.x)); assert(std::isinf(p.y) || std::isnan(p.y)); assert(std::isinf(p.z) || std::isnan(p.z)); - std::cout << " w=0.0 passed (inf/nan handled)" << std::endl; + cout << " w=0.0 passed (inf/nan handled)" << endl; } - std::cout << "test_vec4_perspective passed!" << std::endl; + cout << "test_vec4_perspective passed!" << endl; } void test_mat4_multiplication() { - std::cout << "Running test_mat4_multiplication..." << std::endl; + cout << "Running test_mat4_multiplication..." << endl; // Case 1: Identity * A = A { @@ -70,7 +72,7 @@ void test_mat4_multiplication() { assert(std::abs(result(i, j) - A(i, j)) < 1e-5f); } } - std::cout << " Identity * A passed" << std::endl; + cout << " Identity * A passed" << endl; } // Case 2: A * Identity = A @@ -88,7 +90,7 @@ void test_mat4_multiplication() { assert(std::abs(result(i, j) - A(i, j)) < 1e-5f); } } - std::cout << " A * Identity passed" << std::endl; + cout << " A * Identity passed" << endl; } // Case 3: A * B @@ -118,15 +120,15 @@ void test_mat4_multiplication() { assert(std::abs(result(i, j) - expected(i, j)) < 1e-5f); } } - std::cout << " A * B passed" << std::endl; + cout << " A * B passed" << endl; } - std::cout << "test_mat4_multiplication passed!" << std::endl; + cout << "test_mat4_multiplication passed!" << endl; } int main() { test_vec4_perspective(); test_mat4_multiplication(); - std::cout << "All tests passed!" << std::endl; + cout << "All tests passed!" << endl; return 0; } diff --git a/tests/test_vec3.cpp b/tests/test_vec3.cpp index 8a9e96c..1f6a09d 100644 --- a/tests/test_vec3.cpp +++ b/tests/test_vec3.cpp @@ -2,6 +2,8 @@ #include #include "soft_render/math/vec3.hpp" +using std::cout; +using std::endl; using namespace sr::math; void test_vec3_cross() { @@ -34,7 +36,7 @@ void test_vec3_cross() { Vec3 a_cross_b = a.cross(b); assert(a_cross_b.x == -3 && a_cross_b.y == 6 && a_cross_b.z == -3); - std::cout << "All Vec3 cross tests passed!" << std::endl; + cout << "All Vec3 cross tests passed!" << endl; } int main() {