diff --git a/histogram.cpp b/histogram.cpp index 0c26cb0..4c759c6 100644 --- a/histogram.cpp +++ b/histogram.cpp @@ -3,7 +3,7 @@ #include using namespace std; -static void +void find_minmax(const vector& numbers, double& min, double& max) { min = numbers[0]; max = numbers[0]; diff --git a/unittest.cpp b/unittest.cpp index e69de29..bef0c61 100644 --- a/unittest.cpp +++ b/unittest.cpp @@ -0,0 +1,12 @@ +#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); +} \ No newline at end of file diff --git a/unittest.vcxproj b/unittest.vcxproj index 87a1473..39a3bd1 100644 --- a/unittest.vcxproj +++ b/unittest.vcxproj @@ -17,7 +17,6 @@ Release x64 - 17.0 @@ -53,27 +52,24 @@ true Unicode - - + + + + + + + + + + + + + - - - - - - - - - - - - - - Level3 @@ -130,9 +126,15 @@ true - - + + + + + + + + - + \ No newline at end of file