OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
TestHistogram.cpp File Reference

Unit tests for histogram implementation (replacement for gsl_histogram) More...

#include <gtest/gtest.h>
#include <cmath>
#include <vector>
#include "Utilities/GSLHistogram.h"
Include dependency graph for TestHistogram.cpp:

Go to the source code of this file.

Classes

class  HistogramTest
 

Functions

 TEST_F (HistogramTest, UniformRanges)
 
 TEST_F (HistogramTest, IncrementAndGet)
 
 TEST_F (HistogramTest, CustomRanges)
 
 TEST_F (HistogramTest, OutOfRange)
 
 TEST_F (HistogramTest, Histogram2D)
 
 TEST_F (HistogramTest, Histogram2DCustomRanges)
 
 TEST_F (HistogramTest, Histogram2DOutOfRange)
 

Detailed Description

Unit tests for histogram implementation (replacement for gsl_histogram)

This file contains comprehensive unit tests for 1D and 2D histogram implementations. The histograms support uniform and custom bin ranges, increment operations, and value retrieval.

Test:
HistogramTest::UniformRanges Tests creation of histogram with uniform bin ranges. Verifies that bins are correctly allocated and that range boundaries are set correctly for uniform spacing between specified minimum and maximum values.
Test:
HistogramTest::IncrementAndGet Tests incrementing histogram bins and retrieving bin values. Verifies that values are correctly assigned to appropriate bins based on their position within the range, and that bin counts can be retrieved accurately.
Test:
HistogramTest::CustomRanges Tests histogram with custom (non-uniform) bin ranges. Verifies that bins with arbitrary range boundaries work correctly and that values are assigned to the correct bins based on the custom ranges.
Test:
HistogramTest::OutOfRange Tests handling of values outside the histogram range. Verifies that values below the minimum or above the maximum range do not increment any bins and are silently ignored (no exceptions thrown).
Test:
HistogramTest::Histogram2D Tests 2D histogram functionality with uniform ranges. Verifies that 2D histograms can be created, values can be incremented using (x, y) coordinates, and bin values can be retrieved correctly.
Test:
HistogramTest::Histogram2DCustomRanges Tests 2D histogram with custom ranges for both x and y dimensions. Verifies that non-uniform bin boundaries work correctly in both dimensions and that values are assigned to the correct 2D bins.
Test:
HistogramTest::Histogram2DOutOfRange Tests handling of out-of-range values in 2D histograms. Verifies that values outside the x or y ranges (or both) do not increment any bins.

Definition in file TestHistogram.cpp.

Function Documentation

◆ TEST_F() [1/7]

TEST_F ( HistogramTest  ,
CustomRanges   
)

Definition at line 90 of file TestHistogram.cpp.

References gsl_histogram_alloc(), gsl_histogram_free(), gsl_histogram_get(), gsl_histogram_increment(), and gsl_histogram_set_ranges().

Here is the call graph for this function:

◆ TEST_F() [2/7]

TEST_F ( HistogramTest  ,
Histogram2D   
)

◆ TEST_F() [3/7]

TEST_F ( HistogramTest  ,
Histogram2DCustomRanges   
)

Definition at line 138 of file TestHistogram.cpp.

References gsl_histogram2d_alloc(), gsl_histogram2d_free(), gsl_histogram2d_get(), gsl_histogram2d_increment(), and gsl_histogram2d_set_ranges().

Here is the call graph for this function:

◆ TEST_F() [4/7]

TEST_F ( HistogramTest  ,
Histogram2DOutOfRange   
)

◆ TEST_F() [5/7]

TEST_F ( HistogramTest  ,
IncrementAndGet   
)

Definition at line 75 of file TestHistogram.cpp.

References gsl_histogram_alloc(), gsl_histogram_free(), gsl_histogram_get(), gsl_histogram_increment(), and gsl_histogram_set_ranges_uniform().

Here is the call graph for this function:

◆ TEST_F() [6/7]

TEST_F ( HistogramTest  ,
OutOfRange   
)

Definition at line 106 of file TestHistogram.cpp.

References gsl_histogram_alloc(), gsl_histogram_free(), gsl_histogram_get(), gsl_histogram_increment(), and gsl_histogram_set_ranges_uniform().

Here is the call graph for this function:

◆ TEST_F() [7/7]

TEST_F ( HistogramTest  ,
UniformRanges   
)

Definition at line 56 of file TestHistogram.cpp.

References gsl_histogram_alloc(), gsl_histogram_bins(), gsl_histogram_free(), gsl_histogram_get_range(), and gsl_histogram_set_ranges_uniform().

Here is the call graph for this function: