Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
33 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <rectangle.h> | ||
|
||
#define CATCH_CONFIG_MAIN | ||
#include <catch.hpp> | ||
|
||
#include <vector> | ||
#include <string> | ||
#include <memory> | ||
|
||
SCENARIO( "Test Rectangle" ) | ||
{ | ||
|
||
GIVEN( "A Rectangle of known size" ) | ||
{ | ||
Rectangle rect( 42, 69 ); | ||
|
||
const float expectedArea = 42*69; | ||
REQUIRE( rect.area() == expectedArea ); | ||
|
||
{ | ||
INFO( "Check get side functions" ) | ||
REQUIRE( rect.getSide1() == 42 ); | ||
REQUIRE( rect.getSide2() == 69 ); | ||
} | ||
|
||
WHEN( "Rectangle is scaled" ) | ||
{ | ||
rect.scale( 2 ); | ||
REQUIRE( rect.area() == expectedArea*4 ); | ||
} | ||
} | ||
} |
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