From dcfa24efc69de7934e646e0454c5eba7708d01a4 Mon Sep 17 00:00:00 2001 From: Shivam Gupta <sgupta72@illinois.edu> Date: Mon, 27 Nov 2017 12:15:30 -0600 Subject: [PATCH] Working --- test.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/test.cpp b/test.cpp index fc072f5..ba0a193 100644 --- a/test.cpp +++ b/test.cpp @@ -5,7 +5,20 @@ #include "window.h" using namespace std; -void TestRect() +void TestRectMove() +{ + Window window; + Rect rect("mario.png", window); + Rect rect2("mario.png", window); + rect.Move(5, 5); + assert(rect.get_x() == 5); + assert(rect.get_y() == 5); + rect2.Move(400, 400); + assert(rect2.get_x() == 400); + assert(rect2.get_y() == 400); +} + +void TestRectNotColliding() { Window window; Rect rect("mario.png", window); @@ -17,12 +30,21 @@ void TestRect() assert(rect2.get_x() == 400); assert(rect2.get_y() == 400); assert(!rect.CheckCollision(rect2)); + +} +void TestColliding() +{ + Window window; + Rect rect("mario.png", window); + Rect rect2("mario.png", window); + rect.Move(5, 5); + assert(rect.get_x() == 5); + assert(rect.get_y() == 5); rect2.Move(6, 6); assert(rect2.get_x() == 6); assert(rect2.get_y() == 6); assert(rect.CheckCollision(rect2)); } - void TestPlayerEnemy() { Window window; @@ -33,6 +55,8 @@ void TestPlayerEnemy() int main() { - TestRect(); + TestRectMove(); + TestRectNotColliding(); + TestColliding(); TestPlayerEnemy(); } -- GitLab