COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
2_testcase.cpp
Go to the documentation of this file.
1#include <iostream>
2#include <cassert>
3#include "bounding.h"
4using namespace std;
5
6void check_and_reset(int& x1, int& y1, int& w1, int& h1, int x2, int y2, int w2, int h2){
7 assert(x1 == x2 && y1 == y2 && w1 == w2 && h1 == h2);
8 x1 = 0;
9 y1 = 0;
10 w1 = 10;
11 h1 = 10;
12}
13
14int main(){
15 int x1 = 0;
16 int y1 = 0;
17 int w1 = 10;
18 int h1 = 10;
19 cout << "question2-----ext1" << endl;
20 assert(mergeBoundingBoxes(x1,y1,w1,h1,5,5,10,10) == true);
21 check_and_reset(x1,y1,w1,h1,0,0,15,15);
22 cout << "question2-----ext2" << endl;
23 assert(mergeBoundingBoxes(x1,y1,w1,h1,5,-5,10,10) == true);
24 check_and_reset(x1,y1,w1,h1,0,-5,15,15);
25 cout << "question2-----ext3" << endl;
26 assert(mergeBoundingBoxes(x1,y1,w1,h1,-5,-5,10,10) == true);
27 check_and_reset(x1,y1,w1,h1,-5,-5,15,15);
28 cout << "question2-----ext4" << endl;
29 assert(mergeBoundingBoxes(x1,y1,w1,h1,-5,5,10,10) == true);
30 check_and_reset(x1,y1,w1,h1,-5,0,15,15);
31 return 0;
32}
void check_and_reset(int &x1, int &y1, int &w1, int &h1, int x2, int y2, int w2, int h2)
Definition 2_testcase.cpp:6
int main()
bool mergeBoundingBoxes(int &x1, int &y1, int &w1, int &h1, int x2, int y2, int w2, int h2)
Definition 2.cpp:9