libmathfix: move to git repository and adapt
This commit is contained in:
parent
1788d59223
commit
ee41b98ee9
@ -441,6 +441,7 @@ endif
|
|||||||
|
|
||||||
ifneq (,$(filter libfixmath-unittests,$(USEMODULE)))
|
ifneq (,$(filter libfixmath-unittests,$(USEMODULE)))
|
||||||
USEPKG += libfixmath
|
USEPKG += libfixmath
|
||||||
|
USEMODULE += libfixmath
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter fib,$(USEMODULE)))
|
ifneq (,$(filter fib,$(USEMODULE)))
|
||||||
|
|||||||
1
pkg/libfixmath/.gitignore
vendored
1
pkg/libfixmath/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
/checkout
|
|
||||||
@ -1,67 +1,11 @@
|
|||||||
export PKG_NAME := libfixmath
|
PKG_NAME := libfixmath
|
||||||
export PKG_VERSION := 91
|
PKG_VERSION := ad9ed940e57d43432b276e95aee6ca9df6f23ccd
|
||||||
export PKG_BRANCH := trunk
|
PKG_URL := git://github.com/PetteriAimonen/libfixmath
|
||||||
export PKG_URL := http://libfixmath.googlecode.com/svn/$(PKG_BRANCH)/
|
PKG_BUILDDIR ?= $(BINDIRBASE)/pkg/$(BOARD)/$(PKG_NAME)
|
||||||
|
|
||||||
export CHECKOUT_FOLDER := $(CURDIR)/checkout/$(PKG_BRANCH)-r$(PKG_VERSION)
|
.PHONY: all
|
||||||
export SVN_INFO_FILE := $(CHECKOUT_FOLDER)/svn_info.xml
|
|
||||||
|
|
||||||
.PHONY: all clean distclean
|
all: git-download
|
||||||
|
$(AD)$(MAKE) -C $(PKG_BUILDDIR)
|
||||||
|
|
||||||
all: $(BINDIR)$(PKG_NAME).a
|
include $(RIOTBASE)/pkg/pkg.mk
|
||||||
|
|
||||||
all-unittests: $(BINDIR)$(PKG_NAME)-unittests.a
|
|
||||||
|
|
||||||
ifneq (,$(filter libfixmath-unittests,$(USEMODULE)))
|
|
||||||
all: all-unittests
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(BINDIR)$(PKG_NAME).a: $(BINDIR)$(PKG_NAME)-src/Makefile $(BINDIR)$(PKG_NAME)-headers/fix16.h
|
|
||||||
"$(MAKE)" -C $(<D)
|
|
||||||
|
|
||||||
$(BINDIR)$(PKG_NAME)-unittests.a: $(BINDIR)$(PKG_NAME)-unittests-src/Makefile $(BINDIR)$(PKG_NAME)-headers/fix16.h
|
|
||||||
"$(MAKE)" -C $(<D)
|
|
||||||
|
|
||||||
$(BINDIR)$(PKG_NAME)-src/Makefile: $(CHECKOUT_FOLDER)/svn_info.xml
|
|
||||||
$(AD)rm -rf $(@D)
|
|
||||||
$(AD)mkdir -p $(@D)
|
|
||||||
$(AD)cp $(CURDIR)/Makefile.template $@
|
|
||||||
$(AD)cp $(CHECKOUT_FOLDER)/libfixmath/*.[ch] $(@D)
|
|
||||||
$(AD)rm -f $(BINDIR)$(PKG_NAME)-src/fix16.h
|
|
||||||
|
|
||||||
$(AD)cd $(@D) && sed -i -e 's/1 <</(uint32_t) 1 <</g' uint32.c
|
|
||||||
$(AD)cd $(@D) && sed -i -e 's/is\([a-z]*\)(\*buf)/is\1((unsigned char) *buf)/g' fix16_str.c
|
|
||||||
|
|
||||||
$(BINDIR)$(PKG_NAME)-unittests-src/Makefile: $(CHECKOUT_FOLDER)/svn_info.xml
|
|
||||||
$(AD)rm -rf $(@D)
|
|
||||||
$(AD)mkdir -p $(@D)
|
|
||||||
$(AD)cp $(CURDIR)/Makefile.template-unittests $@
|
|
||||||
$(AD)cp $(CHECKOUT_FOLDER)/unittests/*.[ch] $(@D)
|
|
||||||
|
|
||||||
$(AD)cd $(@D) && for C_FILE in *.[ch]; do \
|
|
||||||
sed -e "s/int main()/int $$(basename $${C_FILE} .c)(void)/" \
|
|
||||||
-e '/fflush/d' \
|
|
||||||
-e 's/fprintf(std[^,]*,/printf(/' \
|
|
||||||
-i $${C_FILE}; \
|
|
||||||
done
|
|
||||||
$(AD)cd $(@D) && patch -p1 --ignore-whitespace < $(CURDIR)/libfixmath-unittests-printf-format.patch
|
|
||||||
|
|
||||||
$(BINDIR)$(PKG_NAME)-headers/fix16.h: $(CHECKOUT_FOLDER)/svn_info.xml
|
|
||||||
$(AD)rm -rf $(@D)
|
|
||||||
$(AD)mkdir -p $(@D)
|
|
||||||
$(AD)cp $(CHECKOUT_FOLDER)/libfixmath/fix16.h $(@D)
|
|
||||||
$(AD)echo $(patsubst %,'extern int %(void);',$(shell for f in $(CHECKOUT_FOLDER)/unittests/*.c; do basename $${f} .c; done )) \
|
|
||||||
$(patsubst %,'%();',$(shell for f in $(CHECKOUT_FOLDER)/unittests/*.c; do basename $${f} .c; done)) | sed -e 's/;\s*/;\n/g' > $(@D)/fix16_unittests.inc
|
|
||||||
|
|
||||||
$(SVN_INFO_FILE):
|
|
||||||
$(AD)mkdir -p $(@D)
|
|
||||||
$(AD)$(CURDIR)/checkout.sh
|
|
||||||
|
|
||||||
clean::
|
|
||||||
$(AD)rm -rf $(BINDIR)$(PKG_NAME)-src/ $(BINDIR)$(PKG_NAME)-headers/
|
|
||||||
|
|
||||||
distclean:: clean
|
|
||||||
$(AD)rm -rf $(CHECKOUT_FOLDER)
|
|
||||||
|
|
||||||
Makefile.include:
|
|
||||||
@true
|
|
||||||
|
|||||||
@ -1,4 +1,10 @@
|
|||||||
|
PKG_BUILDDIR ?= $(BINDIRBASE)/pkg/$(BOARD)/libfixmath
|
||||||
|
|
||||||
# The static cache is huge, disable it.
|
# The static cache is huge, disable it.
|
||||||
CFLAGS += -DFIXMATH_NO_CACHE
|
CFLAGS += -DFIXMATH_NO_CACHE
|
||||||
|
|
||||||
INCLUDES += -I$(BINDIR)libfixmath-headers/
|
INCLUDES += -I$(PKG_BUILDDIR)/libfixmath
|
||||||
|
|
||||||
|
ifneq (,$(filter libfixmath-unittests,$(USEMODULE)))
|
||||||
|
INCLUDES += -I$(PKG_BUILDDIR)/unittests
|
||||||
|
endif
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
MODULE = libfixmath
|
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.base
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
MODULE = libfixmath-unittests
|
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.base
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
if [ -z "${CHECKOUT_FOLDER}" ]; then
|
|
||||||
echo 'export CHECKOUT_FOLDER before running this script' >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
: ${CHECKOUT_LOCKFILE:=${CHECKOUT_FOLDER}/.riot-svn-checkout-lockfile}
|
|
||||||
# Default timeout, in seconds
|
|
||||||
: ${LOCK_TIMEOUT:=120}
|
|
||||||
|
|
||||||
# We need to protect SVN checkout with a lock to avoid parallel make runs from
|
|
||||||
# disrupting each other
|
|
||||||
if type flock >/dev/null 2>&1; then
|
|
||||||
# Try flock(1) command first, usually found on Linux
|
|
||||||
(
|
|
||||||
flock -w "${LOCK_TIMEOUT}" 200 || (
|
|
||||||
echo "Timed out waiting to acquire lock ${CHECKOUT_LOCKFILE}" >&2
|
|
||||||
exit 1
|
|
||||||
)
|
|
||||||
$(dirname "$0")/perform-svn-checkout.sh
|
|
||||||
exit $?
|
|
||||||
) 200>"${CHECKOUT_LOCKFILE}"
|
|
||||||
elif type lockf >/dev/null 2>&1; then
|
|
||||||
# lockf is usually installed on FreeBSD and OSX
|
|
||||||
lockf -t ${LOCK_TIMEOUT} ${CHECKOUT_LOCKFILE} $(dirname "$0")/perform-svn-checkout.sh
|
|
||||||
exit $?
|
|
||||||
else
|
|
||||||
# flock(1) and lockf(1) shell commands are missing from the system
|
|
||||||
echo 'Missing both flock(1) and lockf(1),'
|
|
||||||
echo 'flock is part of util-linux on most Linux systems, lockf is usually installed on FreeBSD.'
|
|
||||||
echo 'see https://github.com/discoteq/flock for a portable alternative.'
|
|
||||||
echo 'Proceeding with svn checkout without locking...'
|
|
||||||
$(dirname "$0")/perform-svn-checkout.sh
|
|
||||||
exit $?
|
|
||||||
fi
|
|
||||||
@ -1,136 +0,0 @@
|
|||||||
diff --git a/fix16_unittests.c b/fix16_unittests.c
|
|
||||||
index 96b5a11..5f3f9fe 100644
|
|
||||||
--- a/fix16_unittests.c
|
|
||||||
+++ b/fix16_unittests.c
|
|
||||||
@@ -101,7 +101,7 @@ int fix16_unittests(void)
|
|
||||||
#ifndef FIXMATH_NO_OVERFLOW
|
|
||||||
if (result != fix16_overflow)
|
|
||||||
{
|
|
||||||
- printf("\n%d * %d overflow not detected!\n", a, b);
|
|
||||||
+ printf("\n%ld * %ld overflow not detected!\n", (long)a, (long)b);
|
|
||||||
failures++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -109,8 +109,8 @@ int fix16_unittests(void)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
- printf("\n%d * %d = %d\n", a, b, result);
|
|
||||||
- printf("%f * %f = %d\n", fa, fb, fresult);
|
|
||||||
+ printf("\n%ld * %ld = %ld\n", (long)a, (long)b, (long)result);
|
|
||||||
+ printf("%f * %f = %ld\n", fa, fb, (long)fresult);
|
|
||||||
failures++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -176,7 +176,7 @@ int fix16_unittests(void)
|
|
||||||
#ifndef FIXMATH_NO_OVERFLOW
|
|
||||||
if (result != fix16_overflow)
|
|
||||||
{
|
|
||||||
- printf("\n%d / %d overflow not detected!\n", a, b);
|
|
||||||
+ printf("\n%ld / %ld overflow not detected!\n", (long)a, (long)b);
|
|
||||||
failures++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -222,7 +222,7 @@ int fix16_unittests(void)
|
|
||||||
#ifndef FIXMATH_NO_OVERFLOW
|
|
||||||
if (result != fix16_overflow)
|
|
||||||
{
|
|
||||||
- printf("\n%d + %d overflow not detected!\n", a, b);
|
|
||||||
+ printf("\n%ld + %ld overflow not detected!\n", (long)a, (long)b);
|
|
||||||
failures++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -230,8 +230,8 @@ int fix16_unittests(void)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
- printf("\n%d + %d = %d\n", a, b, result);
|
|
||||||
- printf("%f + %f = %d\n", fa, fb, fresult);
|
|
||||||
+ printf("\n%ld + %ld = %ld\n", (long)a, (long)b, (long)result);
|
|
||||||
+ printf("%f + %f = %ld\n", fa, fb, (long)fresult);
|
|
||||||
failures++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -268,7 +268,7 @@ int fix16_unittests(void)
|
|
||||||
#ifndef FIXMATH_NO_OVERFLOW
|
|
||||||
if (result != fix16_overflow)
|
|
||||||
{
|
|
||||||
- printf("\n%d - %d overflow not detected!\n", a, b);
|
|
||||||
+ printf("\n%ld - %ld overflow not detected!\n", (long)a, (long)b);
|
|
||||||
failures++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -276,8 +276,8 @@ int fix16_unittests(void)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
- printf("\n%d - %d = %d\n", a, b, result);
|
|
||||||
- printf("%f - %f = %d\n", fa, fb, fresult);
|
|
||||||
+ printf("\n%ld - %ld = %ld\n", (long)a, (long)b, (long)result);
|
|
||||||
+ printf("%f - %f = %ld\n", fa, fb, (long)fresult);
|
|
||||||
failures++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -321,8 +321,8 @@ int fix16_unittests(void)
|
|
||||||
|
|
||||||
if (delta(fresult, result) > max_delta)
|
|
||||||
{
|
|
||||||
- printf("\nfix16_sqrt(%d) = %d\n", a, result);
|
|
||||||
- printf("sqrt(%f) = %d\n", fa, fresult);
|
|
||||||
+ printf("\nfix16_sqrt(%ld) = %ld\n", (long)a, (long)result);
|
|
||||||
+ printf("sqrt(%f) = %ld\n", fa, (long)fresult);
|
|
||||||
failures++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/fix16_str_unittests.c b/fix16_str_unittests.c
|
|
||||||
index c70da60..c7df566 100644
|
|
||||||
--- a/fix16_str_unittests.c
|
|
||||||
+++ b/fix16_str_unittests.c
|
|
||||||
@@ -93,14 +93,14 @@ int fix16_str_unittests(void)
|
|
||||||
|
|
||||||
if (strcmp(goodbuf, testbuf) != 0)
|
|
||||||
{
|
|
||||||
- printf("Value (fix16_t)%d gave %s, should be %s\n", value, testbuf, goodbuf);
|
|
||||||
+ printf("Value (fix16_t)%ld gave %s, should be %s\n", (long)value, testbuf, goodbuf);
|
|
||||||
ok = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
fix16_t roundtrip = fix16_from_str(testbuf);
|
|
||||||
if (roundtrip != value)
|
|
||||||
{
|
|
||||||
- printf("Roundtrip failed: (fix16_t)%d -> %s -> (fix16_t)%d\n", value, testbuf, roundtrip);
|
|
||||||
+ printf("Roundtrip failed: (fix16_t)%ld -> %s -> (fix16_t)%ld\n", (long)value, testbuf, (long)roundtrip);
|
|
||||||
ok = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/fix16_exp_unittests.c b/fix16_exp_unittests.c
|
|
||||||
index 01620df..658c873 100644
|
|
||||||
--- a/fix16_exp_unittests.c
|
|
||||||
+++ b/fix16_exp_unittests.c
|
|
||||||
@@ -41,7 +41,7 @@ int fix16_exp_unittests(void)
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
- printf("Worst delta %d with input %d\n", max_delta, worst);
|
|
||||||
+ printf("Worst delta %ld with input %ld\n", (long)max_delta, (long)worst);
|
|
||||||
printf("Average delta %0.2f\n", (float)sum / count);
|
|
||||||
|
|
||||||
TEST(max_delta < 200);
|
|
||||||
@@ -80,7 +80,7 @@ int fix16_exp_unittests(void)
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
- printf("Worst delta %0.4f%% with input %d\n", max_delta, worst);
|
|
||||||
+ printf("Worst delta %0.4f%% with input %ld\n", max_delta, (long)worst);
|
|
||||||
printf("Average delta %0.4f%%\n", sum / count);
|
|
||||||
|
|
||||||
TEST(max_delta < 1);
|
|
||||||
@@ -111,7 +111,7 @@ int fix16_exp_unittests(void)
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
- printf("Worst delta %d with input %d\n", max_delta, worst);
|
|
||||||
+ printf("Worst delta %ld with input %ld\n", (long)max_delta, (long)worst);
|
|
||||||
printf("Average delta %0.2f\n", (float)sum / count);
|
|
||||||
|
|
||||||
TEST(max_delta < 20);
|
|
||||||
164
pkg/libfixmath/patches/0001-Move-to-RIOT-Makefiles.patch
Normal file
164
pkg/libfixmath/patches/0001-Move-to-RIOT-Makefiles.patch
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
From 07ab6c2cb9e4b03b3e413a733850f3f8199149d1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Martine Lenders <mail@martine-lenders.eu>
|
||||||
|
Date: Thu, 12 May 2016 14:55:13 +0200
|
||||||
|
Subject: [PATCH 1/3] Move to RIOT Makefiles
|
||||||
|
|
||||||
|
---
|
||||||
|
Makefile | 8 ++++++
|
||||||
|
libfixmath/Makefile | 51 +++----------------------------------
|
||||||
|
unittests/Makefile | 73 ++---------------------------------------------------
|
||||||
|
3 files changed, 13 insertions(+), 119 deletions(-)
|
||||||
|
create mode 100644 Makefile
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..b65e4b5
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -0,0 +1,8 @@
|
||||||
|
+ifneq (,$(filter libfixmath,$(USEMODULE)))
|
||||||
|
+ DIRS += libfixmath
|
||||||
|
+endif
|
||||||
|
+ifneq (,$(filter libfixmath-unittests,$(USEMODULE)))
|
||||||
|
+ DIRS += unittests
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
+include $(RIOTBASE)/Makefile.base
|
||||||
|
diff --git a/libfixmath/Makefile b/libfixmath/Makefile
|
||||||
|
index b284590..c875b98 100644
|
||||||
|
--- a/libfixmath/Makefile
|
||||||
|
+++ b/libfixmath/Makefile
|
||||||
|
@@ -1,48 +1,3 @@
|
||||||
|
-#Project settings
|
||||||
|
-PROJECT = libfixmath
|
||||||
|
-LIB =
|
||||||
|
-SRC = .
|
||||||
|
-INC =
|
||||||
|
-
|
||||||
|
-#Compiler settings
|
||||||
|
-CPP = gcc
|
||||||
|
-CC = gcc
|
||||||
|
-AS = gcc
|
||||||
|
-LD = gcc
|
||||||
|
-AR = ar
|
||||||
|
-CPP_FLAGS = -O2 $(INC) -Wall -Wextra -c
|
||||||
|
-CC_FLAGS = -O2 $(INC) -Wall -Wextra -c
|
||||||
|
-AS_FLAGS = $(CC_FLAGS) -D_ASSEMBLER_
|
||||||
|
-LD_FLAGS = -Wall
|
||||||
|
-
|
||||||
|
-# Find all source files
|
||||||
|
-SRC_CPP = $(foreach dir, $(SRC), $(wildcard $(dir)/*.cpp))
|
||||||
|
-SRC_C = $(foreach dir, $(SRC), $(wildcard $(dir)/*.c))
|
||||||
|
-SRC_S = $(foreach dir, $(SRC), $(wildcard $(dir)/*.S))
|
||||||
|
-OBJ_CPP = $(patsubst %.cpp, %.o, $(SRC_CPP))
|
||||||
|
-OBJ_C = $(patsubst %.c, %.o, $(SRC_C))
|
||||||
|
-OBJ_S = $(patsubst %.S, %.o, $(SRC_S))
|
||||||
|
-OBJ = $(OBJ_CPP) $(OBJ_C) $(OBJ_S)
|
||||||
|
-
|
||||||
|
-# Compile rules.
|
||||||
|
-.PHONY : all
|
||||||
|
-all: $(PROJECT).a
|
||||||
|
-
|
||||||
|
-$(PROJECT).a: $(OBJ)
|
||||||
|
- $(AR) rcs $(PROJECT).a $(OBJ)
|
||||||
|
-
|
||||||
|
-$(OBJ_CPP) : %.o : %.cpp
|
||||||
|
- $(CPP) $(CPP_FLAGS) -o $@ $<
|
||||||
|
-
|
||||||
|
-$(OBJ_C) : %.o : %.c
|
||||||
|
- $(CC) $(CC_FLAGS) -o $@ $<
|
||||||
|
-
|
||||||
|
-$(OBJ_S) : %.o : %.S
|
||||||
|
- $(AS) $(AS_FLAGS) -o $@ $<
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-# Clean rules
|
||||||
|
-.PHONY : clean
|
||||||
|
-clean:
|
||||||
|
- rm -f $(PROJECT).a $(OBJ)
|
||||||
|
+MODULE = libfixmath
|
||||||
|
+
|
||||||
|
+include $(RIOTBASE)/Makefile.base
|
||||||
|
diff --git a/unittests/Makefile b/unittests/Makefile
|
||||||
|
index 329caf4..245ffb9 100644
|
||||||
|
--- a/unittests/Makefile
|
||||||
|
+++ b/unittests/Makefile
|
||||||
|
@@ -1,72 +1,3 @@
|
||||||
|
-# Makefile for running the unittests of libfixmath.
|
||||||
|
-CC = gcc
|
||||||
|
-
|
||||||
|
-# Basic CFLAGS for debugging
|
||||||
|
-CFLAGS = -g -O0 -I../libfixmath -Wall -Wextra -Werror
|
||||||
|
-
|
||||||
|
-# The files required for tests
|
||||||
|
-FIX16_SRC = ../libfixmath/fix16.c ../libfixmath/fix16_sqrt.c ../libfixmath/fix16_str.c \
|
||||||
|
- ../libfixmath/fix16_exp.c ../libfixmath/fix16.h
|
||||||
|
-
|
||||||
|
-all: run_fix16_unittests run_fix16_exp_unittests run_fix16_str_unittests run_fix16_macros_unittests
|
||||||
|
-
|
||||||
|
-clean:
|
||||||
|
- rm -f fix16_unittests_????
|
||||||
|
-
|
||||||
|
-# The library is tested automatically under different compilations
|
||||||
|
-# options.
|
||||||
|
-#
|
||||||
|
-# Test naming:
|
||||||
|
-# r = rounding, n = no rounding
|
||||||
|
-# o = overflow detection, n = no overflow detection
|
||||||
|
-# 64 = int64_t math, 32 = int32_t math
|
||||||
|
-
|
||||||
|
-run_fix16_unittests: \
|
||||||
|
- fix16_unittests_ro64 fix16_unittests_no64 \
|
||||||
|
- fix16_unittests_rn64 fix16_unittests_nn64 \
|
||||||
|
- fix16_unittests_ro32 fix16_unittests_no32 \
|
||||||
|
- fix16_unittests_rn32 fix16_unittests_nn32 \
|
||||||
|
- fix16_unittests_ro08 fix16_unittests_no08 \
|
||||||
|
- fix16_unittests_rn08 fix16_unittests_nn08
|
||||||
|
- $(foreach test, $^, \
|
||||||
|
- echo $(test) && \
|
||||||
|
- ./$(test) > /dev/null && \
|
||||||
|
- ) true
|
||||||
|
-
|
||||||
|
-fix16_unittests_no64: DEFINES=-DFIXMATH_NO_ROUNDING
|
||||||
|
-fix16_unittests_rn64: DEFINES=-DFIXMATH_NO_OVERFLOW
|
||||||
|
-fix16_unittests_nn64: DEFINES=-DFIXMATH_NO_ROUNDING -DFIXMATH_NO_OVERFLOW
|
||||||
|
-fix16_unittests_ro32: DEFINES=-DFIXMATH_NO_64BIT
|
||||||
|
-fix16_unittests_no32: DEFINES=-DFIXMATH_NO_ROUNDING -DFIXMATH_NO_64BIT
|
||||||
|
-fix16_unittests_rn32: DEFINES=-DFIXMATH_NO_OVERFLOW -DFIXMATH_NO_64BIT
|
||||||
|
-fix16_unittests_nn32: DEFINES=-DFIXMATH_NO_OVERFLOW -DFIXMATH_NO_ROUNDING -DFIXMATH_NO_64BIT
|
||||||
|
-fix16_unittests_ro08: DEFINES=-DFIXMATH_OPTIMIZE_8BIT
|
||||||
|
-fix16_unittests_no08: DEFINES=-DFIXMATH_NO_ROUNDING -DFIXMATH_OPTIMIZE_8BIT
|
||||||
|
-fix16_unittests_rn08: DEFINES=-DFIXMATH_NO_OVERFLOW -DFIXMATH_OPTIMIZE_8BIT
|
||||||
|
-fix16_unittests_nn08: DEFINES=-DFIXMATH_NO_OVERFLOW -DFIXMATH_NO_ROUNDING -DFIXMATH_OPTIMIZE_8BIT
|
||||||
|
-
|
||||||
|
-fix16_unittests_% : fix16_unittests.c $(FIX16_SRC)
|
||||||
|
- $(CC) $(CFLAGS) $(DEFINES) -o $@ $^ -lm
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-# Tests for the exponential function, run only in default config
|
||||||
|
-run_fix16_exp_unittests: fix16_exp_unittests
|
||||||
|
- ./fix16_exp_unittests > /dev/null
|
||||||
|
-
|
||||||
|
-fix16_exp_unittests: fix16_exp_unittests.c $(FIX16_SRC)
|
||||||
|
- $(CC) $(CFLAGS) $(DEFINES) -o $@ $^ -lm
|
||||||
|
-
|
||||||
|
-# Tests for string conversion, run only in default config
|
||||||
|
-run_fix16_str_unittests: fix16_str_unittests
|
||||||
|
- ./fix16_str_unittests > /dev/null
|
||||||
|
-
|
||||||
|
-fix16_str_unittests: fix16_str_unittests.c $(FIX16_SRC)
|
||||||
|
- $(CC) $(CFLAGS) $(DEFINES) -o $@ $^ -lm
|
||||||
|
-
|
||||||
|
-# Tests for literal macros, run only in default config
|
||||||
|
-run_fix16_macros_unittests: fix16_macros_unittests
|
||||||
|
- ./fix16_macros_unittests > /dev/null
|
||||||
|
-
|
||||||
|
-fix16_macros_unittests: fix16_macros_unittests.c $(FIX16_SRC)
|
||||||
|
- $(CC) $(CFLAGS) $(DEFINES) -o $@ $^ -lm
|
||||||
|
+MODULE = libfixmath-unittests
|
||||||
|
|
||||||
|
+include $(RIOTBASE)/Makefile.base
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
||||||
125
pkg/libfixmath/patches/0002-Fix-warnings.patch
Normal file
125
pkg/libfixmath/patches/0002-Fix-warnings.patch
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
From be24fc7113549d4f7d8b6fa2df298dfd36fb1dd4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Martine Lenders <mail@martine-lenders.eu>
|
||||||
|
Date: Thu, 12 May 2016 16:07:35 +0200
|
||||||
|
Subject: [PATCH 2/3] Fix warnings
|
||||||
|
|
||||||
|
---
|
||||||
|
libfixmath/fix16_str.c | 8 ++++----
|
||||||
|
libfixmath/uint32.c | 10 +++++-----
|
||||||
|
unittests/libfixmath-unittests.h | 18 ++++++++++++++++++
|
||||||
|
unittests/unittests.h | 18 ------------------
|
||||||
|
4 files changed, 27 insertions(+), 27 deletions(-)
|
||||||
|
create mode 100644 unittests/libfixmath-unittests.h
|
||||||
|
delete mode 100644 unittests/unittests.h
|
||||||
|
|
||||||
|
diff --git a/libfixmath/fix16_str.c b/libfixmath/fix16_str.c
|
||||||
|
index eff906f..2c02c21 100644
|
||||||
|
--- a/libfixmath/fix16_str.c
|
||||||
|
+++ b/libfixmath/fix16_str.c
|
||||||
|
@@ -59,7 +59,7 @@ void fix16_to_str(fix16_t value, char *buf, int decimals)
|
||||||
|
|
||||||
|
fix16_t fix16_from_str(const char *buf)
|
||||||
|
{
|
||||||
|
- while (isspace(*buf))
|
||||||
|
+ while (isspace((unsigned char) *buf))
|
||||||
|
buf++;
|
||||||
|
|
||||||
|
/* Decode the sign */
|
||||||
|
@@ -70,7 +70,7 @@ fix16_t fix16_from_str(const char *buf)
|
||||||
|
/* Decode the integer part */
|
||||||
|
uint32_t intpart = 0;
|
||||||
|
int count = 0;
|
||||||
|
- while (isdigit(*buf))
|
||||||
|
+ while (isdigit((unsigned char) *buf))
|
||||||
|
{
|
||||||
|
intpart *= 10;
|
||||||
|
intpart += *buf++ - '0';
|
||||||
|
@@ -90,7 +90,7 @@ fix16_t fix16_from_str(const char *buf)
|
||||||
|
|
||||||
|
uint32_t fracpart = 0;
|
||||||
|
uint32_t scale = 1;
|
||||||
|
- while (isdigit(*buf) && scale < 100000)
|
||||||
|
+ while (isdigit((unsigned char) *buf) && scale < 100000)
|
||||||
|
{
|
||||||
|
scale *= 10;
|
||||||
|
fracpart *= 10;
|
||||||
|
@@ -103,7 +103,7 @@ fix16_t fix16_from_str(const char *buf)
|
||||||
|
/* Verify that there is no garbage left over */
|
||||||
|
while (*buf != '\0')
|
||||||
|
{
|
||||||
|
- if (!isdigit(*buf) && !isspace(*buf))
|
||||||
|
+ if (!isdigit((unsigned char) *buf) && !isspace((unsigned char) *buf))
|
||||||
|
return fix16_overflow;
|
||||||
|
|
||||||
|
buf++;
|
||||||
|
diff --git a/libfixmath/uint32.c b/libfixmath/uint32.c
|
||||||
|
index 2980ab9..c1adc4f 100644
|
||||||
|
--- a/libfixmath/uint32.c
|
||||||
|
+++ b/libfixmath/uint32.c
|
||||||
|
@@ -6,10 +6,10 @@ uint32_t uint32_log2(uint32_t inVal) {
|
||||||
|
if(inVal == 0)
|
||||||
|
return 0;
|
||||||
|
uint32_t tempOut = 0;
|
||||||
|
- if(inVal >= (1 << 16)) { inVal >>= 16; tempOut += 16; }
|
||||||
|
- if(inVal >= (1 << 8)) { inVal >>= 8; tempOut += 8; }
|
||||||
|
- if(inVal >= (1 << 4)) { inVal >>= 4; tempOut += 4; }
|
||||||
|
- if(inVal >= (1 << 2)) { inVal >>= 2; tempOut += 2; }
|
||||||
|
- if(inVal >= (1 << 1)) { tempOut += 1; }
|
||||||
|
+ if(inVal >= ((uint32_t) 1 << 16)) { inVal >>= 16; tempOut += 16; }
|
||||||
|
+ if(inVal >= ((uint32_t) 1 << 8)) { inVal >>= 8; tempOut += 8; }
|
||||||
|
+ if(inVal >= ((uint32_t) 1 << 4)) { inVal >>= 4; tempOut += 4; }
|
||||||
|
+ if(inVal >= ((uint32_t) 1 << 2)) { inVal >>= 2; tempOut += 2; }
|
||||||
|
+ if(inVal >= ((uint32_t) 1 << 1)) { tempOut += 1; }
|
||||||
|
return tempOut;
|
||||||
|
}
|
||||||
|
diff --git a/unittests/libfixmath-unittests.h b/unittests/libfixmath-unittests.h
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..bac57d2
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/unittests/libfixmath-unittests.h
|
||||||
|
@@ -0,0 +1,18 @@
|
||||||
|
+#include <stdio.h>
|
||||||
|
+
|
||||||
|
+#define COMMENT(x) printf("\n----" x "----\n");
|
||||||
|
+#define STR(x) #x
|
||||||
|
+#define STR2(x) STR(x)
|
||||||
|
+#define TEST(x) \
|
||||||
|
+ if (!(x)) { \
|
||||||
|
+ fflush(stdout); \
|
||||||
|
+ fflush(stderr); \
|
||||||
|
+ fprintf(stderr, "\033[31;1mFAILED:\033[22;39m " __FILE__ ":" STR2(__LINE__) " " #x "\n"); \
|
||||||
|
+ status = 1; \
|
||||||
|
+ } else { \
|
||||||
|
+ fflush(stdout); \
|
||||||
|
+ fflush(stderr); \
|
||||||
|
+ printf("\033[32;1mOK:\033[22;39m " #x "\n"); \
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+
|
||||||
|
diff --git a/unittests/unittests.h b/unittests/unittests.h
|
||||||
|
deleted file mode 100644
|
||||||
|
index bac57d2..0000000
|
||||||
|
--- a/unittests/unittests.h
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,18 +0,0 @@
|
||||||
|
-#include <stdio.h>
|
||||||
|
-
|
||||||
|
-#define COMMENT(x) printf("\n----" x "----\n");
|
||||||
|
-#define STR(x) #x
|
||||||
|
-#define STR2(x) STR(x)
|
||||||
|
-#define TEST(x) \
|
||||||
|
- if (!(x)) { \
|
||||||
|
- fflush(stdout); \
|
||||||
|
- fflush(stderr); \
|
||||||
|
- fprintf(stderr, "\033[31;1mFAILED:\033[22;39m " __FILE__ ":" STR2(__LINE__) " " #x "\n"); \
|
||||||
|
- status = 1; \
|
||||||
|
- } else { \
|
||||||
|
- fflush(stdout); \
|
||||||
|
- fflush(stderr); \
|
||||||
|
- printf("\033[32;1mOK:\033[22;39m " #x "\n"); \
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
-
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
||||||
275
pkg/libfixmath/patches/0003-Adapt-unittests-for-RIOT.patch
Normal file
275
pkg/libfixmath/patches/0003-Adapt-unittests-for-RIOT.patch
Normal file
@ -0,0 +1,275 @@
|
|||||||
|
From 341e82f96ca2cf6d1cedba8d3610c108ba5153dd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Martine Lenders <mail@martine-lenders.eu>
|
||||||
|
Date: Thu, 12 May 2016 15:08:39 +0200
|
||||||
|
Subject: [PATCH 3/3] Adapt unittests for RIOT
|
||||||
|
|
||||||
|
---
|
||||||
|
unittests/fix16_exp_unittests.c | 12 ++++++------
|
||||||
|
unittests/fix16_macros_unittests.c | 6 +++---
|
||||||
|
unittests/fix16_str_unittests.c | 10 +++++-----
|
||||||
|
unittests/fix16_unittests.c | 30 +++++++++++++++---------------
|
||||||
|
unittests/libfixmath-unittests.h | 10 +++++-----
|
||||||
|
5 files changed, 34 insertions(+), 34 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/unittests/fix16_exp_unittests.c b/unittests/fix16_exp_unittests.c
|
||||||
|
index afb6706..5b942bb 100644
|
||||||
|
--- a/unittests/fix16_exp_unittests.c
|
||||||
|
+++ b/unittests/fix16_exp_unittests.c
|
||||||
|
@@ -2,11 +2,11 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
-#include "unittests.h"
|
||||||
|
+#include "libfixmath-unittests.h"
|
||||||
|
|
||||||
|
#define delta(a,b) (((a)>=(b)) ? (a)-(b) : (b)-(a))
|
||||||
|
|
||||||
|
-int main()
|
||||||
|
+int fix16_exp_unittests(void)
|
||||||
|
{
|
||||||
|
int status = 0;
|
||||||
|
{
|
||||||
|
@@ -41,7 +41,7 @@ int main()
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
- printf("Worst delta %d with input %d\n", max_delta, worst);
|
||||||
|
+ printf("Worst delta %ld with input %ld\n", (long)max_delta, (long)worst);
|
||||||
|
printf("Average delta %0.2f\n", (float)sum / count);
|
||||||
|
|
||||||
|
TEST(max_delta < 200);
|
||||||
|
@@ -80,7 +80,7 @@ int main()
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
- printf("Worst delta %0.4f%% with input %d\n", max_delta, worst);
|
||||||
|
+ printf("Worst delta %0.4f%% with input %ld\n", max_delta, (long)worst);
|
||||||
|
printf("Average delta %0.4f%%\n", sum / count);
|
||||||
|
|
||||||
|
TEST(max_delta < 1);
|
||||||
|
@@ -111,14 +111,14 @@ int main()
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
- printf("Worst delta %d with input %d\n", max_delta, worst);
|
||||||
|
+ printf("Worst delta %ld with input %ld\n", (long)max_delta, (long)worst);
|
||||||
|
printf("Average delta %0.2f\n", (float)sum / count);
|
||||||
|
|
||||||
|
TEST(max_delta < 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status != 0)
|
||||||
|
- fprintf(stdout, "\n\nSome tests FAILED!\n");
|
||||||
|
+ printf( "\n\nSome tests FAILED!\n");
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
diff --git a/unittests/fix16_macros_unittests.c b/unittests/fix16_macros_unittests.c
|
||||||
|
index cdfcfaf..6141021 100644
|
||||||
|
--- a/unittests/fix16_macros_unittests.c
|
||||||
|
+++ b/unittests/fix16_macros_unittests.c
|
||||||
|
@@ -4,13 +4,13 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
-#include "unittests.h"
|
||||||
|
+#include "libfixmath-unittests.h"
|
||||||
|
|
||||||
|
#define DO_TEST(i,m) \
|
||||||
|
TEST(F16(i ## . ## m) == F16C(i,m)) \
|
||||||
|
TEST(F16(i ## . ## m) == fix16_from_dbl(i ## . ## m))
|
||||||
|
|
||||||
|
-int main()
|
||||||
|
+int fix16_macros_unittests(void)
|
||||||
|
{
|
||||||
|
int status = 0;
|
||||||
|
|
||||||
|
@@ -103,7 +103,7 @@ int main()
|
||||||
|
DO_TEST( -0,22957)
|
||||||
|
|
||||||
|
if (status != 0)
|
||||||
|
- fprintf(stdout, "\n\nSome tests FAILED!\n");
|
||||||
|
+ printf( "\n\nSome tests FAILED!\n");
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
diff --git a/unittests/fix16_str_unittests.c b/unittests/fix16_str_unittests.c
|
||||||
|
index 46da171..678bc3c 100644
|
||||||
|
--- a/unittests/fix16_str_unittests.c
|
||||||
|
+++ b/unittests/fix16_str_unittests.c
|
||||||
|
@@ -3,9 +3,9 @@
|
||||||
|
#include <math.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
-#include "unittests.h"
|
||||||
|
+#include "libfixmath-unittests.h"
|
||||||
|
|
||||||
|
-int main()
|
||||||
|
+int fix16_str_unittests(void)
|
||||||
|
{
|
||||||
|
int status = 0;
|
||||||
|
|
||||||
|
@@ -93,14 +93,14 @@ int main()
|
||||||
|
|
||||||
|
if (strcmp(goodbuf, testbuf) != 0)
|
||||||
|
{
|
||||||
|
- printf("Value (fix16_t)%d gave %s, should be %s\n", value, testbuf, goodbuf);
|
||||||
|
+ printf("Value (fix16_t)%ld gave %s, should be %s\n", (long)value, testbuf, goodbuf);
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fix16_t roundtrip = fix16_from_str(testbuf);
|
||||||
|
if (roundtrip != value)
|
||||||
|
{
|
||||||
|
- printf("Roundtrip failed: (fix16_t)%d -> %s -> (fix16_t)%d\n", value, testbuf, roundtrip);
|
||||||
|
+ printf("Roundtrip failed: (fix16_t)%ld -> %s -> (fix16_t)%ld\n", (long)value, testbuf, (long)roundtrip);
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -111,7 +111,7 @@ int main()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status != 0)
|
||||||
|
- fprintf(stdout, "\n\nSome tests FAILED!\n");
|
||||||
|
+ printf( "\n\nSome tests FAILED!\n");
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
diff --git a/unittests/fix16_unittests.c b/unittests/fix16_unittests.c
|
||||||
|
index 9a301a1..b9fbf1a 100644
|
||||||
|
--- a/unittests/fix16_unittests.c
|
||||||
|
+++ b/unittests/fix16_unittests.c
|
||||||
|
@@ -2,7 +2,7 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
-#include "unittests.h"
|
||||||
|
+#include "libfixmath-unittests.h"
|
||||||
|
|
||||||
|
const fix16_t testcases[] = {
|
||||||
|
// Small numbers
|
||||||
|
@@ -47,7 +47,7 @@ const fix16_t max_delta = 1;
|
||||||
|
const fix16_t max_delta = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-int main()
|
||||||
|
+int fix16_unittests(void)
|
||||||
|
{
|
||||||
|
int status = 0;
|
||||||
|
|
||||||
|
@@ -101,7 +101,7 @@ int main()
|
||||||
|
#ifndef FIXMATH_NO_OVERFLOW
|
||||||
|
if (result != fix16_overflow)
|
||||||
|
{
|
||||||
|
- printf("\n%d * %d overflow not detected!\n", a, b);
|
||||||
|
+ printf("\n%ld * %ld overflow not detected!\n", (long)a, (long)b);
|
||||||
|
failures++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -109,8 +109,8 @@ int main()
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
- printf("\n%d * %d = %d\n", a, b, result);
|
||||||
|
- printf("%f * %f = %d\n", fa, fb, fresult);
|
||||||
|
+ printf("\n%ld * %ld = %ld\n", (long)a, (long)b, (long)result);
|
||||||
|
+ printf("%f * %f = %ld\n", fa, fb, (long)fresult);
|
||||||
|
failures++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -176,7 +176,7 @@ int main()
|
||||||
|
#ifndef FIXMATH_NO_OVERFLOW
|
||||||
|
if (result != fix16_overflow)
|
||||||
|
{
|
||||||
|
- printf("\n%d / %d overflow not detected!\n", a, b);
|
||||||
|
+ printf("\n%ld / %ld overflow not detected!\n", (long)a, (long)b);
|
||||||
|
failures++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -222,7 +222,7 @@ int main()
|
||||||
|
#ifndef FIXMATH_NO_OVERFLOW
|
||||||
|
if (result != fix16_overflow)
|
||||||
|
{
|
||||||
|
- printf("\n%d + %d overflow not detected!\n", a, b);
|
||||||
|
+ printf("\n%ld + %ld overflow not detected!\n", (long)a, (long)b);
|
||||||
|
failures++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -230,8 +230,8 @@ int main()
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
- printf("\n%d + %d = %d\n", a, b, result);
|
||||||
|
- printf("%f + %f = %d\n", fa, fb, fresult);
|
||||||
|
+ printf("\n%ld + %ld = %ld\n", (long)a, (long)b, (long)result);
|
||||||
|
+ printf("%f + %f = %ld\n", fa, fb, (long)fresult);
|
||||||
|
failures++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -268,7 +268,7 @@ int main()
|
||||||
|
#ifndef FIXMATH_NO_OVERFLOW
|
||||||
|
if (result != fix16_overflow)
|
||||||
|
{
|
||||||
|
- printf("\n%d - %d overflow not detected!\n", a, b);
|
||||||
|
+ printf("\n%ld - %ld overflow not detected!\n", (long)a, (long)b);
|
||||||
|
failures++;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@@ -276,8 +276,8 @@ int main()
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
- printf("\n%d - %d = %d\n", a, b, result);
|
||||||
|
- printf("%f - %f = %d\n", fa, fb, fresult);
|
||||||
|
+ printf("\n%ld - %ld = %ld\n", (long)a, (long)b, (long)result);
|
||||||
|
+ printf("%f - %f = %ld\n", fa, fb, (long)fresult);
|
||||||
|
failures++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -321,8 +321,8 @@ int main()
|
||||||
|
|
||||||
|
if (delta(fresult, result) > max_delta)
|
||||||
|
{
|
||||||
|
- printf("\nfix16_sqrt(%d) = %d\n", a, result);
|
||||||
|
- printf("sqrt(%f) = %d\n", fa, fresult);
|
||||||
|
+ printf("\nfix16_sqrt(%ld) = %ld\n", (long)a, (long)result);
|
||||||
|
+ printf("sqrt(%f) = %ld\n", fa, (long)fresult);
|
||||||
|
failures++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -331,7 +331,7 @@ int main()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status != 0)
|
||||||
|
- fprintf(stdout, "\n\nSome tests FAILED!\n");
|
||||||
|
+ printf( "\n\nSome tests FAILED!\n");
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
diff --git a/unittests/libfixmath-unittests.h b/unittests/libfixmath-unittests.h
|
||||||
|
index bac57d2..a72d025 100644
|
||||||
|
--- a/unittests/libfixmath-unittests.h
|
||||||
|
+++ b/unittests/libfixmath-unittests.h
|
||||||
|
@@ -5,14 +5,14 @@
|
||||||
|
#define STR2(x) STR(x)
|
||||||
|
#define TEST(x) \
|
||||||
|
if (!(x)) { \
|
||||||
|
- fflush(stdout); \
|
||||||
|
- fflush(stderr); \
|
||||||
|
- fprintf(stderr, "\033[31;1mFAILED:\033[22;39m " __FILE__ ":" STR2(__LINE__) " " #x "\n"); \
|
||||||
|
+ printf( "\033[31;1mFAILED:\033[22;39m " __FILE__ ":" STR2(__LINE__) " " #x "\n"); \
|
||||||
|
status = 1; \
|
||||||
|
} else { \
|
||||||
|
- fflush(stdout); \
|
||||||
|
- fflush(stderr); \
|
||||||
|
printf("\033[32;1mOK:\033[22;39m " #x "\n"); \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
+int fix16_exp_unittests(void);
|
||||||
|
+int fix16_macros_unittests(void);
|
||||||
|
+int fix16_str_unittests(void);
|
||||||
|
+int fix16_unittests(void);
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
if [ -z "${PKG_URL}" ]; then
|
|
||||||
echo 'export PKG_URL before running this script' >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
if [ -z "${CHECKOUT_FOLDER}" ]; then
|
|
||||||
echo 'export CHECKOUT_FOLDER before running this script' >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
: ${SVN_INFO_FILE:=${CHECKOUT_FOLDER}/svn_info.xml}
|
|
||||||
|
|
||||||
if [ -s "${SVN_INFO_FILE}" ]; then
|
|
||||||
# svn checkout was completed by another thread while we waited for the lock
|
|
||||||
if [ "${QUIET}" -ne 1 ]; then
|
|
||||||
echo "File already exists: ${SVN_INFO_FILE}, skipping svn checkout"
|
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
if [ -n "${PKG_VERSION}" ]; then
|
|
||||||
svn checkout -q -r ${PKG_VERSION} ${PKG_URL} ${CHECKOUT_FOLDER}
|
|
||||||
else
|
|
||||||
svn checkout -q ${PKG_URL} ${CHECKOUT_FOLDER}
|
|
||||||
fi
|
|
||||||
svn info --xml ${CHECKOUT_FOLDER} > ${SVN_INFO_FILE}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user