shape_test.cpp 805 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * DoRayMe - a quick and dirty Raytracer
  3. * Shape unit tests
  4. *
  5. * Created by Manoël Trapier
  6. * Copyright (c) 2020 986-Studio.
  7. *
  8. */
  9. #include <shape.h>
  10. #include <matrix.h>
  11. #include <transformation.h>
  12. #include <gtest/gtest.h>
  13. TEST(ShapeTest, The_default_transformation)
  14. {
  15. Shape s = Shape();
  16. ASSERT_EQ(s.transformMatrix, Matrix4().identity());
  17. }
  18. TEST(ShapeTest, Assigning_a_transformation)
  19. {
  20. Shape s = Shape();
  21. s.setTransform(translation(2, 3, 4));
  22. ASSERT_EQ(s.transformMatrix, translation(2, 3, 4));
  23. }
  24. TEST(ShapeTest, The_default_material)
  25. {
  26. Shape s = Shape();
  27. ASSERT_EQ(s.material, Material());
  28. }
  29. TEST(ShapeTest, Assigning_a_material)
  30. {
  31. Shape s = Shape();
  32. Material m = Material();
  33. m.ambient = 1;
  34. s.material = m;
  35. ASSERT_EQ(s.material, m);
  36. }