Родитель
							
								
									d6cb622ca3
								
							
						
					
					
						Сommit
						8a7bc8db46
					
				@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 | 
				
			||||||
 | 
					<CodeBlocks_layout_file>
 | 
				
			||||||
 | 
						<FileVersion major="1" minor="0" />
 | 
				
			||||||
 | 
						<ActiveTarget name="Debug" />
 | 
				
			||||||
 | 
						<File name="svg.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
				
			||||||
 | 
							<Cursor>
 | 
				
			||||||
 | 
								<Cursor1 position="0" topLine="0" />
 | 
				
			||||||
 | 
							</Cursor>
 | 
				
			||||||
 | 
						</File>
 | 
				
			||||||
 | 
						<File name="svg.cpp" open="1" top="1" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
				
			||||||
 | 
							<Cursor>
 | 
				
			||||||
 | 
								<Cursor1 position="1598" topLine="38" />
 | 
				
			||||||
 | 
							</Cursor>
 | 
				
			||||||
 | 
						</File>
 | 
				
			||||||
 | 
						<File name="main.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
				
			||||||
 | 
							<Cursor>
 | 
				
			||||||
 | 
								<Cursor1 position="564" topLine="9" />
 | 
				
			||||||
 | 
							</Cursor>
 | 
				
			||||||
 | 
						</File>
 | 
				
			||||||
 | 
						<File name="histogram.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
				
			||||||
 | 
							<Cursor>
 | 
				
			||||||
 | 
								<Cursor1 position="0" topLine="0" />
 | 
				
			||||||
 | 
							</Cursor>
 | 
				
			||||||
 | 
						</File>
 | 
				
			||||||
 | 
						<File name="histogram.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
				
			||||||
 | 
							<Cursor>
 | 
				
			||||||
 | 
								<Cursor1 position="559" topLine="11" />
 | 
				
			||||||
 | 
							</Cursor>
 | 
				
			||||||
 | 
						</File>
 | 
				
			||||||
 | 
						<File name=".gitignore" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
				
			||||||
 | 
							<Cursor>
 | 
				
			||||||
 | 
								<Cursor1 position="34" topLine="0" />
 | 
				
			||||||
 | 
							</Cursor>
 | 
				
			||||||
 | 
						</File>
 | 
				
			||||||
 | 
					</CodeBlocks_layout_file>
 | 
				
			||||||
@ -1,36 +0,0 @@
 | 
				
			|||||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
 | 
					 | 
				
			||||||
#include "doctest.h"
 | 
					 | 
				
			||||||
#include "histogram_internal.h"
 | 
					 | 
				
			||||||
#include <vector>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
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);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
 | 
				
			||||||
 | 
					<CodeBlocks_layout_file>
 | 
				
			||||||
 | 
						<FileVersion major="1" minor="0" />
 | 
				
			||||||
 | 
						<ActiveTarget name="Debug" />
 | 
				
			||||||
 | 
						<File name="unittest.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
 | 
				
			||||||
 | 
							<Cursor>
 | 
				
			||||||
 | 
								<Cursor1 position="310" topLine="0" />
 | 
				
			||||||
 | 
							</Cursor>
 | 
				
			||||||
 | 
						</File>
 | 
				
			||||||
 | 
					</CodeBlocks_layout_file>
 | 
				
			||||||
					Загрузка…
					
					
				
		Ссылка в новой задаче