diff --git a/test/Makefile b/test/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..ad47112f4af0f3745be1fd5b9961bc28c0c2cdf9
--- /dev/null
+++ b/test/Makefile
@@ -0,0 +1,21 @@
+# Copyright (c) 2014 Cesanta Software
+# All rights reserved
+
+PROG = unit_test
+PROF_FLAGS = -fprofile-arcs -ftest-coverage -g -O0 -DGUI
+CFLAGS = -W -Wall -I.. $(PROF_FLAGS) $(CFLAGS_EXTRA)
+SOURCES = $(PROG).c
+
+all: $(PROG)
+	./$(PROG)
+	gcov -b $(PROG).c | egrep '^(File|Lines)'
+
+$(PROG): $(SOURCES) Makefile
+	$(CC) -o $(PROG) $(SOURCES) $(CFLAGS) -ldl -lssl
+
+win:
+	wine cl $(SOURCES) /MD /nologo /DNDEBUG /O1 /Fe$(PROG).exe
+	wine $(PROG).exe
+
+clean:
+	rm -rf $(PROG) *.exe *.dSYM *.obj *.exp .*o *.lib *.gc*
diff --git a/examples/unit_test.c b/test/unit_test.c
similarity index 100%
rename from examples/unit_test.c
rename to test/unit_test.c