Subversion Repositories PlanixRsrch.SVN

Compare Revisions

Ignore whitespace Rev 177 → Rev 178

/tags/libmutests-1.1.0/example1.c
File deleted
/tags/libmutests-1.1.0/Makefile
File deleted
/tags/libmutests-1.1.0/LICENSE
File deleted
/tags/libmutests-1.1.0/mutests_run.c
File deleted
/tags/libmutests-1.1.0/mutests.h
File deleted
/tags/libmutests-1.1.0
Property changes:
Deleted: svn:mergeinfo
## -0,1 +0,0 ##
Reverse-merged /branches/bnf/libmutests:r79-129
Index: libmutests/1.1.0/LICENSE
===================================================================
--- libmutests/1.1.0/LICENSE (nonexistent)
+++ libmutests/1.1.0/LICENSE (revision 178)
@@ -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.1.0/Makefile
===================================================================
--- libmutests/1.1.0/Makefile (nonexistent)
+++ libmutests/1.1.0/Makefile (revision 178)
@@ -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.1.0/example1.c
===================================================================
--- libmutests/1.1.0/example1.c (nonexistent)
+++ libmutests/1.1.0/example1.c (revision 178)
@@ -0,0 +1,31 @@
+ /* file minunit_example.c */
+
+#include <stdio.h>
+#include "mutests.h"
+
+
+int foo = 7;
+int bar = 15;
+
+static int test_foo() {
+ mu_assert(foo == 7, "error, foo != 7");
+ return 1;
+}
+
+static int test_bar() {
+ mu_assert(bar == 5, "error, bar != 5" );
+ return 1;
+}
+
+
+int main() {
+ mutests tests = {
+ test_foo,
+ test_bar,
+ NULL
+ };
+ return mutests_run(tests);
+ }
+
+
+
Index: libmutests/1.1.0/mutests.h
===================================================================
--- libmutests/1.1.0/mutests.h (nonexistent)
+++ libmutests/1.1.0/mutests.h (revision 178)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2019 2020, 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.
+ */
+
+/* mutests.h
+ * based loosely on
+ * http://www.jera.com/techinfo/jtns/jtn002.html#Source_Code
+ */
+#ifndef _MUTESTS_H
+#define _MUTESTS_H
+
+int mutests_run( int (*tflist[])() );
+typedef int(*mutests[])();
+
+void mu_assert(int test, const char *, ...);
+
+#endif
Index: libmutests/1.1.0/mutests_run.c
===================================================================
--- libmutests/1.1.0/mutests_run.c (nonexistent)
+++ libmutests/1.1.0/mutests_run.c (revision 178)
@@ -0,0 +1,70 @@
+/*
+ * 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 <setjmp.h>
+#include <stdarg.h>
+
+#include "mutests.h"
+
+static jmp_buf mubuf;
+
+void mu_assert(int test, const char * msg, ...)
+{
+ va_list vl;
+
+ if (test)
+ return;
+
+ va_start(vl,msg);
+ (void)fprintf(stderr,"FAIL: ");
+ (void)vfprintf(stderr,msg,vl);
+ (void)fprintf(stderr,"\n");
+ va_end(vl);
+ longjmp(mubuf,1);
+}
+
+int mutests_run( int (*tflist[])() )
+{
+ int i,failed;
+
+ failed = 0;
+ for (i=0; tflist[i]!=NULL; i++){
+ if (setjmp(mubuf) ){
+ failed ++;
+ }
+ else{
+ if (!tflist[i]()){
+ failed ++;
+ };
+ }
+ }
+ if (!failed)
+ (void)printf("ALL %d TESTS PASSED\n",i);
+ return failed;
+}
+
Index: libmutests/1.1.0
===================================================================
--- libmutests/1.1.0 (nonexistent)
+++ libmutests/1.1.0 (revision 178)
/libmutests/1.1.0
Property changes:
Added: svn:mergeinfo
## -0,0 +0,1 ##
Merged /branches/bnf/libmutests:r79-129