-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests - Updated ShowTest, added PointTest Updated README
- Loading branch information
1 parent
19b745f
commit 9e6e66c
Showing
6 changed files
with
83 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "../catch/single_include/catch.hpp" | ||
#include "../../src/core/point.h" | ||
#include "pointtest.h" | ||
|
||
using namespace PixelMaestro; | ||
|
||
TEST_CASE("Create and manipulate a Point.", "[Point]") { | ||
int x = 40; | ||
int y = 60; | ||
Point point(x, y); | ||
|
||
SECTION("Verify coordinates are stored correctly.") { | ||
REQUIRE(point.x == x); | ||
REQUIRE(point.y == y); | ||
} | ||
|
||
SECTION("Verify coordinates can be resized.") { | ||
int new_x = 90; | ||
int new_y = 180; | ||
|
||
point.set(new_x, new_y); | ||
|
||
REQUIRE(point.x == new_x); | ||
REQUIRE(point.y == new_y); | ||
} | ||
|
||
SECTION("Verify inline index calculates correctly.") { | ||
int target_x = 15; | ||
int target_y = 30; | ||
|
||
int inline_index = (target_y * point.x) + target_x; | ||
|
||
REQUIRE(point.get_inline_index(target_x, target_y) == inline_index); | ||
} | ||
|
||
SECTION("Verify size.") { | ||
REQUIRE(point.size() == x * y); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef POINTTEST_H | ||
#define POINTTEST_H | ||
|
||
class PointTest { | ||
public: | ||
PointTest(); | ||
}; | ||
|
||
#endif // POINTTEST_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters