commit c88e62eba895756e00d0fcd797a300d8dd9568f9
parent 4e21afe05eaa842e58afe347a4b72f32614d8b8c
Author: Matt Demanett <matt@demanett.net>
Date: Sun, 25 Mar 2018 21:49:15 -0400
Random stub for testing code in build context.
Diffstat:
3 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
@@ -33,3 +33,4 @@
dist/
benchmark
+testmain
diff --git a/Makefile b/Makefile
@@ -31,4 +31,14 @@ benchmark: $(BENCHMARK_OBJECTS)
$(CXX) -o $@ $^ ../../build/src/util.cpp.o -lbenchmark -lpthread
benchmark_clean:
rm -f benchmark $(BENCHMARK_OBJECTS)
-clean: benchmark_clean
+
+TESTMAIN_SOURCES = $(wildcard test/testmain.cpp src/dsp/*cpp)
+TESTMAIN_OBJECTS = $(patsubst %, build/%.o, $(TESTMAIN_SOURCES))
+TESTMAIN_DEPS = $(patsubst %, build/%.d, $(TESTMAIN_SOURCES))
+-include $(TESTMAIN_DEPS)
+testmain: $(TESTMAIN_OBJECTS)
+ $(CXX) -o $@ $^ ../../build/src/util.cpp.o
+testmain_clean:
+ rm -f testmain $(TESTMAIN_OBJECTS)
+
+clean: benchmark_clean testmain_clean
diff --git a/test/testmain.cpp b/test/testmain.cpp
@@ -0,0 +1,24 @@
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <math.h>
+#include <algorithm>
+
+#include "util/math.hpp" // Rack
+
+int main() {
+ // rando math or whatever, test it here!
+
+ printf("%f\n", rack::eucmod(M_PI, 2.0f));
+ printf("%f\n", rack::eucmod(-M_PI, 2.0f));
+ printf("%f\n", rack::eucmod(M_PI, -2.0f));
+ printf("%f\n", rack::eucmod(-M_PI, -2.0f));
+ printf("%f\n", fmodf(M_PI, 2.0f));
+ printf("%f\n", fmodf(-M_PI, 2.0f));
+ printf("%f\n", fmodf(M_PI, -2.0f));
+ printf("%f\n", fmodf(-M_PI, -2.0f));
+
+ return 0;
+}