#define DOCTEST_CONFIG_NO_MULTITHREADING
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest.h"
#include "histogram_internal.h"

TEST_CASE("distinct positive numbers") {
    double min = 0;
    double max = 0;
    find_minmax({1, 2}, min, max);
    CHECK(min == 1);
    CHECK(max == 2);
}

TEST_CASE("find_minmax with one element") {
    std::vector<double> numbers{42};
    double min, max;
    find_minmax(numbers, min, max);
    CHECK(min == 42);
    CHECK(max == 42);
}

TEST_CASE("find_minmax with negative values") {
    std::vector<double> numbers{-10.5, -2.3, -3.3};
    double min, max;
    find_minmax(numbers, min, max);
    CHECK(min == -10.5);
    CHECK(max == -2.3);
}

TEST_CASE("find_minmax with identical elements") {
    std::vector<double> numbers{7, 7, 7, 7};
    double min, max;
    find_minmax(numbers, min, max);
    CHECK(min == 7);
    CHECK(max == 7);
}
