Added tests for new math library
git-svn-id: http://picoc.googlecode.com/svn/trunk@310 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
280458a7c6
commit
5f0960d161
2
Makefile
2
Makefile
|
@ -1,6 +1,6 @@
|
|||
CC=gcc
|
||||
CFLAGS=-Wall -g -DUNIX_HOST #-DDEBUG_EXPRESSIONS #-DDEBUG_LEXER
|
||||
LIBS=-lm
|
||||
LIBS=#-lm
|
||||
|
||||
TARGET = picoc
|
||||
SRCS = picoc.c table.c lex.c parse.c expression.c heap.c type.c variable.c clibrary.c library_unix.c platform.c platform_unix.c math_library.c
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
# ifndef NO_FP
|
||||
# include <math.h>
|
||||
# define PICOC_MATH_LIBRARY
|
||||
# undef NEED_MATH_LIBRARY
|
||||
# define NEED_MATH_LIBRARY
|
||||
# undef BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
|
|
21
tests/24_math_library.c
Normal file
21
tests/24_math_library.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
printf("%f\n", sin(0.12));
|
||||
printf("%f\n", cos(0.12));
|
||||
printf("%f\n", tan(0.12));
|
||||
printf("%f\n", asin(0.12));
|
||||
printf("%f\n", acos(0.12));
|
||||
printf("%f\n", atan(0.12));
|
||||
printf("%f\n", sinh(0.12));
|
||||
printf("%f\n", cosh(0.12));
|
||||
printf("%f\n", tanh(0.12));
|
||||
printf("%f\n", asinh(0.12));
|
||||
printf("%f\n", acosh(1.12));
|
||||
printf("%f\n", atanh(0.12));
|
||||
printf("%f\n", exp(0.12));
|
||||
printf("%f\n", fabs(-0.12));
|
||||
printf("%f\n", log(0.12));
|
||||
printf("%f\n", log10(0.12));
|
||||
printf("%f\n", pow(0.12, 0.12));
|
||||
printf("%f\n", sqrt(0.12));
|
||||
printf("%f\n", round(12.34));
|
||||
printf("%f\n", ceil(12.34));
|
||||
printf("%f\n", floor(12.34));
|
21
tests/24_math_library.expect
Normal file
21
tests/24_math_library.expect
Normal file
|
@ -0,0 +1,21 @@
|
|||
0.119712
|
||||
0.9928
|
||||
0.12
|
||||
0.12
|
||||
1.45
|
||||
0.119428
|
||||
0.12
|
||||
1.0
|
||||
0.119427
|
||||
0.119713
|
||||
0.485126
|
||||
0.12
|
||||
1.127496
|
||||
0.12
|
||||
-2.12
|
||||
-0.92
|
||||
0.775357
|
||||
0.34641
|
||||
12.0
|
||||
13.0
|
||||
12.0
|
|
@ -20,7 +20,8 @@ TESTS= 00_assignment.test \
|
|||
19_pointer_arithmetic.test \
|
||||
20_pointer_comparison.test \
|
||||
22_floating_point.test \
|
||||
23_type_coercion.test
|
||||
23_type_coercion.test \
|
||||
24_math_library.test
|
||||
|
||||
%.test: %.expect %.c
|
||||
@echo Test: $*...
|
||||
|
|
Loading…
Reference in a new issue