Skip to content
Snippets Groups Projects
Commit dcfa24ef authored by sgupta72's avatar sgupta72
Browse files

Working

parent b8f5a0da
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment