@@ -30,6 +30,7 @@ Icosahedron mesh generator unit tests
3030#include " MeshTestHelpers.hpp"
3131
3232#include < catch2/catch_test_macros.hpp>
33+ #include < catch2/catch_approx.hpp>
3334#include < fmt/format.h>
3435#include < string>
3536
@@ -59,66 +60,66 @@ TEST_CASE("Icosahedron Mesh Generator", "[mesh]")
5960
6061 SECTION (" Mesh Data" )
6162 {
62- const std::vector<MeshVertex> mesh_vertices = {
63+ const std::vector<MeshVertex> reference_vertices = {
6364 { // 0
64- .position = {-3 , 3.4364917 , 0 },
65- .normal = {-0.65764374 , 0.7533291 , 0 },
66- .texcoord = {1 , 0.7715532 }
65+ .position = {-3 . F , 3 .436F , 0 . F },
66+ .normal = {-0 .658F , 0 .753F , 0 . F },
67+ .texcoord = {1 . F , 0 .771F }
6768 },
6869 { // 1
69- .position = {3 , 3.4364917 , 0 },
70- .normal = {0.65764374 , 0.7533291 , 0 },
71- .texcoord = {0.5 , 0.7715532 }
70+ .position = {3 . F , 3 .436F , 0 . F },
71+ .normal = {0 .658F , 0 .753F , 0 . F },
72+ .texcoord = {0 .5F , 0 .771F }
7273 },
7374 { // 2
74- .position = {-3 , -3.4364917 , 0 },
75- .normal = {-0.65764374 , -0.7533291 , 0 },
76- .texcoord = {1 , 0.22844677 }
75+ .position = {-3 . F , -3 .436F , 0 . F },
76+ .normal = {-0 .658F , -0 .753F , 0 . F },
77+ .texcoord = {1 . F , 0 .228F }
7778 },
7879 { // 3
79- .position = {3 , -3.4364917 , 0 },
80- .normal = {0.65764374 , -0.7533291 , 0 },
81- .texcoord = {0.5 , 0.22844677 }
80+ .position = {3 . F , -3 .436F , 0 . F },
81+ .normal = {0 .658F , -0 .753F , 0 . F },
82+ .texcoord = {0 .5F , 0 .228F }
8283 },
8384 { // 4
84- .position = {0 , -3 , 3.4364917 },
85- .normal = {0 , -0.65764374 , 0.7533291 },
86- .texcoord = {0.75 , 0.27155325 }
85+ .position = {0 . F , -3 . F , 3 .436F },
86+ .normal = {0 . F , -0 .658F , 0 .753F },
87+ .texcoord = {0 .75F , 0 .271F }
8788 },
8889 { // 5
89- .position = {0 , 3 , 3.4364917 },
90- .normal = {0 , 0.65764374 , 0.7533291 },
91- .texcoord = {0.75 , 0.7284468 }
90+ .position = {0 . F , 3 . F , 3 .436F },
91+ .normal = {0 . F , 0 .658F , 0 .753F },
92+ .texcoord = {0 .75F , 0 .728F }
9293 },
9394 { // 6
94- .position = {0 , -3 , -3.4364917 },
95- .normal = {0 , -0.65764374 , -0.7533291 },
96- .texcoord = {0.25 , 0.27155325 }
95+ .position = {0 . F , -3 . F , -3 .436F },
96+ .normal = {0 . F , -0 .658F , -0 .753F },
97+ .texcoord = {0 .25F , 0 .271F }
9798 },
9899 { // 7
99- .position = {0 , 3 , -3.4364917 },
100- .normal = {0 , 0.65764374 , -0.7533291 },
101- .texcoord = {0.25 , 0.7284468 }
100+ .position = {0 . F , 3 . F , -3 .436F },
101+ .normal = {0 . F , 0 .658F , -0 .753F },
102+ .texcoord = {0 .25F , 0 .728F }
102103 },
103104 { // 8
104- .position = {3.4364917 , 0 , -3 },
105- .normal = {0.7533291 , 0 , -0.65764374 },
106- .texcoord = {0.3857766 , 0.5 }
105+ .position = {3 .436F , 0 . F , -3 . F },
106+ .normal = {0 .753F , 0 . F , -0 .658F },
107+ .texcoord = {0 .386F , 0 .5F }
107108 }, {
108- .position = {3.4364917 , 0 , 3 },
109- .normal = {0.7533291 , 0 , 0.65764374 },
110- .texcoord = {0.61422336 , 0.5 }
109+ .position = {3 .436F , 0 . F , 3 . F },
110+ .normal = {0 .753F , 0 . F , 0 .658F },
111+ .texcoord = {0 .614F , 0 .5F }
111112 }, {
112- .position = {-3.4364917 , 0 , -3 },
113- .normal = {-0.7533291 , 0 , -0.65764374 },
114- .texcoord = {0.11422336 , 0.5 }
113+ .position = {-3 .436F , 0 . F , -3 . F },
114+ .normal = {-0 .753F , 0 . F , -0 .658F },
115+ .texcoord = {0 .1142F , 0 .5F }
115116 }, {
116- .position = {-3.4364917 , 0 , 3 },
117- .normal = {-0.7533291 , 0 , 0.65764374 },
118- .texcoord = {0.88577664 , 0.5 }
117+ .position = {-3 .436F , 0 . F , 3 . F },
118+ .normal = {-0 .753F , 0 . F , 0 .658F },
119+ .texcoord = {0 .886F , 0 .5F }
119120 }
120121 };
121- CHECK (mesh.GetVertices () == mesh_vertices );
122+ CheckMeshVerticesApproxEquals (mesh.GetVertices (), reference_vertices );
122123
123124 const Mesh::Indices mesh_indices = {
124125 5 , 0 , 11 ,
0 commit comments