+CFLAGS = -std=c99 -Wall -Wpedantic -Wdouble-promotion
+TESTFLAGS = -DCMATH3D_ASSERTS -g
+
test_math3d: test.c math3d.h
- $(CC) -std=c99 -Wall -Wpedantic -Wdouble-promotion -g -o test_math3d test.c -lm
+ $(CC) $(CFLAGS) $(TESTFLAGS) -o test_math3d test.c -lm
+
+coverage:
+ $(CC) $(CFLAGS) $(TESTFLAGS) -DCMATH3D_COVERAGE -fprofile-arcs -ftest-coverage -o cov_math3d test.c -lm -lgcov
+ ./cov_math3d
+ gcov test.c math3d.h
test: ./test_math3d
./test_math3d
clean:
- rm test_math3d
+ rm test_math3d *.gcov *.gcda *.gcno
+![](https://github.com/jpreiss/cmath3d/workflows/test/badge.svg)
+![](https://img.shields.io/codecov/c/github/jpreiss/cmath3d)
+
# cmath3d
3d math library for C. Vectors, 3x3 matrices, quaternions. 32-bit floats.
#include <math.h>
#include <stdbool.h>
+// gcov doesn't work properly if functions are inlined.
+#ifdef CMATH3D_COVERAGE
+#define inline
+#endif
+
#ifndef M_PI_F
#define M_PI_F (3.14159265358979323846f)
#define M_1_PI_F (0.31830988618379067154f)