File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed
Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change 11#include < iostream>
2+ #include < vector>
23
34#include " gtest/gtest.h"
45
56#include " Renderer.h"
67
8+ using std::vector;
79using std::make_pair;
810
9- TEST (RendererTest, coordToScreen) {
11+ class CoordinateConversionTest : public ::testing::TestWithParam<Coordinate> {
12+
13+ };
14+
15+ TEST_P (CoordinateConversionTest, IsReversable) {
16+ ASSERT_EQ (GetParam (), screenToCoord (coordToScreen (GetParam ())));
17+ }
18+
19+ vector<Coordinate> makeInputs () {
20+ vector<Coordinate> ret;
1021 for (int x = -5 ; x < 5 ; x++) {
11- for (auto y = -5 ; y < 5 ; y++) {
12- auto original = make_pair (x, y);
13- auto screen = coordToScreen (original);
14- auto back = screenToCoord (screen);
15- ASSERT_EQ (original.first , back.first );
16- ASSERT_EQ (original.second , back.second );
22+ for (int y = -5 ; y < 5 ; y++) {
23+ ret.push_back (Coordinate{x, y});
1724 }
1825 }
26+ return std::move (ret);
1927}
28+
29+ INSTANTIATE_TEST_CASE_P (LargeSquare, CoordinateConversionTest, ::testing::ValuesIn(makeInputs()));
You can’t perform that action at this time.
0 commit comments