Unit tests for PointIsolationAlg. More...
#include "larexamples/Algorithms/RemoveIsolatedSpacePoints/PointIsolationAlg.h"
#include "cetlib/pow.h"
#include "boost/test/unit_test.hpp"
#include <array>
#include <algorithm>
#include <numeric>
Go to the source code of this file.
Macros | |
#define | BOOST_TEST_MODULE ( PointIsolationAlg_test ) |
Functions | |
void | PointIsolationTest1 () |
Low-multiplicity unit test. More... | |
template<typename T > | |
auto | CreateStarOfPoints (unsigned int nShells, T distance=T(1)) -> decltype(auto) |
Creates a "star" disposition of points. More... | |
void | PointIsolationTest2 (unsigned int levels) |
Tests various isolation radii on a star-distributed set of points. More... | |
BOOST_AUTO_TEST_CASE (PointIsolationAlgTest) | |
BOOST_AUTO_TEST_CASE (PointIsolationAlgVerificationTest) | |
Unit tests for PointIsolationAlg.
This test sets up point distributions with known isolation features, runs the algorithm with various isolation radius settings and verifies that the results are as expected.
The test is run with no arguments.
Two tests are run:
PointIsolationTest1
: low multiplicity unit testsPointIsolationTest2
: larger scale testSee the documentation of the two functions for more information.
Definition in file PointIsolationAlg_test.cc.
#define BOOST_TEST_MODULE ( PointIsolationAlg_test ) |
Definition at line 29 of file PointIsolationAlg_test.cc.
BOOST_AUTO_TEST_CASE | ( | PointIsolationAlgTest | ) |
Definition at line 255 of file PointIsolationAlg_test.cc.
BOOST_AUTO_TEST_CASE | ( | PointIsolationAlgVerificationTest | ) |
Definition at line 260 of file PointIsolationAlg_test.cc.
auto CreateStarOfPoints | ( | unsigned int | nShells, |
T | distance = T(1) |
||
) | -> decltype(auto) |
Creates a "star" disposition of points.
T | type of coordinate being used |
nShells | number of points on each ray of the star (origin excluded) |
distance | distance from the origin of the farthest point |
std::array<T, 3>
Points are aligned on a semi-axis, sparser and sparser as they go away from origin. nShell is the number of points beside the origin on each semi-axis. Origin is always included. A sequence is generated for each of the semi-axes (x, y, and z, two directions each). Example for nShells = 5
, showing only one axis (that is, two semi-axes):
(points are marked with o
, with O
being the origin)
The order of the points in the set is:
Definition at line 135 of file PointIsolationAlg_test.cc.
void PointIsolationTest1 | ( | ) |
Low-multiplicity unit test.
This tests exercises simple point dispositions: a single point, two points, three points at different distance, and two "pairs" of points. The isolation radius of the test is fixed.
This test uses coordinate type float
.
Definition at line 54 of file PointIsolationAlg_test.cc.
void PointIsolationTest2 | ( | unsigned int | levels | ) |
Tests various isolation radii on a star-distributed set of points.
levels | number of shells in the star (0 is only its centre) |
The test uses a star-distributed set of points, as produced by CreateStarOfPoints()
. This distribution has the characteristic that all the points farther than the isolation radius from the origin are indeed isolated. This makes the prediction of the number of isolated points easier.
This test uses coordinate type double
.
Definition at line 177 of file PointIsolationAlg_test.cc.