|
[yoda-svn] r461 - in trunk: include/YODA tests/Histo1D tests/Profile1D tests/Scatter2Dblackhole at projects.hepforge.org blackhole at projects.hepforge.orgThu May 3 00:28:51 BST 2012
Author: buckley Date: Thu May 3 00:28:51 2012 New Revision: 461 Log: Fix edge detection in ranges to match edge equality definition, and finish tidying of test programs Modified: trunk/include/YODA/Axis1D.h trunk/tests/Histo1D/H1DCreate.cc trunk/tests/Histo1D/H1DFill.cc trunk/tests/Histo1D/H1DModify.cc trunk/tests/Profile1D/P1DCreate.cc trunk/tests/Profile1D/P1DFill.cc trunk/tests/Profile1D/P1DModify.cc trunk/tests/Scatter2D/S2DCreate.cc trunk/tests/Scatter2D/S2DModify.cc Modified: trunk/include/YODA/Axis1D.h ============================================================================== --- trunk/include/YODA/Axis1D.h Wed May 2 20:32:42 2012 (r460) +++ trunk/include/YODA/Axis1D.h Thu May 3 00:28:51 2012 (r461) @@ -356,14 +356,14 @@ _binhash[bin(i).xMin()] = i; // If the next bin is not contiguous, add a gap index for the high edge of this bin if (i+1 < numBins() && !fuzzyEquals(bin(i).xMax(), bin(i+1).xMin())) { - _binhash[bin(i).xMin()] = -1; + _binhash[bin(i).xMax()] = -1; } } } /// Check if there are any bin edges between values @a from and @a to. bool _edgeInRange(double from, double to) const { - return (--_binhash.upper_bound(from)) != (--_binhash.upper_bound(to)); + return (--_binhash.upper_bound(from)) != (--_binhash.lower_bound(to)); } /// Check if there are any gaps in the axis' binning between bin indices @a from and @a to, inclusive. Modified: trunk/tests/Histo1D/H1DCreate.cc ============================================================================== --- trunk/tests/Histo1D/H1DCreate.cc Wed May 2 20:32:42 2012 (r460) +++ trunk/tests/Histo1D/H1DCreate.cc Thu May 3 00:28:51 2012 (r461) @@ -8,7 +8,7 @@ int main() { MSG_BLUE("Testing Histo1D constructors: "); - MSG_("The most basic, linear constructor:"); + MSG_(PAD(70) << "The most basic, linear constructor:"); Histo1D h(100, 0, 100); if (h.numBins() != 100) { MSG_RED("FAIL: Wrong number of bins was created!"); @@ -29,7 +29,7 @@ MSG_GREEN("PASS"); - MSG_("Explicit bin edges constructor: "); + MSG_(PAD(70) << "Explicit bin edges constructor: "); vector<double> edges; for (int i = 0; i < 101; ++i) edges.push_back(i); Histo1D h1(edges); @@ -51,7 +51,8 @@ } MSG_GREEN("PASS"); - MSG_("Copy constructor: "); + + MSG_(PAD(70) << "Copy constructor: "); Histo1D h2(h); if (h2.numBins() != 100) { MSG_RED("FAIL: Wrong number of bins was created!"); Modified: trunk/tests/Histo1D/H1DFill.cc ============================================================================== --- trunk/tests/Histo1D/H1DFill.cc Wed May 2 20:32:42 2012 (r460) +++ trunk/tests/Histo1D/H1DFill.cc Thu May 3 00:28:51 2012 (r461) @@ -1,74 +1,80 @@ #include "YODA/Histo1D.h" +#include "YODA/Utils/Formatting.h" -#include <iostream> -using namespace std; using namespace YODA; +using namespace std; int main() { - /// Creating a histo: + MSG_BLUE("Testing Histo1D filling: "); + + MSG_(PAD(70) << "Setting up a 100 bin histo from 0-100: "); Histo1D h(100, 0, 100); - - cout << "Trying to fill the sample histogram: "; + MSG_GREEN("PASS"); + + MSG_(PAD(70) << "Trying to fill the sample histogram: "); h.fill(0,2); - cout << "PASS" << endl; - - cout << "Checking sumW: "; - if(h.sumW() != 2) { - cout << "FAIL" << endl; - return -1; - } - cout << "PASS" << endl; - - cout << "Checking sumW2: "; - if(h.sumW2() != 4) { - cout << "FAIL" << endl; + MSG_GREEN("PASS"); + + MSG_(PAD(70) << "Checking sumW: "); + if (h.sumW() != 2) { + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; - + MSG_GREEN("PASS"); + MSG_(PAD(70) << "Checking sumW2: "); + if (h.sumW2() != 4) { + MSG_RED("FAIL"); + return -1; + } + MSG_GREEN("PASS"); + + MSG_(PAD(70) << "Trying to fill again: "); h.fill(10, 2); + MSG_GREEN("PASS"); - cout << "Checking mean: "; - if(!fuzzyEquals(5, h.mean(false))) { - cout << "FAIL" << endl; + MSG_(PAD(70) << "Checking mean: "); + if (!fuzzyEquals(5, h.mean(false))) { + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Checking variance: "; - if(!fuzzyEquals(25, h.variance(false))){ - cout << "FAIL" << endl; + MSG_(PAD(70) << "Checking variance: "); + if (!fuzzyEquals(25, h.variance(false))) { + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; - - cout << "Checking standard deviation: "; - if(!fuzzyEquals(5, h.stdDev(false))){ - cout << "FAIL" << endl; + MSG_GREEN("PASS"); + + MSG_(PAD(70) << "Checking standard deviation: "); + if (!fuzzyEquals(5, h.stdDev(false))) { + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Trying to fill the underflow: "; + MSG_(PAD(70) << "Trying to fill the underflow: "); h.fill(-10,1); - cout << "PASS" << endl; - cout << "Checking if stats were set correctly: "; - if(!fuzzyEquals(h.underflow().mean(), -10)) { - cout << "FAIL" << endl; + MSG_GREEN("PASS"); + + MSG_(PAD(70) << "Checking if stats were set correctly: "); + if (!fuzzyEquals(h.underflow().mean(), -10)) { + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Trying to fill the overflow: "; + MSG_(PAD(70) << "Trying to fill the overflow: "); h.fill(110,1); - cout << "PASS" << endl; - cout << "Checking if stats were set correctly: "; - if(!fuzzyEquals(h.overflow().mean(), 110)) { - cout << "FAIL" << endl; + MSG_GREEN("PASS"); + + MSG_(PAD(70) << "Checking if stats were set correctly: "); + if (!fuzzyEquals(h.overflow().mean(), 110)) { + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); return EXIT_SUCCESS; } Modified: trunk/tests/Histo1D/H1DModify.cc ============================================================================== --- trunk/tests/Histo1D/H1DModify.cc Wed May 2 20:32:42 2012 (r460) +++ trunk/tests/Histo1D/H1DModify.cc Thu May 3 00:28:51 2012 (r461) @@ -5,6 +5,7 @@ using namespace std; int main() { + MSG_BLUE("Testing Histo1D modifiers: "); MSG_(PAD(70) << "Setting up a 100 bin histo from 0-100: "); Histo1D h(100, 0, 100); @@ -47,7 +48,7 @@ MSG_GREEN("PASS"); MSG_(PAD(70) << "Checking if it is possible to add a bin: "); - h.addBin(0, 10.9); + h.addBin(0, 11); MSG_GREEN("PASS"); MSG_(PAD(70) << "Checking if it was added properly: "); Modified: trunk/tests/Profile1D/P1DCreate.cc ============================================================================== --- trunk/tests/Profile1D/P1DCreate.cc Wed May 2 20:32:42 2012 (r460) +++ trunk/tests/Profile1D/P1DCreate.cc Thu May 3 00:28:51 2012 (r461) @@ -1,46 +1,48 @@ #include "YODA/Profile1D.h" +#include "YODA/Utils/Formatting.h" -#include <iostream> -using namespace std; using namespace YODA; +using namespace std; int main() { - cout << "Testing range/number constructor "; + MSG_BLUE("Testing Profile1D construction: "); + + MSG_(PAD(70) << "Testing range/number constructor "); Profile1D p1(100, 0, 100); - if(p1.sumW() != 0 || p1.sumW2() != 0 || p1.sumW(false) != 0 || p1.sumW2(false) != 0){ - cout << "FAIL" << endl; + if (p1.sumW() != 0 || p1.sumW2() != 0 || p1.sumW(false) != 0 || p1.sumW2(false) != 0) { + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Testing explicit edges constructor "; + + MSG_(PAD(70) << "Testing explicit edges constructor "); vector<double> edges; - for(size_t i = 0; i < 101; ++i) edges.push_back(i); + for (size_t i = 0; i < 101; ++i) edges.push_back(i); Profile1D p2(edges); - - if(p2.sumW() != 0 || p2.sumW2() != 0 || p2.sumW(false) != 0 || p2.sumW2(false) != 0){ - cout << "FAIL" << endl; + if (p2.sumW() != 0 || p2.sumW2() != 0 || p2.sumW(false) != 0 || p2.sumW2(false) != 0) { + MSG_RED("FAIL"); return -1; } - if(p2.numBins() != 100){ - cout << "FAIL" << endl; + if (p2.numBins() != 100){ + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; - - cout << "Preliminary testing of = operator "; + MSG_GREEN("PASS"); + + + MSG_(PAD(70) << "Preliminary testing of = operator "); Profile1D p3(edges); p3 = p2; - - if(p3.sumW() != 0 || p3.sumW2() != 0 || p3.sumW(false) != 0 || p3.sumW2(false) != 0){ - cout << "FAIL" << endl; + if (p3.sumW() != 0 || p3.sumW2() != 0 || p3.sumW(false) != 0 || p3.sumW2(false) != 0){ + MSG_RED("FAIL"); return -1; } - if(p3.numBins() != 100){ - cout << "FAIL" << endl; + if (p3.numBins() != 100){ + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); return EXIT_SUCCESS; } Modified: trunk/tests/Profile1D/P1DFill.cc ============================================================================== --- trunk/tests/Profile1D/P1DFill.cc Wed May 2 20:32:42 2012 (r460) +++ trunk/tests/Profile1D/P1DFill.cc Thu May 3 00:28:51 2012 (r461) @@ -1,51 +1,57 @@ #include "YODA/Profile1D.h" +#include "YODA/Utils/Formatting.h" -#include <iostream> -using namespace std; using namespace YODA; +using namespace std; int main() { + MSG_BLUE("Testing Profile1D filling: "); + + MSG_(PAD(70) << "Setting up 100-bin profile histo "); Profile1D p(100, 0, 100); + MSG_GREEN("PASS"); - cout << "Testing fill operator: "; + MSG_(PAD(70) << "Testing fill operator: "); p.fill(1,1,2); - if(p.sumW() != 2 || p.sumW2() != 4) { - cout << "FAIL" << endl; + if (p.sumW() != 2 || p.sumW2() != 4) { + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Testing the fill of the underflow: "; + + MSG_(PAD(70) << "Testing the fill of the underflow: "); p.fill(-10,2,3); - if(p.underflow().xMean() != -10){ - cout << "FAIL" << endl; + if (p.underflow().xMean() != -10) { + MSG_RED("FAIL"); return -1; } - if(p.underflow().yMean() != 2){ - cout << "FAIL" << endl; + if (p.underflow().yMean() != 2) { + MSG_RED("FAIL"); return -1; } - if(p.underflow().sumW() != 3 || p.underflow().sumW2() != 9){ - cout << "FAIL" << endl; + if (p.underflow().sumW() != 3 || p.underflow().sumW2() != 9) { + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; - - cout << "Testing the fill of the underflow: "; + MSG_GREEN("PASS"); + + + MSG_(PAD(70) << "Testing the fill of the underflow: "); p.fill(110,2,3); - if(p.overflow().xMean() != 110){ - cout << "FAIL" << endl; + if (p.overflow().xMean() != 110) { + MSG_RED("FAIL"); return -1; } - if(p.overflow().yMean() != 2){ - cout << "FAIL" << endl; + if (p.overflow().yMean() != 2) { + MSG_RED("FAIL"); return -1; } - if(p.overflow().sumW() != 3 || p.overflow().sumW2() != 9){ - cout << "FAIL" << endl; + if (p.overflow().sumW() != 3 || p.overflow().sumW2() != 9) { + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); return EXIT_SUCCESS; } Modified: trunk/tests/Profile1D/P1DModify.cc ============================================================================== --- trunk/tests/Profile1D/P1DModify.cc Wed May 2 20:32:42 2012 (r460) +++ trunk/tests/Profile1D/P1DModify.cc Thu May 3 00:28:51 2012 (r461) @@ -5,7 +5,7 @@ using namespace std; int main() { - MSG_BLUE("Testing Profile1D: "); + MSG_BLUE("Testing Profile1D modifiers: "); MSG_(PAD(70) << "Creating the Profile1D: "); Profile1D p(100,0,100); Modified: trunk/tests/Scatter2D/S2DCreate.cc ============================================================================== --- trunk/tests/Scatter2D/S2DCreate.cc Wed May 2 20:32:42 2012 (r460) +++ trunk/tests/Scatter2D/S2DCreate.cc Thu May 3 00:28:51 2012 (r461) @@ -1,61 +1,60 @@ #include "YODA/Scatter2D.h" -#include "YODA/Point2D.h" +#include "YODA/Utils/Formatting.h" -#include <iostream> -using namespace std; using namespace YODA; +using namespace std; int main() { - cout << "Constructing a scatter (empty const): "; + MSG_BLUE("Testing Scatter2D construction: "); + + + MSG_(PAD(70) << "Constructing a scatter (empty const): "); Scatter2D s1(); - cout << "PASS" << endl; - - - cout << "Constructing a scatter (vector of points)"; + MSG_GREEN("PASS"); + + MSG_(PAD(70) << "Constructing a scatter (vector of points)"); vector<Point2D> points; Point2D apoint(0,0,0); points.push_back(apoint); - Scatter2D s2(points); - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Constructing a scatter (values, no errs) "; + MSG_(PAD(70) << "Constructing a scatter (values, no errs) "); vector<double> values; values.push_back(0); Scatter2D s3(values, values); - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Constructing a scatter (values, sym errs)"; + MSG_(PAD(70) << "Constructing a scatter (values, sym errs)"); Scatter2D s4(values, values, values, values); - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Constructing a scatter (sym err x,asym y)"; + MSG_(PAD(70) << "Constructing a scatter (sym err x,asym y)"); vector<pair<double, double> > valuesS; valuesS.push_back(make_pair(0,0)); Scatter2D s5(values, values, values, valuesS); - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Constructing a scatter (asym x, asym y) "; + MSG_(PAD(70) << "Constructing a scatter (asym x, asym y) "); Scatter2D s6(values, values, valuesS, valuesS); - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Constructing a scatter (axym x, sym y) "; + MSG_(PAD(70) << "Constructing a scatter (axym x, sym y) "); Scatter2D s7(values, values, valuesS, values); - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Constructing a scatter (explicit asym) "; + MSG_(PAD(70) << "Constructing a scatter (explicit asym) "); Scatter2D s8(values, values, values, values, values, values); - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Testing a copy operator: "; + MSG_(PAD(70) << "Testing a copy operator: "); Scatter2D s9(s8); - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Testing an assignment operator: "; + MSG_(PAD(70) << "Testing an assignment operator: "); Scatter2D s10(s9); s10 = s7; - cout << "PASS" << endl; + MSG_GREEN("PASS"); - return EXIT_SUCCESS; } Modified: trunk/tests/Scatter2D/S2DModify.cc ============================================================================== --- trunk/tests/Scatter2D/S2DModify.cc Wed May 2 20:32:42 2012 (r460) +++ trunk/tests/Scatter2D/S2DModify.cc Thu May 3 00:28:51 2012 (r461) @@ -1,146 +1,160 @@ #include "YODA/Scatter2D.h" +#include "YODA/Utils/Formatting.h" -#include <iostream> -using namespace std; using namespace YODA; +using namespace std; int main() { + MSG_BLUE("Testing Scatter2D modifiers: "); + + + MSG_(PAD(70) << "Constructing a scatter: "); vector<double> coords; coords.push_back(0); coords.push_back(1); Scatter2D s1(coords, coords); - - cout << "Scaling the scatter: "; + MSG_GREEN("PASS"); + + + MSG_(PAD(70) << "Scaling the scatter: "); s1.scale(2,3); - if(s1.point(1).x() != 2 || s1.point(1).y() != 3){ - cout << "FAIL" << endl; + if (s1.point(1).x() != 2 || s1.point(1).y() != 3) { + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Adding a point (first method): "; + + MSG_(PAD(70) << "Adding a point (first method): "); Point2D point(1,1); s1.addPoint(point); - if(s1.numPoints() != 3){ - cout << "FAIL" << endl; + if (s1.numPoints() != 3) { + MSG_RED("FAIL"); return -1; } - if(s1.point(1).x() != 1 || s1.point(1).y() != 1){ - cout << "FAIL" << endl; + if (s1.point(1).x() != 1 || s1.point(1).y() != 1) { + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); + - cout << "Adding a point (second method): "; + MSG_(PAD(70) << "Adding a point (second method): "); s1.addPoint(-1, -1); - if(s1.numPoints() != 4){ - cout << "FAIL" << endl; + if (s1.numPoints() != 4) { + MSG_RED("FAIL"); return -1; } - if(s1.point(0).x() != -1 || s1.point(0).y() != -1){ - cout << "FAIL" << endl; + if (s1.point(0).x() != -1 || s1.point(0).y() != -1) { + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Adding a point (third method): "; + + MSG_(PAD(70) << "Adding a point (third method): "); s1.addPoint(5,4,6,3); - if(s1.numPoints() != 5){ - cout << "FAIL" << endl; + if (s1.numPoints() != 5) { + MSG_RED("FAIL"); return -1; } - if(s1.point(4).x() != 5 || s1.point(4).y() != 4 || - s1.point(4).xErrMinus() != 6 || s1.point(4).xErrPlus() != 6 || - s1.point(4).yErrMinus() != 3 || s1.point(4).yErrPlus() != 3){ - cout << "FAIL" << endl; + if (s1.point(4).x() != 5 || s1.point(4).y() != 4 || + s1.point(4).xErrMinus() != 6 || s1.point(4).xErrPlus() != 6 || + s1.point(4).yErrMinus() != 3 || s1.point(4).yErrPlus() != 3){ + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Adding a point (fourth method): "; + MSG_(PAD(70) << "Adding a point (fourth method): "); pair<double, double> errs; errs = make_pair(1,2); s1.addPoint(10,11, errs, 2); - if(s1.numPoints() != 6){ - cout << "FAIL" << endl; + if (s1.numPoints() != 6) { + MSG_RED("FAIL"); return -1; } - if(s1.point(5).x() != 10 || s1.point(5).y() != 11 || - s1.point(5).xErrMinus() != 1 || s1.point(5).xErrPlus() != 2 || - s1.point(5).yErrMinus() != 2 || s1.point(5).yErrPlus() != 2){ - cout << "FAIL" << endl; + if (s1.point(5).x() != 10 || s1.point(5).y() != 11 || + s1.point(5).xErrMinus() != 1 || s1.point(5).xErrPlus() != 2 || + s1.point(5).yErrMinus() != 2 || s1.point(5).yErrPlus() != 2){ + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); + - cout << "Adding a point (fifth method): "; + MSG_(PAD(70) << "Adding a point (fifth method): "); s1.addPoint(12,14,6,errs); - if(s1.numPoints() != 7){ - cout << "FAIL" << endl; + if (s1.numPoints() != 7) { + MSG_RED("FAIL"); return -1; } - if(s1.point(6).x() != 12 || s1.point(6).y() != 14 || - s1.point(6).xErrMinus() != 6 || s1.point(6).xErrPlus() != 6 || - s1.point(6).yErrMinus() != 1 || s1.point(6).yErrPlus() != 2){ - cout << "FAIL" << endl; + if (s1.point(6).x() != 12 || s1.point(6).y() != 14 || + s1.point(6).xErrMinus() != 6 || s1.point(6).xErrPlus() != 6 || + s1.point(6).yErrMinus() != 1 || s1.point(6).yErrPlus() != 2){ + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Adding a point (sixth method): "; + + MSG_(PAD(70) << "Adding a point (sixth method): "); pair<double, double> errsy; errsy = make_pair(100, 200); s1.addPoint(300, 400, errs, errsy); - if(s1.numPoints() != 8){ - cout << "FAIL" << endl; + if (s1.numPoints() != 8) { + MSG_RED("FAIL"); return -1; } - if(s1.point(7).x() != 300 || s1.point(7).y() != 400 || - s1.point(7).xErrMinus() != 1 || s1.point(7).xErrPlus() != 2 || - s1.point(7).yErrMinus() != 100 || s1.point(7).yErrPlus() != 200){ - cout << "FAIL" << endl; + if (s1.point(7).x() != 300 || s1.point(7).y() != 400 || + s1.point(7).xErrMinus() != 1 || s1.point(7).xErrPlus() != 2 || + s1.point(7).yErrMinus() != 100 || s1.point(7).yErrPlus() != 200){ + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); + - cout << "Adding a point (seventh method): "; + MSG_(PAD(70) << "Adding a point (seventh method): "); s1.addPoint(300, 400, 1, 2, 3, 4); - if(s1.numPoints() != 9){ - cout << "FAIL" << endl; + if (s1.numPoints() != 9) { + MSG_RED("FAIL"); return -1; } - if(s1.point(8).x() != 300 || s1.point(8).y() != 400 || - s1.point(8).xErrMinus() != 1 || s1.point(8).xErrPlus() != 2 || - s1.point(8).yErrMinus() != 3 || s1.point(8).yErrPlus() != 4){ - cout << "FAIL" << endl; + if (s1.point(8).x() != 300 || s1.point(8).y() != 400 || + s1.point(8).xErrMinus() != 1 || s1.point(8).xErrPlus() != 2 || + s1.point(8).yErrMinus() != 3 || s1.point(8).yErrPlus() != 4){ + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); - cout << "Adding a point (eighth method): "; + + MSG_(PAD(70) << "Adding a point (eighth method): "); Point2D p2(800, 900); Point2D p3(1000, 1000); vector<Point2D> p5; p5.push_back(p2); p5.push_back(p3); s1.addPoints(p5); - if(s1.numPoints() != 11){ - cout << "FAIL" << endl; + if (s1.numPoints() != 11) { + MSG_RED("FAIL"); return -1; } - if(s1.point(9).x() != 800 || s1.point(9).y() != 900 || - s1.point(9).xErrMinus() != 0 || s1.point(9).xErrPlus() != 0 || - s1.point(9).yErrMinus() != 0 || s1.point(9).yErrPlus() != 0 || - s1.point(10).x() != 1000 || s1.point(10).y() != 1000){ - cout << "FAIL" << endl; + if (s1.point(9).x() != 800 || s1.point(9).y() != 900 || + s1.point(9).xErrMinus() != 0 || s1.point(9).xErrPlus() != 0 || + s1.point(9).yErrMinus() != 0 || s1.point(9).yErrPlus() != 0 || + s1.point(10).x() != 1000 || s1.point(10).y() != 1000){ + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; + MSG_GREEN("PASS"); + - cout << "Trying to reset the scatter: "; + MSG_(PAD(70) << "Trying to reset the scatter: "); s1.reset(); - if(s1.numPoints() != 0){ - cout << "FAIL" << endl; + if (s1.numPoints() != 0){ + MSG_RED("FAIL"); return -1; } - cout << "PASS" << endl; - + MSG_GREEN("PASS"); + return EXIT_SUCCESS; }
More information about the yoda-svn mailing list |