#ifndef TESTALGORITHMS_HPP
#define TESTALGORITHMS_HPP

#include <iostream>
#include "Task.hpp"
#include "sort_algorithms.hpp"
#include "row.hpp"

class TestAlgorithms : public Task {
	private:
		int* tensor;
		int n;
		int k;
		int algo_choice;
	public:
		TestAlgorithms(int* t, int size_n, int size_k, int choice):
		tensor(t) , n(size_n) ,k(size_k), algo_choice(choice) {}

		void execute_task(int worker_id, int worker_count) {
			for(int slice=0; slice<k; slice++) {
				if(slice%worker_count == worker_id%worker_count) {

					int* slice_start = tensor + (slice*n*n);

					for(int r=0; r<n; r++){
						int* row_start=slice_start + (r*n);

						row<int> current_row(row_start,n);

						switch(algo_choice) {	
							case 0: break;
							case 1:quick_sort(current_row);break;
							case 2:bubble_sort(current_row);break;
							case 3:merge_sort(current_row);break;
							case 4:selection_sort(current_row);break;
							case 5:insertion_sort(current_row);break;
							case 6:enumeration_sort(current_row);break;
						}
					}
				}
			}
		}
				
};

#endif
