Subversion Repositories PlanixRsrch.SVN

Compare Revisions

Ignore whitespace Rev 176 → Rev 177

/tags/libmutests-1.0.0/LICENSE
File deleted
/tags/libmutests-1.0.0/mutests_run.c
File deleted
/tags/libmutests-1.0.0/mutests.h
File deleted
/tags/libmutests-1.0.0/example1.c
File deleted
/tags/libmutests-1.0.0/Makefile
File deleted
/tags/libmutests-1.0.0
Property changes:
Deleted: svn:mergeinfo
## -0,1 +0,0 ##
Reverse-merged /branches/bnf/libmutests:r79-129
Index: libmutests/1.0.0/LICENSE
===================================================================
--- libmutests/1.0.0/LICENSE (nonexistent)
+++ libmutests/1.0.0/LICENSE (revision 177)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2019, The PLANIX Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
Index: libmutests/1.0.0/Makefile
===================================================================
--- libmutests/1.0.0/Makefile (nonexistent)
+++ libmutests/1.0.0/Makefile (revision 177)
@@ -0,0 +1,30 @@
+
+OBJS=mutests_run.o
+
+LIBNAME=libmutests.a
+
+PREFIX=~
+
+.c.o:
+ $(CC) -c $(CFLAGS) $<
+
+$(LIBNAME): $(OBJS)
+ $(AR) rcs $(LIBNAME) $(OBJS)
+
+example1: $(LIBNAME) example1.o
+ $(CC) -o example1 example1.o $(LIBNAME)
+
+
+clean:
+ rm -f $(OBJS)
+ rm -f $(LIBNAME)
+ rm -f example1.o example1
+ rm -f example2.o example2
+ rm -f *.core
+
+install: $(LIBNAME)
+ mkdir -p $(PREFIX)/lib
+ mkdir -p $(PREFIX)/include/
+ $(INSTALL) -p $(LIBNAME) $(PREFIX)/lib/$(LIBNAME)
+ $(INSTALL) -p mutests.h $(PREFIX)/include/mutests.h
+
Index: libmutests/1.0.0/example1.c
===================================================================
--- libmutests/1.0.0/example1.c (nonexistent)
+++ libmutests/1.0.0/example1.c (revision 177)
@@ -0,0 +1,38 @@
+ /* file minunit_example.c */
+
+#include <stdio.h>
+#include "mutests.h"
+
+
+ int foo = 7;
+ int bar = 5;
+
+ static char * test_foo() {
+ mu_assert("error, foo != 7", foo == 7);
+ return 0;
+ }
+
+ static char * test_bar() {
+ mu_assert("error, bar != 5", bar == 5);
+ return 0;
+ }
+
+/*
+ static char * all_tests() {
+ mu_run_test(test_foo);
+ mu_run_test(test_bar);
+ return 0;
+ }
+ */
+
+ int main() {
+ char *(*tests[])() = {
+ test_foo,
+ test_bar,
+ NULL
+ };
+ return mutests_run(tests);
+ }
+
+
+
Index: libmutests/1.0.0/mutests.h
===================================================================
--- libmutests/1.0.0/mutests.h (nonexistent)
+++ libmutests/1.0.0/mutests.h (revision 177)
@@ -0,0 +1,13 @@
+/* mutests.h
+ * based loosely on
+ * http://www.jera.com/techinfo/jtns/jtn002.html#Source_Code
+ */
+#ifndef _MUTESTS_H
+#define _MUTESTS_H
+
+#define mu_assert(message, test) do { if (!(test)) return message; } while (0)
+/*#define mu_run_test(test) do { char *message = test(); tests_run++; \
+ if (message) return message; } while (0)
+*/
+int mutests_run( char *(*tflist[])() );
+#endif
Index: libmutests/1.0.0/mutests_run.c
===================================================================
--- libmutests/1.0.0/mutests_run.c (nonexistent)
+++ libmutests/1.0.0/mutests_run.c (revision 177)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2019, The PLANIX Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include "mutests.h"
+
+int mutests_run( char *(*tflist[])() )
+{
+ int i,failed;
+ char * result;
+
+ failed = 0;
+ for (i=0; tflist[i]!=NULL; i++){
+ result = tflist[i]();
+ if (result){
+ (void)printf("FAIL: %s\n",result);
+ failed ++;
+ }
+ }
+ if (!failed)
+ (void)printf("ALL %d TESTS PASSED\n",i);
+ return failed;
+}
+
Index: libmutests/1.0.0
===================================================================
--- libmutests/1.0.0 (nonexistent)
+++ libmutests/1.0.0 (revision 177)
/libmutests/1.0.0
Property changes:
Added: svn:mergeinfo
## -0,0 +0,1 ##
Merged /branches/bnf/libmutests:r79-129