Index: tests/Makefile
===================================================================
--- tests/Makefile	(revision 3893)
+++ tests/Makefile	(revision 4523)
@@ -7,4 +7,5 @@
 	echo Warning: There is nothing to build
 clean: sandbox-clean
+	rm -f *.o rat-*
 
 new: clean all
@@ -13,5 +14,5 @@
 test: sandbox-clean sandbox-install test-all sandbox-clean
 
-test-all: test-runnable test-roard
+test-all: test-runnable test-roard test-rat
 
 test-runnable:
@@ -19,5 +20,12 @@
 test-roard:
 	PREFIX_BIN=$(PREFIX_BIN) PREFIX_LIB=$(PREFIX_LIB) EXEC_HELPER=$(EXEC_HELPER) ./test-roard.sh
-sandbox-install:
+
+test-rat: rat.o test-rat.o
+	$(CC) -Wall -Wextra -O2 -g -o rat-rat rat.o test-rat.o
+	./rat-rat
+
+
+sandbox-install: sandbox
+sandbox:
 	mkdir sandbox
 	sh -c 'cd ..; DESTDIR=`pwd`/tests/sandbox $(MAKE) install'
Index: tests/rat.c
===================================================================
--- tests/rat.c	(revision 4523)
+++ tests/rat.c	(revision 4523)
@@ -0,0 +1,124 @@
+//rat.c:
+
+/*
+ *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010
+ *
+ *  This file is part of rat a part of RoarAudio,
+ *  a cross-platform sound system for both, home and professional use.
+ *  See README for details.
+ *
+ *  This file is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 3
+ *  as published by the Free Software Foundation.
+ *
+ *  libroar is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this software; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ *
+ *  NOTE for everyone want's to change something and send patches:
+ *  read README and HACKING! There a addition information on
+ *  the license of this document you need to read before you send
+ *  any patches.
+ *
+ */
+
+#include "rat.h"
+#include <string.h>
+
+struct rat_testgroup {
+ unsigned int ok, fail;
+};
+
+struct rat_tests {
+ struct rat_testgroup all, subtests, cur_subtests;
+ unsigned int testsc, subtestsc;
+};
+
+static struct rat_tests inst;
+
+void rat_init(const char * name, const char * desc) {
+ memset(&inst, 0, sizeof(inst));
+
+ printf("---[ %s ]---\n", name);
+ printf("Description: %s\n", desc);
+ printf("\n");
+}
+
+int  rat_fin(void) {
+
+ printf("\n");
+ printf("Summery:\n");
+ printf("%u of %u tests ok, %u tests failed.\n", inst.all.ok, inst.testsc, inst.all.fail);
+
+ return inst.all.fail;
+}
+
+void rat_test(const char * title, int res) {
+ printf("Test %-32s: %s\n", title, res ? "ok" : "failed");
+
+ inst.testsc++;
+
+ if ( res ) {
+  inst.all.ok++;
+ } else {
+  inst.all.fail++;
+ }
+}
+
+void rat_test_zero(const char * title, int res) {
+ rat_test(title, res == 0);
+}
+
+void rat_test_with_subtests(const char * title) {
+ memset(&(inst.cur_subtests), 0, sizeof(inst.cur_subtests));
+ printf("Test %-32s: ", title);
+ fflush(stdout);
+}
+
+void rat_subtests_fin(void) {
+ printf("   %u ok, %u failed.\n", inst.cur_subtests.ok, inst.cur_subtests.fail);
+ inst.subtests.ok   += inst.cur_subtests.ok;
+ inst.subtests.fail += inst.cur_subtests.fail;
+
+ inst.testsc++;
+
+ if ( inst.cur_subtests.fail ) {
+  inst.all.fail++;
+ } else {
+  inst.all.ok++;
+ }
+}
+
+void rat_subtest(int res) {
+ inst.subtestsc++;
+
+ if ( res ) {
+  printf(".");
+  inst.cur_subtests.ok++;
+ } else {
+  printf("e");
+  inst.cur_subtests.fail++;
+ }
+ fflush(stdout);
+}
+
+void rat_subtest_crit(int res) {
+ inst.subtestsc++;
+
+ if ( res ) {
+  printf(".");
+  inst.cur_subtests.ok++;
+ } else {
+  printf("E");
+  inst.cur_subtests.fail++;
+ }
+ fflush(stdout);
+}
+
+//ll
Index: tests/rat.h
===================================================================
--- tests/rat.h	(revision 4523)
+++ tests/rat.h	(revision 4523)
@@ -0,0 +1,51 @@
+//rat.h:
+
+/*
+ *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010
+ *
+ *  This file is part of rat a part of RoarAudio,
+ *  a cross-platform sound system for both, home and professional use.
+ *  See README for details.
+ *
+ *  This file is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 3
+ *  as published by the Free Software Foundation.
+ *
+ *  libroar is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this software; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ *
+ *  NOTE for everyone want's to change something and send patches:
+ *  read README and HACKING! There a addition information on
+ *  the license of this document you need to read before you send
+ *  any patches.
+ *
+ */
+
+#ifndef _RAT_H_
+#define _RAT_H_
+
+#include <stdio.h>
+
+void rat_init(const char * name, const char * desc);
+int  rat_fin(void);
+
+void rat_test(const char * title, int res);
+void rat_test_zero(const char * title, int res);
+void rat_test_with_output(const char * title, int res);
+
+void rat_test_with_subtests(const char * title);
+void rat_subtests_fin(void);
+
+void rat_subtest(int res);
+void rat_subtest_crit(int res);
+
+#endif
+
+//ll
Index: tests/test-rat.c
===================================================================
--- tests/test-rat.c	(revision 4523)
+++ tests/test-rat.c	(revision 4523)
@@ -0,0 +1,26 @@
+#include "rat.h"
+int main (void) {
+ int ret;
+
+ rat_init("RAT", "testing RAT itself before any other tests, stage 0");
+
+ rat_test("Dummy test with const, ok", 1);
+ rat_test("Dummy test with const, fail", 0);
+
+ rat_test_with_subtests("Subtests");
+
+ rat_subtest(1);
+ rat_subtest(0);
+ rat_subtest_crit(1);
+ rat_subtest_crit(0);
+
+ rat_subtests_fin();
+
+ ret = rat_fin();
+
+ rat_init("RAT", "testing RAT itself before any other tests, stage 1");
+
+ rat_test("Return value of stage 0", ret == 2);
+
+ return rat_fin();
+}
