#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <boost/chrono.hpp>

#include "sort_algorithms.hpp"
#include "row.hpp"

void fill_random(double* arr, int n)
{
	for (int i=0; i<n; i++)
		arr[i] = ((double)rand()/RAND_MAX) * 20000.0 - 10000.0
}

bool is_sorted(row<double>& r)
{
	for (uint32_t i=1; i<r.size();i++)
		if (r[i]<r[i-1]) return false;
	return true;
}

template<typename SortFn>
long long time_sort(double* src, int n, SortFn fn, bool& correct)
{
	row<double>* a = new row<double>(src, n);

	boost::chrono::high_resolution_clock::time_point start =
	boost::chrono::high_resolution_clock::now();

	fn(*a);

	boost::chrono::high_resolution_clock::time_point stop =
	boost::chrono::high_resolution_clock::now();

	correct = is_sorted(*a);
	delete a;

	return std::chrono::duration_cast<boost::chrono::microseconds>(stop-start).count();
}


int main()
{
	srand(42);

	const int sizes[2] = {1000, 10000};

	struct Entry {
		std::string name;
		int        n;
		long long  us;
		bool       ok;
	}

	Entry results[12];
	int idx = 0;

	for (int si=0; si<2; si++)
	{
		int n = sizes[si];
		double* src = new double[n];
		fill_random(src, n);

			auto run = [&](const std::string& name, auto fn) {
			
	}

	return 0;
}


