-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestImageParam.cpp
84 lines (79 loc) · 3.08 KB
/
testImageParam.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <iostream>
#include "imageParam.h"
using namespace std;
int main(){
int numPixel = 256;
int numScanlines = 127;
int numElements = 128;
imageParam* parameters = new imageParam();
// Case 1 - Objective: Check Variable initialization
cout<<"Testing Case 1: Correct Variable Initialization"<<endl;
cout<<"numElement: Correct Value = 128, Your Value = "<<parameters->getNumElement()<<endl;
if(parameters->getNumElement() == 128){
cout<<"Success"<<endl;
} else {
cout<<"Failed"<<endl;
return -1;
}
cout<<"numSample: Correct Value = 3338, Your Value = "<<parameters->getNumSample()<<endl;
if(parameters->getNumSample() == 3338){
cout<<"Success"<<endl;
} else {
cout<<"Failed"<<endl;
return -1;
}
cout<<"numScanline: Correct Value = 127, Your Value = "<<parameters->getNumScanline()<<endl;
if(parameters->getNumScanline() == 127){
cout<<"Success"<<endl;
} else {
cout<<"Failed"<<endl;
return -1;
}
// Case 2 - Objective: Check Element positions
cout<<"Testing Case 2: Correct Element positions"<<endl;
cout<<"getElementPosition(60) = -0.0010668, Your Value = "<<parameters->getElementPosition(60)<<endl;
if(parameters->getElementPosition(60) > -0.0011 && parameters->getElementPosition(60) < -0.001){
cout<<"Success"<<endl;
} else {
cout<<"Failed"<<endl;
return -1;
}
cout<<"getElementPosition(110) = 0.0141732, Your Value = "<<parameters->getElementPosition(110)<<endl;
if(parameters->getElementPosition(110) > 0.013 && parameters->getElementPosition(110) < 0.015){
cout<<"Success"<<endl;
} else {
cout<<"Failed"<<endl;
return -1;
}
// Case 3 - Objective: Check scanline positions
cout<<"Testing Case 3: Correct Scanline positions"<<endl;
cout<<"getXPosition(30,30) = -0.0100584, Your Value = "<<parameters->getXPosition(30,30)<<endl;
if(parameters->getXPosition(30,30) > -0.0103632 && parameters->getXPosition(30,30) < -0.0097536){
cout<<"Success"<<endl;
} else {
cout<<"Failed"<<endl;
return -1;
}
cout<<"parameters->getYPosition(30,30) = 0.00588235, Your Value = "<<parameters->getYPosition(30,30)<<endl;
if(parameters->getYPosition(30,30) > 0.00568627 && parameters->getYPosition(30,30) < 0.00607843){
cout<<"Success"<<endl;
} else {
cout<<"Failed"<<endl;
return -1;
}
cout<<"Testing Case 3: Correct Scanline positions"<<endl;
cout<<"getXPosition(63,60) = 0, Your Value = "<<parameters->getXPosition(63,60)<<endl;
if(parameters->getXPosition(63,60) > -0.001 && parameters->getXPosition(63,60) < 0.001){
cout<<"Success"<<endl;
} else {
cout<<"Failed"<<endl;
return -1;
}
cout<<"parameters->getYPosition(63,60) = 0.0117647, Your Value = "<<parameters->getYPosition(63,60)<<endl;
if(parameters->getYPosition(63,60) > 0.0117 && parameters->getYPosition(63,60) < 0.0118){
cout<<"Success"<<endl;
} else {
cout<<"Failed"<<endl;
return -1;
}
}