//Test program for use with Question 1 of ADS practical test Jan/Feb 2018
//SOAC, FACE UWTSD
//Tutor: G Dickers

// define sizes of arrays
#define SIZE1 5000
#define SIZE2 10000
#define SIZE3 15000
#define SIZE4 20000
#define SIZE5 40000

//declare arrays
int testArray1[SIZE1];
int testArray2[SIZE2];
int testArray3[SIZE3];
int testArray4[SIZE4];
int testArray5[SIZE5];

//prototype functions. Functions to test
void aFunc1(int*, int);
void aFunc2(int*, int);
void aFunc3(int*, int);


void initArrays(void); //thids function initialises arrays to zeros


int main(void)
//Test harness
{
	aFunc1(testArray2, SIZE2);
	aFunc2(testArray2, SIZE2);
	aFunc3(testArray2, SIZE2);


	return 0;
}

void initArrays(void)
{
	//Initialize all arrays' contents to zero
	for (int j = 0; j < SIZE1; j++)
		testArray1[j] = 0;
	for (int j = 0; j < SIZE2; j++)
		testArray2[j] = 0;
	for (int j = 0; j < SIZE3; j++)
		testArray3[j] = 0;
	for (int j = 0; j < SIZE4; j++)
		testArray4[j] = 0;
	for (int j = 0; j < SIZE5; j++)
		testArray5[j] = 0;
}

void aFunc3(int* a, int n)
//for use with Q1
{
	int b, c, d, e, f;
	for (int i = 0; i < n; i++)
	{
		for (int k = 0; k < n; k++)
		{


			a[i] = (i + 4) % n;
			for (int j = 0; j < 12; j++)
				b = c = d = e = f = j;
		}
	}
}

void aFunc1(int* a, int n)
//for use with Q1
{
	int b, c, d, e, f;
	for (int i = 0; i < n; i++)
	{
		a[i] = (i + 4) % n;
		for (int j = 0; j < 1200; j++)
			b = c = d = e = f = j;
	}
}


void aFunc2(int* a, int n)
//for use with Q1
{
	for (int j = 0; j<SIZE1; j++)
		for (int i = 0; i<SIZE1; i++)
			a[i] = a[i] + i + j + 17;
}



