[yoda-svn] r410 - in trunk/tests: . Histo2D

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Dec 6 17:34:38 GMT 2011


Author: buckley
Date: Tue Dec  6 17:34:38 2011
New Revision: 410

Log:
Updating use of API by tests, since Histo2D::numBinsTotal() has been removed

Modified:
   trunk/tests/Histo2D/H2DModify.cc
   trunk/tests/TestHisto2Derase.cc

Modified: trunk/tests/Histo2D/H2DModify.cc
==============================================================================
--- trunk/tests/Histo2D/H2DModify.cc	Tue Dec  6 17:09:01 2011	(r409)
+++ trunk/tests/Histo2D/H2DModify.cc	Tue Dec  6 17:34:38 2011	(r410)
@@ -18,14 +18,14 @@
     struct timeval endTime;
     Histo2D h(200, 0, 100, 200, 0, 100);
 
-    double tS; 
+    double tS;
     double tE;
     cout << "Adding bins                              ";
     size_t before = h.numBins();
     h.addBin(0.1, 0.1, 0.2, 0.2);
     h.addBin(110, 0, 200, 12.100);
     h.addBin(16.0, 200, 17.0, 300);
-    
+
     /// @todo Add position checking
     if(before != h.numBins() - 3) {
       cout << "FAIL" << endl;
@@ -62,7 +62,7 @@
     cout << "Does bin addition work?                  ";
     beforeAdd = h.numBins();
     h.addBin(150, 150, 200, 200);
-    if (beforeAdd == h.numBinsTotal()) {
+    if (beforeAdd == h.numBins()) {
         cout << "FAIL" << endl;
         return -1;
     }
@@ -70,9 +70,9 @@
 
     // Checking if a broken bin triggers _dropEdge().
     cout << "Does a broken bin trigger _droEdge()?    ";
-    beforeAdd = h.numBinsTotal();
+    beforeAdd = h.numBins();
     h.addBin(0.756, 0.213, 12.1234, 23);
-    if (beforeAdd != h.numBinsTotal()) {
+    if (beforeAdd != h.numBins()) {
         cout << "FAIL" << endl;
         return -1;
     }
@@ -80,14 +80,14 @@
 
     // A check testing mostly _fixOrientation()
     cout << "How about adding a bin in 3rd quadrant?  ";
-    beforeAdd = h.numBinsTotal();
+    beforeAdd = h.numBins();
     h.addBin(-12, -12, -1, -1);
-    if (beforeAdd == h.numBinsTotal()) {
+    if (beforeAdd == h.numBins()) {
         cout << "FAIL" << endl;
         return -1;
     }
     cout << "PASS" << endl;
-    
+
     cout << "Trying to fill the newly created bin:    ";
     int fillTest = h.fill(-3, -3, 1);
     if (fillTest == -1 || fillTest != (int)h.numBins() - 1) {
@@ -101,7 +101,7 @@
     int xMin, xMax, yMin, yMax;
     xMin = h.xMin(); xMax = h.xMax(); yMin = h.yMin(); yMax = h.yMax();
     h.scaleXY(2.0, 3.0);
-    if(h.xMin() != 2*xMin || h.xMax() != 2*xMax || 
+    if(h.xMin() != 2*xMin || h.xMax() != 2*xMax ||
        h.yMin() != 3*yMin || h.yMax() != 3*yMax) {
       cout << "FAIL" << endl;
       return -1;
@@ -116,7 +116,7 @@
     tS = (startTime.tv_sec*1000000 + startTime.tv_usec)/(double)1000000;
     tE = (endTime.tv_sec*1000000 + endTime.tv_usec)/(double)1000000;
     cout << "PASS (" << tE - tS << "s)" << endl;
-    
+
     cout << "Testing cuts:                            ";
     Histo2D sampleHisto(50, 0, 100, 39, 0, 10);
     sampleHisto.fill(0,0,123121);
@@ -125,11 +125,11 @@
         return -1;
     }
     if (!fuzzyEquals(sampleHisto.sumW2(false), 1.51588e+10)) {
-        cout << "FAIL" << endl; 
+        cout << "FAIL" << endl;
         return -1;
     }
     cout << "PASS" << endl;
-    
+
     cout << "Testing cutterX:                         ";
     Histo1D atY(sampleHisto.cutterX(0));
     if (!fuzzyEquals(atY.sumW(false), sampleHisto.sumW(false))){
@@ -137,7 +137,7 @@
         return -1;
     }
     cout << "PASS" << endl;
-    
+
     cout << "Another cutterX test:                    ";
     Histo1D atX2(sampleHisto.cutterX(2));
     if (!fuzzyEquals(atX2.sumW(false), 0)){
@@ -145,7 +145,7 @@
         return -1;
     }
     cout << "PASS" << endl;
-    
+
     cout << "Testing cutterY:                         ";
     Histo1D atX(sampleHisto.cutterY(0));
     if (!fuzzyEquals(atX.sumW(false), sampleHisto.sumW(false))){
@@ -154,14 +154,14 @@
     }
     cout << "PASS" << endl;
 
-    cout << "Testing bin merger:                      "; 
+    cout << "Testing bin merger:                      ";
     gettimeofday(&startTime, NULL);
     h.mergeBins(0, 20000);
     gettimeofday(&endTime, NULL);
     tS = (startTime.tv_sec*1000000 + startTime.tv_usec)/(double)1000000;
     tE = (endTime.tv_sec*1000000 + endTime.tv_usec)/(double)1000000;
     cout << "PASS (" << tE - tS << ")" << endl;
-    
+
     cout << "Testing if histo2D transforms to Profile:";
     Histo2D test1(100, 0, 100, 100, 0, 100);
     Profile1D test2(100, 0, 100);

Modified: trunk/tests/TestHisto2Derase.cc
==============================================================================
--- trunk/tests/TestHisto2Derase.cc	Tue Dec  6 17:09:01 2011	(r409)
+++ trunk/tests/TestHisto2Derase.cc	Tue Dec  6 17:34:38 2011	(r410)
@@ -15,35 +15,35 @@
 
   /// Let's try to remove the one that surely exists:
   h.eraseBin(0);
-  
-  cout << "Number of bins: " << h.numBinsTotal() << endl;
-  if(h.numBinsTotal() != 9999) {
-   cout << "The bin was not correctly removed, or the computation of numBinsTotal is broken!" << endl;
+
+  cout << "Number of bins: " << h.numBins() << endl;
+  if (h.numBins() != 9999) {
+   cout << "The bin was not correctly removed, or the computation of numBins is broken!" << endl;
    return -1;
   }
 
   int index = h.fill(0,0,1);
   cout << index << endl;
-  if(index != -1) {
+  if (index != -1) {
     cout << "A bin wasn't correctly removed!" << endl;
     return -1;
   }
 
   index = h.fill(1,0,1);
   cout << index << endl;
-  if(index == -1) {
+  if (index == -1) {
     cout << "Something went very wrong during removal!" << endl;
     return -1;
   }
 
-  
+
   /// Now, some timing
   struct timeval startTime;
   struct timeval endTime;
   gettimeofday(&startTime, NULL);
-  for(size_t i = 0; i < 1000; ++i) h.eraseBin(0);
+  for (size_t i = 0; i < 1000; ++i) h.eraseBin(0);
   gettimeofday(&endTime, NULL);
-  cout << "After removing 1k bins there is " << h.numBinsTotal() << " bins left." << endl;
+  cout << "After removing 1k bins there is " << h.numBins() << " bins left." << endl;
 
   double tS = (startTime.tv_sec*1000000 + startTime.tv_usec)/(double)1000000;
   double tE = (endTime.tv_sec*1000000 + endTime.tv_usec)/(double)1000000;


More information about the yoda-svn mailing list