siu / minunit Goto Github PK
View Code? Open in Web Editor NEWMinimal unit testing framework for C
License: MIT License
Minimal unit testing framework for C
License: MIT License
Not sure what the exact problem is, but I had to remove the two timing functions. They were throwing errors about missing types(compile-time, not link-time) including timespec, timer_t and a few others.
Using Arch Linux 64bit
[earlz@EarlzAlpha src]$ uname -a
Linux EarlzAlpha 3.8.3-2-ARCH #1 SMP PREEMPT Sun Mar 17 13:04:22 CET 2013 x86_64 GNU/Linux
[earlz@EarlzAlpha src]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/src/gcc-4.7.2/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-cloog-backend=isl --disable-ppl-version-check --disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --disable-multilib --disable-libssp --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-checking=release
Thread model: posix
gcc version 4.7.2 (GCC)
Hello,
Thank you for this good library. I'am use clang-tidy code checker tool in my projects and got many readabilty warnings like this:
warning: do not use 'else' after 'return' [readability-else-after-return]
Yes, I could turn off these checks, but I do find these warnings important. Please see https://clang.llvm.org/extra/clang-tidy/checks/readability-else-after-return.html
Could you fix this please?
I have code:
...
double data = 333.0;
mu_assert_double_eq(data, 1000.0);
...
and minunit outputs:
...
.F
test_asd failed:
../test/test_asd.c:139: 333 expected but was 1000
...
I think that the correct sentence would be ../test/test_asd.c:139: 1000 expected but was 333
?
I think the other mu_assert functions are affected by this bug.
I got lots of warnings and they're all warnings about two lines in minunit.h
In file included from minunit_example.c:1:
minunit_example.c: In function ‘test_suite’:
minunit.h:110:43: warning: comparing floating-point with ‘==’ or ‘!=’ is unsafe [-Wfloat-equal]
110 | MU__SAFE_BLOCK(if (minunit_real_timer == 0 && minunit_proc_timer == 0) { \
| ^~
minunit.h:97:9: note: in definition of macro ‘MU__SAFE_BLOCK’
97 | block \
| ^~~~~
This simple reference project fails to compile successfully due to minunit.c
. Specifically, I get the following:
[koz@Sebastian kozvm]$ make
c99 -g -O1 -c -o test/test-stack.o test/test-stack.c
In file included from test/test-stack.c:19:0:
test/../include/minunit.h: In function ‘mu_timer_real’:
test/../include/minunit.h:267:19: error: storage size of ‘ts’ isn’t known
struct timespec ts;
^~
test/../include/minunit.h:284:9: error: unknown type name ‘clockid_t’
const clockid_t id = (clockid_t)-1; /* Unknown. */
^~~~~~~~~
test/../include/minunit.h:284:25: error: ‘clockid_t’ undeclared (first use in this function); did you mean ‘clock_t’?
const clockid_t id = (clockid_t)-1; /* Unknown. */
^~~~~~~~~
clock_t
test/../include/minunit.h:284:25: note: each undeclared identifier is reported only once for each function it appears in
test/../include/minunit.h:286:31: warning: implicit declaration of function ‘clock_gettime’; did you mean ‘localtime’? [-Wimplicit-function-declaration]
if ( id != (clockid_t)-1 && clock_gettime( id, &ts ) != -1 )
^~~~~~~~~~~~~
localtime
test/../include/minunit.h: In function ‘mu_timer_cpu’:
test/../include/minunit.h:330:3: error: unknown type name ‘clockid_t’; did you mean ‘clock_t’?
clockid_t id;
^~~~~~~~~
clock_t
test/../include/minunit.h:331:19: error: storage size of ‘ts’ isn’t known
struct timespec ts;
^~
test/../include/minunit.h:343:10: error: ‘clockid_t’ undeclared (first use in this function); did you mean ‘clock_t’?
id = (clockid_t)-1;
^~~~~~~~~
clock_t
make: *** [<builtin>: test/test-stack.o] Error 1
Part of this is due to a missing #include <sys/types.h>
, but that only fixes part of the issue.
Hello, I have a problem with a missing function in the dynamicaly loaded library (KERNEL32.DLL) on my Windows 7 machine. I thing the problem is in the line #if defined(NTDDI_WIN8) && NTDDI_VERSION > NTDDI_WIN8
, This is defined as the Visual Studio shows, because of instalation of Windows 8 SDK.
I succesfully compiled the library with some minor changes in the header file but this works for me and I am not sure what is the best solution.
Windows7, VS2015
Would you be interested in supporting multiple MU_TEST_SUITE() from different .c files? I am offering to implement it.
I know that with this MinUnit would lose the "single header file" characteristics, but I think that it is better to split tests for different modules in different files.
Hey guys,
I was wondering if it would be a good idea to make an install script?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.