school/cs235/lab08/test.cpp

32 lines
940 B
C++

#include "sorter.h"
#include "qstest.h"
#include <iostream>
using namespace std;
int main() {
int size = 5;
int temp[] = {5, 3, 7, 2, 8, 2, 4, 1, 6, 5};
sorter s;
s.sortAll(temp, size);
int temp1[] = {5, 3, 7, 2, 5, 2, 4, 1, 6, 8};
cout << "before" << endl;
s.sort(temp1, size, 3, 7);
// int temp3[20] = {4, 7, 3, 8, 12, -2, 41, 63, 2, 5, 53, 24, 64, 75, 132, 74, 24, 64, 745, 21};
int temp3[1] = {5};
// int what1[10] = {5, 5, 5, 5, 1, 5, 5, 5, 5};
// if(test->partition(what, 10, 0, 8) != s.partition(what1, 10, 0, 8)) {
// return false;
// }
cout << temp3[1/2] << " this is the median" << endl;
for(int i = 0; i < 1; i++) {
cout << temp3[i] << " ";
}
cout << "BEFORE" << endl;
cout << s.partition(temp3, 1, 0, 0) << " this is the return value" << endl;
for(int i = 0; i < 1; i++) {
cout << temp3[i] << " ";
}
cout << "AFTER" << endl;
}