many updates in report code and in storage structure, this commit is broken
diff --git a/tests/test_math.py b/tests/test_math.py
new file mode 100644
index 0000000..5a75858
--- /dev/null
+++ b/tests/test_math.py
@@ -0,0 +1,32 @@
+import numpy
+from wally.statistic import rebin_histogram
+
+
+def array_eq(x: numpy.array, y: numpy.array, max_diff: float = 1E-3) -> bool:
+ return numpy.abs(x - y).max() <= max_diff
+
+
+def test_rebin_histo():
+ curr_histo = numpy.empty((100,), dtype=int)
+ curr_histo[:] = 1
+ edges = numpy.arange(100)
+ new_histo, new_edges = rebin_histogram(curr_histo, edges, 10)
+
+ assert new_edges.shape == (10,)
+ assert new_histo.shape == (10,)
+ assert new_edges.dtype.name.startswith('float')
+ assert new_histo.dtype.name.startswith('int')
+
+ assert array_eq(new_edges, numpy.arange(10) * 9.9)
+ assert new_histo.sum() == curr_histo.sum()
+ assert list(new_histo) == [10] * 10
+
+ new_histo, new_edges = rebin_histogram(curr_histo, edges, 3,
+ left_tail_idx=20,
+ right_tail_idx=50)
+
+ assert new_edges.shape == (3,)
+ assert new_histo.shape == (3,)
+ assert array_eq(new_edges, numpy.array([20, 30, 40]))
+ assert new_histo.sum() == curr_histo.sum()
+ assert list(new_histo) == [30, 10, 60]