#define RUN_TESTS
#include <iostream>
#include <vector>
#include <cassert>
#include "histogram_internal.h"
using namespace std;

void test_find_minmax() {
    cout << "Testing find_minmax..." << endl;

    // Test 1: distinct positive numbers
    double min = 0, max = 0;
    find_minmax({1, 2}, min, max);
    assert(min == 1);
    assert(max == 2);
    cout << "Test 1 passed" << endl;

    // Test 2: single element
    min = 0; max = 0;
    find_minmax({5}, min, max);
    assert(min == 5);
    assert(max == 5);
    cout << "Test 2 passed" << endl;

    // Test 3: negative numbers
    min = 0; max = 0;
    find_minmax({-1, -2, -3}, min, max);
    assert(min == -3);
    assert(max == -1);
    cout << "Test 3 passed" << endl;

    // Test 4: identical numbers
    min = 0; max = 0;
    find_minmax({4, 4, 4}, min, max);
    assert(min == 4);
    assert(max == 4);
    cout << "Test 4 passed" << endl;

    // Test 5: empty vector
    min = 0; max = 0;
    find_minmax({}, min, max);
    cout << "Test 5 passed (should not crash)" << endl;

    cout << "All tests passed!" << endl;
}

int main() {
    test_find_minmax();
    return 0;
}
