[cluttermm] Updated to provide output for make_check.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cluttermm] Updated to provide output for make_check.
- Date: Fri, 14 Mar 2014 09:10:00 +0000 (UTC)
commit d5f85253c56799fc56f2c21f9160374e23d1148b
Author: Ian Martin <martin_id vodafone co nz>
Date: Fri Mar 14 17:55:40 2014 +1300
Updated to provide output for make_check.
Only outputs messages on error, and returns a non-zero value if a check fails.
tests/test-point-class.cc | 52 +++++++++++++++++++++++++++++++-------------
1 files changed, 36 insertions(+), 16 deletions(-)
---
diff --git a/tests/test-point-class.cc b/tests/test-point-class.cc
index fbe341e..5133549 100644
--- a/tests/test-point-class.cc
+++ b/tests/test-point-class.cc
@@ -6,22 +6,32 @@ int main(int argc, char** argv)
// initialize the C++ wrapper types
Clutter::init(&argc, &argv);
- std::cout << "Creating Clutter::Point with (int) values: 8, 15" << std::endl;
+ //an error return value to add information to make check:
+ int errorval(0);
+ int p1x(8), p1y(15);
Clutter::Point point0;
Clutter::Point point1(8, 15);
- std::cout << "Initialisation: point0 = " << point0.get_x() <<
- "/ " << point0.get_y() << std::endl;
- std::cout << "and point1 = " << point1.get_x() << "/ " << point1.get_y() << std::endl;
+ if( ( point0.get_x() != 0) || ( point0.get_y() != 0 ) ||
+ ( point1.get_x() != p1x ) || ( point1.get_y() != p1y ) )
+ {
+ std::cout << "Problem creating points: p0 = " << point0.get_x() << "/" <<
+ point0.get_y() << " and p1 = " << point1.get_x() << "/" << point1.get_y()
+ << std::endl;
+ errorval++;
+ }
float x_dist(0);
float y_dist(0);
float dist = point0.distance(point1, x_dist, y_dist);
- std::cout << "Distance between the two is "<< dist <<
+ if(dist != 17) {
+ std::cout << "Distance between the two ( should be 17 ) is "<< dist <<
" with x and y distances " << x_dist << "/ " << y_dist << std::endl;
+ errorval += 10;
+ }
- //make life easy and use the 3/4/5 triangle now:
+ //use the 3/4/5 triangle now:
point0.set_x(7);
point0.set_y(6);
@@ -29,8 +39,11 @@ int main(int argc, char** argv)
point1.set_y(10);
dist = point0.distance(point1, x_dist, y_dist);
- std::cout << "Reset values; now distance is "<< dist <<
+ if(dist != 5) {
+ std::cout << "Distance between the two is "<< dist <<
" with x and y distances " << x_dist << "/ " << y_dist << std::endl;
+ errorval += 20;
+ }
//reversing to check negative values:
@@ -41,20 +54,27 @@ int main(int argc, char** argv)
point1.set_y(6);
dist = point0.distance(point1, x_dist, y_dist);
- std::cout << "Reversed values; now distance is "<< dist <<
+ if(dist != 5) {
+ std::cout << "Distance between the two is "<< dist <<
" with x and y distances " << x_dist << "/ " << y_dist << std::endl;
+ errorval += 30;
+ }
//point equality function check:
Clutter::Point comp_point(7.0 ,6.0);
- if(comp_point == point1){
- std::cout << "Points equal." << std::endl;
+ if(comp_point != point1){
+ std::cerr << "double Point unequal to equivalent double point." << std::endl;
+ errorval += 100;
}
- else
- {
- std::cout<< "Points not equal: comp = " << comp_point.get_x() <<
- "/" << comp_point.get_y() << " vs " <<
- point1.get_x() << "/" << point1.get_y() << std::endl;
+
+ //point equality function check for integer values:
+ Clutter::Point comp2_point(7 ,6);
+ if(comp2_point != point1){
+ std::cerr << "int Point unequal to equivalent double point." << std::endl;
+ errorval += 200;
}
- return 0;
+ std::cout<< "errorval: " << errorval << std::endl;
+
+ return errorval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]