Skip to content

Commit

Permalink
Added tests in test_mov_histogram.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
spran180 committed Jul 31, 2024
1 parent 7de292f commit 3e00713
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/tests/roc_core/test_mov_histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,22 +157,26 @@ TEST(movhistogram, win_length_equal_one) {
LONGS_EQUAL(1, hist.get_bin_counter(2));
}

TEST(movhistogram, multiple_value_bin) {
TEST(movhistogram, multiple_values_in_bins) {
const size_t value_range_min = 0;
const size_t value_range_max = 100;
const size_t num_bins = 10;
const size_t win_length = 10;
const size_t win_length = 50;

MovHistogram<size_t> hist(arena, value_range_min, value_range_max, num_bins,
win_length);
MovHistogram<size_t> hist(arena, value_range_min, value_range_max, num_bins, win_length);
CHECK(hist.is_valid());

for (size_t i = 0; i < win_length * 2; i++) {
hist.add_value(i);
const size_t values_per_bin = 5;
const size_t total_values = num_bins * values_per_bin;

for (size_t i = 0; i < total_values; ++i) {
size_t value = (i / values_per_bin) * (value_range_max / num_bins);
hist.add_value(value);
}

LONGS_EQUAL(10, hist.get_bin_counter(0));
LONGS_EQUAL(10, hist.get_bin_counter(1));
for (size_t i = 0; i < num_bins; ++i) {
LONGS_EQUAL(values_per_bin, hist.get_bin_counter(i));
}
}

TEST(movhistogram, rolling_window_bin_changes) {
Expand Down

0 comments on commit 3e00713

Please sign in to comment.