29 lines
635 B
C++
29 lines
635 B
C++
// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
#include <catch2/catch_all.hpp>
|
|
#include "../common/TopPixels.h"
|
|
|
|
TEST_CASE("TopPixels") {
|
|
TopPixels tp(5);
|
|
|
|
REQUIRE(tp.Empty());
|
|
REQUIRE(tp.Size() == 0);
|
|
|
|
for (int i = 50; i > 0; i--)
|
|
tp.Add(i*2, i);
|
|
|
|
tp.Add(500,245);
|
|
tp.Add(0,1221);
|
|
|
|
REQUIRE(tp.Size() == 5);
|
|
|
|
CHECK(tp[0].index == 245);
|
|
CHECK(tp[0].value == 500);
|
|
for (int i = 1; i < 4; i++) {
|
|
CHECK(tp[i].index == (50 - i + 1));
|
|
CHECK(tp[i].value == (50 - i + 1) * 2);
|
|
}
|
|
}
|
|
|