C Activity
Bubble Sort with Unit Tests

A common sorting technique is the bubble sort. The sort works by swapping adjacent elements in an array to put them in ascending order. This is repeated until all elements in the array are in order. This is very simple to implement.

Sorting Example

char myarray[] = "test" ;

swap [0] and [1]: "etst"

swap [1] and [2]: "estt"

Setup

Download  bubble_sort.zip which you will complete to implement the bubble sort. Create a Makefile that will create the unit test version (-o test) and make sure that all of the unit tests pass. However, be sure to implement carefully since we may do additional testing on your submission.

You do not need to run the program itself.

Makefile Creation

Note that you must use an actual tab character as shown below for the lines under the dependency lines. This is shown below as tab in the example below.
Here is an example of a make file from this article on Stack Overflow: Stack Overflow Simple Make

HEADERS = program.h headers.h

default: program

program: program.o
tab gcc -o program -c program.c

program.o: program.c $(HEADERS)
tab gcc -c program.c -o program.o

Compiling and Testing

First create your Makefile. Then run the make by simply typing make:
make

Run the unit tests (all unit tests MUST pass for full credit):
./test

Activity Journal

Fill out an ActivityJournal.txt.

Submission

Place your completed bubble_sort.c, Makefile, and ActivityJournal.txt files in a directory named bubble_sort at the top level of your git repo.