diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2010-11-30 13:48:35 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2010-11-30 13:48:35 +0000 |
commit | a52ac89fc69493b402b41a5ee38e6d5cee34d4f2 (patch) | |
tree | d5bfa64fde4f3822ca1946b71678a3c7c8c1dfe9 /testsuites/libtests/complex | |
parent | 2010-11-30 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-a52ac89fc69493b402b41a5ee38e6d5cee34d4f2.tar.bz2 |
New.
Diffstat (limited to 'testsuites/libtests/complex')
-rw-r--r-- | testsuites/libtests/complex/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/libtests/complex/Makefile.am | 46 | ||||
-rw-r--r-- | testsuites/libtests/complex/complex.scn | 46 | ||||
-rw-r--r-- | testsuites/libtests/complex/docomplex.c | 110 | ||||
-rw-r--r-- | testsuites/libtests/complex/docomplex.in | 110 | ||||
-rw-r--r-- | testsuites/libtests/complex/docomplexf.c | 110 | ||||
-rw-r--r-- | testsuites/libtests/complex/docomplexl.c | 110 | ||||
-rw-r--r-- | testsuites/libtests/complex/init.c | 67 |
8 files changed, 601 insertions, 0 deletions
diff --git a/testsuites/libtests/complex/.cvsignore b/testsuites/libtests/complex/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/libtests/complex/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/libtests/complex/Makefile.am b/testsuites/libtests/complex/Makefile.am new file mode 100644 index 0000000000..61154d2ae7 --- /dev/null +++ b/testsuites/libtests/complex/Makefile.am @@ -0,0 +1,46 @@ +## +## $Id$ +## + +rtems_tests_PROGRAMS = complex +complex_SOURCES = init.c docomplex.c docomplexf.c docomplexl.c +EXTRA_DIST = docomplex.in + +# FIXME: Skip long double, not yet supported in newlib +complex_CPPFLAGS = $(AM_CPPFLAGS) -DNO_LONG_DOUBLE + +docomplex.c: $(srcdir)/docomplex.in + sed -e 's,[@]FTYPE[@],double,' \ + -e 's,[@]FSUFFIX[@], ,g' \ + -e 's,[@]FGUARD[@],NO_DOUBLE,' \ + $(srcdir)/docomplex.in > $(srcdir)/docomplex.c + +docomplexf.c: $(srcdir)/docomplex.in + sed -e 's,[@]FTYPE[@],float,' \ + -e 's,[@]FSUFFIX[@],f,g' \ + -e 's,[@]FGUARD[@],NO_FLOAT,' \ + $(srcdir)/docomplex.in > $(srcdir)/docomplexf.c + +docomplexl.c: $(srcdir)/docomplex.in + sed -e 's,[@]FTYPE[@],long double,' \ + -e 's,[@]FSUFFIX[@],l,g' \ + -e 's,%f,%Lf,g' \ + -e 's,[@]FGUARD[@],NO_LONG_DOUBLE,' \ + $(srcdir)/docomplex.in > $(srcdir)/docomplexl.c + +dist_rtems_tests_DATA = complex.scn + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +complex_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) -lm + +LINK_OBJS = $(complex_OBJECTS) $(complex_LDADD) +LINK_LIBS = $(complex_LDLIBS) + +complex$(EXEEXT): $(complex_OBJECTS) $(complex_DEPENDENCIES) + @rm -f complex$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/libtests/complex/complex.scn b/testsuites/libtests/complex/complex.scn new file mode 100644 index 0000000000..f19dee3d3f --- /dev/null +++ b/testsuites/libtests/complex/complex.scn @@ -0,0 +1,46 @@ +*** COMPLEX MATH TEST *** +cabs : 1.414214 +cacos : 0.904557 -1.061275i +cacosh : 1.061275 0.904557i +carg : 0.785398 +casin : 0.666239 1.061275i +casinh : 1.061275 0.666239i +catan : 1.017222 0.402359i +catanh : 0.402359 1.017222i +ccos : 0.833730 -0.988898i +ccosh : 0.833730 0.988898i +cexp : 1.468694 2.287355i +cimag : 1.000000 +clog : 0.346574 0.785398i +conj : 1.000000 -1.000000i +cpow : 2.807879 1.317865i +cproj : 1.000000 1.000000i +creal : 1.000000 +csin : 1.298458 0.634964i +csinh : 0.634964 1.298458i +csqrt : 1.098684 0.455090i +ctan : 0.271753 1.083923i +ctanh : 1.083923 0.271753i +cabsf : 1.414214 +cacosf : 0.904557 -1.061275i +cacoshf: 1.061275 0.904557i +cargf : 0.785398 +casinf : 0.666239 1.061275i +casinhf: 1.061275 0.666239i +catanf : 1.017222 0.402359i +catanhf: 0.402359 1.017222i +ccosf : 0.833730 -0.988898i +ccoshf : 0.833730 0.988898i +cexpf : 1.468694 2.287355i +cimagf : 1.000000 +clogf : 0.346574 0.785398i +conjf : 1.000000 -1.000000i +cpowf : 2.807879 1.317865i +cprojf : 1.000000 1.000000i +crealf : 1.000000 +csinf : 1.298458 0.634964i +csinhf : 0.634964 1.298458i +csqrtf : 1.098684 0.455090i +ctanf : 0.271753 1.083923i +ctanhf : 1.083923 0.271753i +*** END OF COMPLEX MATH TEST *** diff --git a/testsuites/libtests/complex/docomplex.c b/testsuites/libtests/complex/docomplex.c new file mode 100644 index 0000000000..28ddce3d1f --- /dev/null +++ b/testsuites/libtests/complex/docomplex.c @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2010 by + * Ralf Corsepius, Ulm/Germany. All rights reserved. + * + * Permission to use, copy, modify, and distribute this software + * is freely granted, provided that this notice is preserved. + */ + +/* + * Try to compile and link against POSIX complex math routines. + */ + +#include <complex.h> +#include <stdio.h> + +void +docomplex (void) +{ +#ifndef NO_DOUBLE + complex double ca, cb, cc; + double f1; + + ca = 1.0 + 1.0 * I; + cb = 1.0 - 1.0 * I; + + f1 = cabs (ca); + fprintf (stdout, "cabs : %f\n", f1); + + cc = cacos (ca); + fprintf (stdout, "cacos : %f %fi\n", creal (cc), + cimag (cc)); + + cc = cacosh (ca); + fprintf (stdout, "cacosh : %f %fi\n", creal (cc), + cimag (cc)); + + f1 = carg (ca); + fprintf (stdout, "carg : %f\n", f1); + + cc = casin (ca); + fprintf (stdout, "casin : %f %fi\n", creal (cc), + cimag (cc)); + + cc = casinh (ca); + fprintf (stdout, "casinh : %f %fi\n", creal (cc), + cimag (cc)); + + cc = catan (ca); + fprintf (stdout, "catan : %f %fi\n", creal (cc), + cimag (cc)); + + cc = catanh (ca); + fprintf (stdout, "catanh : %f %fi\n", creal (cc), + cimag (cc)); + + cc = ccos (ca); + fprintf (stdout, "ccos : %f %fi\n", creal (cc), + cimag (cc)); + + cc = ccosh (ca); + fprintf (stdout, "ccosh : %f %fi\n", creal (cc), + cimag (cc)); + + cc = cexp (ca); + fprintf (stdout, "cexp : %f %fi\n", creal (cc), + cimag (cc)); + + f1 = cimag (ca); + fprintf (stdout, "cimag : %f\n", f1); + + cc = clog (ca); + fprintf (stdout, "clog : %f %fi\n", creal (cc), + cimag (cc)); + + cc = conj (ca); + fprintf (stdout, "conj : %f %fi\n", creal (cc), + cimag (cc)); + + cc = cpow (ca, cb); + fprintf (stdout, "cpow : %f %fi\n", creal (cc), + cimag (cc)); + + cc = cproj (ca); + fprintf (stdout, "cproj : %f %fi\n", creal (cc), + cimag (cc)); + + f1 = creal (ca); + fprintf (stdout, "creal : %f\n", f1); + + cc = csin (ca); + fprintf (stdout, "csin : %f %fi\n", creal (cc), + cimag (cc)); + + cc = csinh (ca); + fprintf (stdout, "csinh : %f %fi\n", creal (cc), + cimag (cc)); + + cc = csqrt (ca); + fprintf (stdout, "csqrt : %f %fi\n", creal (cc), + cimag (cc)); + + cc = ctan (ca); + fprintf (stdout, "ctan : %f %fi\n", creal (cc), + cimag (cc)); + + cc = ctanh (ca); + fprintf (stdout, "ctanh : %f %fi\n", creal (cc), + cimag (cc)); +#endif +} diff --git a/testsuites/libtests/complex/docomplex.in b/testsuites/libtests/complex/docomplex.in new file mode 100644 index 0000000000..e4fd94af7c --- /dev/null +++ b/testsuites/libtests/complex/docomplex.in @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2010 by + * Ralf Corsepius, Ulm/Germany. All rights reserved. + * + * Permission to use, copy, modify, and distribute this software + * is freely granted, provided that this notice is preserved. + */ + +/* + * Try to compile and link against POSIX complex math routines. + */ + +#include <complex.h> +#include <stdio.h> + +void +docomplex@FSUFFIX@ (void) +{ +#ifndef @FGUARD@ + complex @FTYPE@ ca, cb, cc; + @FTYPE@ f1; + + ca = 1.0 + 1.0 * I; + cb = 1.0 - 1.0 * I; + + f1 = cabs@FSUFFIX@ (ca); + fprintf (stdout, "cabs@FSUFFIX@ : %f\n", f1); + + cc = cacos@FSUFFIX@ (ca); + fprintf (stdout, "cacos@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = cacosh@FSUFFIX@ (ca); + fprintf (stdout, "cacosh@FSUFFIX@: %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + f1 = carg@FSUFFIX@ (ca); + fprintf (stdout, "carg@FSUFFIX@ : %f\n", f1); + + cc = casin@FSUFFIX@ (ca); + fprintf (stdout, "casin@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = casinh@FSUFFIX@ (ca); + fprintf (stdout, "casinh@FSUFFIX@: %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = catan@FSUFFIX@ (ca); + fprintf (stdout, "catan@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = catanh@FSUFFIX@ (ca); + fprintf (stdout, "catanh@FSUFFIX@: %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = ccos@FSUFFIX@ (ca); + fprintf (stdout, "ccos@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = ccosh@FSUFFIX@ (ca); + fprintf (stdout, "ccosh@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = cexp@FSUFFIX@ (ca); + fprintf (stdout, "cexp@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + f1 = cimag@FSUFFIX@ (ca); + fprintf (stdout, "cimag@FSUFFIX@ : %f\n", f1); + + cc = clog@FSUFFIX@ (ca); + fprintf (stdout, "clog@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = conj@FSUFFIX@ (ca); + fprintf (stdout, "conj@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = cpow@FSUFFIX@ (ca, cb); + fprintf (stdout, "cpow@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = cproj@FSUFFIX@ (ca); + fprintf (stdout, "cproj@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + f1 = creal@FSUFFIX@ (ca); + fprintf (stdout, "creal@FSUFFIX@ : %f\n", f1); + + cc = csin@FSUFFIX@ (ca); + fprintf (stdout, "csin@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = csinh@FSUFFIX@ (ca); + fprintf (stdout, "csinh@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = csqrt@FSUFFIX@ (ca); + fprintf (stdout, "csqrt@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = ctan@FSUFFIX@ (ca); + fprintf (stdout, "ctan@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); + + cc = ctanh@FSUFFIX@ (ca); + fprintf (stdout, "ctanh@FSUFFIX@ : %f %fi\n", creal@FSUFFIX@ (cc), + cimag@FSUFFIX@ (cc)); +#endif +} diff --git a/testsuites/libtests/complex/docomplexf.c b/testsuites/libtests/complex/docomplexf.c new file mode 100644 index 0000000000..4c07c7b43b --- /dev/null +++ b/testsuites/libtests/complex/docomplexf.c @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2010 by + * Ralf Corsepius, Ulm/Germany. All rights reserved. + * + * Permission to use, copy, modify, and distribute this software + * is freely granted, provided that this notice is preserved. + */ + +/* + * Try to compile and link against POSIX complex math routines. + */ + +#include <complex.h> +#include <stdio.h> + +void +docomplexf (void) +{ +#ifndef NO_FLOAT + complex float ca, cb, cc; + float f1; + + ca = 1.0 + 1.0 * I; + cb = 1.0 - 1.0 * I; + + f1 = cabsf (ca); + fprintf (stdout, "cabsf : %f\n", f1); + + cc = cacosf (ca); + fprintf (stdout, "cacosf : %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = cacoshf (ca); + fprintf (stdout, "cacoshf: %f %fi\n", crealf (cc), + cimagf (cc)); + + f1 = cargf (ca); + fprintf (stdout, "cargf : %f\n", f1); + + cc = casinf (ca); + fprintf (stdout, "casinf : %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = casinhf (ca); + fprintf (stdout, "casinhf: %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = catanf (ca); + fprintf (stdout, "catanf : %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = catanhf (ca); + fprintf (stdout, "catanhf: %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = ccosf (ca); + fprintf (stdout, "ccosf : %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = ccoshf (ca); + fprintf (stdout, "ccoshf : %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = cexpf (ca); + fprintf (stdout, "cexpf : %f %fi\n", crealf (cc), + cimagf (cc)); + + f1 = cimagf (ca); + fprintf (stdout, "cimagf : %f\n", f1); + + cc = clogf (ca); + fprintf (stdout, "clogf : %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = conjf (ca); + fprintf (stdout, "conjf : %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = cpowf (ca, cb); + fprintf (stdout, "cpowf : %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = cprojf (ca); + fprintf (stdout, "cprojf : %f %fi\n", crealf (cc), + cimagf (cc)); + + f1 = crealf (ca); + fprintf (stdout, "crealf : %f\n", f1); + + cc = csinf (ca); + fprintf (stdout, "csinf : %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = csinhf (ca); + fprintf (stdout, "csinhf : %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = csqrtf (ca); + fprintf (stdout, "csqrtf : %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = ctanf (ca); + fprintf (stdout, "ctanf : %f %fi\n", crealf (cc), + cimagf (cc)); + + cc = ctanhf (ca); + fprintf (stdout, "ctanhf : %f %fi\n", crealf (cc), + cimagf (cc)); +#endif +} diff --git a/testsuites/libtests/complex/docomplexl.c b/testsuites/libtests/complex/docomplexl.c new file mode 100644 index 0000000000..7351a08ac0 --- /dev/null +++ b/testsuites/libtests/complex/docomplexl.c @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2010 by + * Ralf Corsepius, Ulm/Germany. All rights reserved. + * + * Permission to use, copy, modify, and distribute this software + * is freely granted, provided that this notice is preserved. + */ + +/* + * Try to compile and link against POSIX complex math routines. + */ + +#include <complex.h> +#include <stdio.h> + +void +docomplexl (void) +{ +#ifndef NO_LONG_DOUBLE + complex long double ca, cb, cc; + long double f1; + + ca = 1.0 + 1.0 * I; + cb = 1.0 - 1.0 * I; + + f1 = cabsl (ca); + fprintf (stdout, "cabsl : %Lf\n", f1); + + cc = cacosl (ca); + fprintf (stdout, "cacosl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = cacoshl (ca); + fprintf (stdout, "cacoshl: %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + f1 = cargl (ca); + fprintf (stdout, "cargl : %Lf\n", f1); + + cc = casinl (ca); + fprintf (stdout, "casinl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = casinhl (ca); + fprintf (stdout, "casinhl: %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = catanl (ca); + fprintf (stdout, "catanl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = catanhl (ca); + fprintf (stdout, "catanhl: %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = ccosl (ca); + fprintf (stdout, "ccosl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = ccoshl (ca); + fprintf (stdout, "ccoshl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = cexpl (ca); + fprintf (stdout, "cexpl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + f1 = cimagl (ca); + fprintf (stdout, "cimagl : %Lf\n", f1); + + cc = clogl (ca); + fprintf (stdout, "clogl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = conjl (ca); + fprintf (stdout, "conjl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = cpowl (ca, cb); + fprintf (stdout, "cpowl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = cprojl (ca); + fprintf (stdout, "cprojl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + f1 = creall (ca); + fprintf (stdout, "creall : %Lf\n", f1); + + cc = csinl (ca); + fprintf (stdout, "csinl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = csinhl (ca); + fprintf (stdout, "csinhl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = csqrtl (ca); + fprintf (stdout, "csqrtl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = ctanl (ca); + fprintf (stdout, "ctanl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); + + cc = ctanhl (ca); + fprintf (stdout, "ctanhl : %Lf %Lfi\n", creall (cc), + cimagl (cc)); +#endif +} diff --git a/testsuites/libtests/complex/init.c b/testsuites/libtests/complex/init.c new file mode 100644 index 0000000000..7f132f40a8 --- /dev/null +++ b/testsuites/libtests/complex/init.c @@ -0,0 +1,67 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is called from init_exec and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#if __rtems__ +#include <bsp.h> /* for device driver prototypes */ +#endif + +#include <stdio.h> +#include <stdlib.h> + +extern void docomplex(void); +extern void docomplexf(void); +#ifndef NO_LONG_DOUBLE +extern void docomplexl(void); +#endif + +#if __rtems__ +rtems_task Init( + rtems_task_argument ignored +) +#else +int main( void ) +#endif +{ + printf( "*** COMPLEX MATH TEST ***\n" ); + + docomplex(); + docomplexf(); +#ifndef NO_LONG_DOUBLE + docomplexl(); +#endif + printf( "*** END OF COMPLEX MATH TEST ***\n" ); + exit( 0 ); +} + +#if __rtems__ +/* NOTICE: the clock driver is explicitly disabled */ +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT +#include <rtems/confdefs.h> +#endif |