From 6aa09e26517e0b140aad60e7f83817d71e8c72fa Mon Sep 17 00:00:00 2001 From: jmacey Date: Wed, 27 Sep 2023 12:02:27 +0100 Subject: [PATCH] added NGLStream tests --- CMakeLists.txt | 2 +- src/NGLStream.cpp | 6 +-- tests/NGLStreamTest.cpp | 77 ++++++++++++++++++++++++++++++++++++ tests/VAOPrimitivesTests.cpp | 17 +++++++- 4 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 tests/NGLStreamTest.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index aaf8eb68..e9ba8c5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -256,7 +256,7 @@ if(NOT DEFINED PYNGL_ONLY) ${CMAKE_SOURCE_DIR}/tests/HashTests.cpp ${CMAKE_SOURCE_DIR}/tests/PointBakeTests.cpp ${CMAKE_SOURCE_DIR}/tests/MessageTests.cpp - + ${CMAKE_SOURCE_DIR}/tests/NGLStreamTest.cpp ) add_compile_definitions(GLM_ENABLE_EXPERIMENTAL) diff --git a/src/NGLStream.cpp b/src/NGLStream.cpp index 4ff02b24..46ca4610 100644 --- a/src/NGLStream.cpp +++ b/src/NGLStream.cpp @@ -61,9 +61,9 @@ NGL_DLLEXPORT std::ostream& operator<<(std::ostream &_output,const Mat3 &_m ) std::cout.setf(std::ios::fixed|std::ios::adjustfield|std::ios::showpos); std::cout.precision(12); return _output - <<"["<<_m.m_00<<","<<_m.m_01<<","<<_m.m_02<<","<<"]\n" - <<"["<<_m.m_10<<","<<_m.m_11<<","<<_m.m_12<<","<<"]\n" - <<"["<<_m.m_20<<","<<_m.m_21<<","<<_m.m_22<<","<<"]\n"; + <<"["<<_m.m_00<<","<<_m.m_01<<","<<_m.m_02<<"]\n" + <<"["<<_m.m_10<<","<<_m.m_11<<","<<_m.m_12<<"]\n" + <<"["<<_m.m_20<<","<<_m.m_21<<","<<_m.m_22<<"]\n"; } diff --git a/tests/NGLStreamTest.cpp b/tests/NGLStreamTest.cpp new file mode 100644 index 00000000..6c25009b --- /dev/null +++ b/tests/NGLStreamTest.cpp @@ -0,0 +1,77 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +TEST(NGLStream,Vec2) +{ + ngl::Vec2 test(1,2); + std::cerr<>result; + EXPECT_EQ(result,test); +} + +TEST(NGLStream,Vec3) +{ + ngl::Vec3 test(1,2,3); + std::cerr<>result; + EXPECT_EQ(result,test); +} + +TEST(NGLStream,Vec4) +{ + ngl::Vec4 test(1.0f,2.0f,3.0f,4.0f); + std::cerr<>result; + EXPECT_EQ(result,test); +} + +TEST(NGLStream,Mat2) +{ + ngl::Mat2 test(1.0f,2.0f,3.0f,4.0f); + std::cerr<bind(); @@ -123,6 +121,21 @@ TEST(VAOPrimitives,createCapsule) EXPECT_TRUE(ngl::VAOPrimitives::getVAOFromName("capsule") !=nullptr); } +TEST(VAOPrimitives,defaultVAO) +{ + EXPECT_TRUE(ngl::VAOPrimitives::getVAOFromName(ngl::troll) !=nullptr); + EXPECT_TRUE(ngl::VAOPrimitives::getVAOFromName(ngl::teapot) !=nullptr); + EXPECT_TRUE(ngl::VAOPrimitives::getVAOFromName(ngl::octahedron) !=nullptr); + EXPECT_TRUE(ngl::VAOPrimitives::getVAOFromName(ngl::dodecahedron) !=nullptr); + EXPECT_TRUE(ngl::VAOPrimitives::getVAOFromName(ngl::icosahedron) !=nullptr); + EXPECT_TRUE(ngl::VAOPrimitives::getVAOFromName(ngl::tetrahedron) !=nullptr); + EXPECT_TRUE(ngl::VAOPrimitives::getVAOFromName(ngl::football) !=nullptr); + EXPECT_TRUE(ngl::VAOPrimitives::getVAOFromName(ngl::cube) !=nullptr); + EXPECT_TRUE(ngl::VAOPrimitives::getVAOFromName(ngl::bunny) !=nullptr); + EXPECT_TRUE(ngl::VAOPrimitives::getVAOFromName(ngl::dragon) !=nullptr); + EXPECT_TRUE(ngl::VAOPrimitives::getVAOFromName(ngl::buddah) !=nullptr); +} + TEST(VAOPrimitives,draw) {