Okay, so I'm not asking you to do my homework for me, I just need help. It has to do with TDD in C. I was always taught that you need to write the tests first and then write the code. However, my professor gave us the code and told us to write the tests. I'm at a loss, I have no idea where to even start. This portion of the assignment is worth such a small portion of the grade but I can't move on with getting it to "go green" in TDD terms. I asked my professor for help and she basically laughed and told me she doesn't have time to explain. I'm seriously so lost and any help what so ever would be greatly appreciated. The written code that I need to write tests for is a simple swap method and a bubblesort method.

Code:

/**
* swaps the values referenced by p and q
*/
void swap (int *p, int *q)
{
int tmp;
tmp = *p;
*p = *q;
*q = tmp;
}
/**
* an implementation of bubble sort
* n is the size of array a
*/
void bubble (int a[], int n)
{
int i, j;
for (i = 0; i<n-1; i++)
{
for (j = n-1; i < j; j--)
{
if (a[j-1] > a[j])
{
swap (&a[j-1], &a[j]);
}
}
}
}

Any help at all is very much appreciated! Thank you in advance!