[yoda-svn] r344 - in trunk/tests: . Histo1D

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Aug 24 12:03:23 BST 2011


Author: mkawalec
Date: Wed Aug 24 12:03:23 2011
New Revision: 344

Log:
Added some rudimentary bin modification checking.

Added:
   trunk/tests/Histo1D/Modify.cc
Modified:
   trunk/tests/Makefile.am

Added: trunk/tests/Histo1D/Modify.cc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/tests/Histo1D/Modify.cc	Wed Aug 24 12:03:23 2011	(r344)
@@ -0,0 +1,30 @@
+#include "YODA/Histo1D.h"
+
+#include <iostream>
+using namespace std;
+using namespace YODA;
+
+int main() {
+  
+  Histo1D h(100, 0, 100);
+  cout << "Trying to merge bins:                    ";
+  h.mergeBins(0, 10);
+  cout << "PASS" << endl;
+
+  cout << "Testing if bin nuber was updated:        ";
+  if(h.numBins() != 90) {
+    cout << "FAIL" << endl;
+    return -1;
+  }
+  cout << "PASS" << endl;
+  
+  cout << "Checking if bin size was updated:        ";
+  if(!fuzzyEquals(h.bin(0).xMin(), 0) || !fuzzyEquals(h.bin(0).xMax(),11)){
+    cout << "FAIL" << endl;
+    return -1;
+  }
+  cout << "PASS" << endl;
+
+
+  return EXIT_SUCCESS;
+}

Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am	Wed Aug 24 11:45:32 2011	(r343)
+++ trunk/tests/Makefile.am	Wed Aug 24 12:03:23 2011	(r344)
@@ -9,7 +9,8 @@
   testscatter3D\
   testindexedset testsortedvector\
   testhisto1Dconstructor \
-  testhisto1Dfill
+  testhisto1Dfill\
+  testhisto1Dmodify
 
 AM_CPPFLAGS = -I$(top_srcdir)/include
 AM_LDFLAGS = -L$(top_builddir)/src -lYODA
@@ -27,6 +28,7 @@
 testscatter3D_SOURCES = TestScatter3D.cc
 testhisto1Dconstructor_SOURCES = Histo1D/Constructors.cc
 testhisto1Dfill_SOURCES = Histo1D/Fill.cc
+testhisto1Dmodify_SOURCES = Histo1D/Modify.cc
 
 # TODO: Search paths are still not complete for the Python tests: need to add the lib.linux-i686-2.7 part to PYTHONPATH
 TESTS_ENVIRONMENT = \
@@ -46,4 +48,5 @@
   testindexedset testsortedvector \
   testhisto1Dconstructor \
   testhisto1Dfill \
+  testhisto1Dmodify \
   test-yoda-1.py test-yoda-2.py


More information about the yoda-svn mailing list