Building and Executing

Below is a makefile for automated build of counter.c tests. The full example can be found in /examples folder.

 

CC = gcc
CFLAGS = -O
INCLUDES = ..
LIBS = ../lib
RM = rm
TARGET = samples
OBJS = AllTests.o counter.o counterTest.o 

all: $(TARGET)

$(TARGET): $(OBJS)
	$(CC) -o $@ $(OBJS) -L$(LIBS) -lembUnit

.c.o:
	$(CC) $(CFLAGS) -I$(INCLUDES) -c $<

clean:
	-$(RM) $(TARGET) $(OBJS)

.PHONY: clean all    
     
       

Build your tests with make. Execute the created executable to run the tests. The standard test runner gives you the results in following format (results are not from earlier example):

 
....
shutterTest.testBuffer (shuttertest.c 168) exp 0 was 1

run 4 failures 1