diff --git a/ChangeLog b/ChangeLog index 1413f7f0f..46b5a054a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-05-30 Arno W. Peters + + * src/maths/cmaths/Makefile.am, src/maths/cmaths/test_cx_mag.c, + src/maths/cmaths/test_cx_j.c: Added first testcases for complex + math library. + 2000-05-25 Arno W. Peters * src/circuit/inp2dot.c: First refactoring of INP2dot into smaller diff --git a/src/maths/cmaths/Makefile.am b/src/maths/cmaths/Makefile.am index 7e537b462..8b4be8474 100644 --- a/src/maths/cmaths/Makefile.am +++ b/src/maths/cmaths/Makefile.am @@ -12,7 +12,23 @@ libcmaths_a_SOURCES = \ cmath4.c \ cmath4.h +bin_PROGRAMS = test_cx_mag test_cx_j +test_cx_mag_SOURCES = \ + test_cx_mag.c + +test_cx_mag_LDADD = \ + libcmaths.a \ + ../../misc/libmisc.a + +test_cx_j_SOURCES = \ + test_cx_j.c + +test_cx_j_LDADD = \ + libcmaths.a \ + ../../misc/libmisc.a + +TESTS = test_cx_mag test_cx_j INCLUDES = -I$(top_srcdir)/src/include -I$(top_srcdir)/src/maths/poly diff --git a/src/maths/cmaths/test_cx_j.c b/src/maths/cmaths/test_cx_j.c new file mode 100644 index 000000000..e2c0a7adf --- /dev/null +++ b/src/maths/cmaths/test_cx_j.c @@ -0,0 +1,32 @@ +#include + +#include +#include +#include + +#include "cmath1.h" + +FILE *cp_err; + +int +main(void) +{ + complex *c = NULL; + complex *d = NULL; + short int t1; + short int t2; + int n1; + int n2; + + cp_err = stderr; + n1 = 1; + t1 = VF_COMPLEX; + c = alloc_c(n1); + realpart(&c[0]) = .0; + imagpart(&c[0]) = 1.0; + d = (complex *) cx_j((void *) c, t1, n1, &n2, &t2); + if (realpart(&d[0]) == -1 && imagpart(&d[0]) == 0) + return 0; + else + return 1; +} diff --git a/src/maths/cmaths/test_cx_mag.c b/src/maths/cmaths/test_cx_mag.c new file mode 100644 index 000000000..8ee327c6c --- /dev/null +++ b/src/maths/cmaths/test_cx_mag.c @@ -0,0 +1,32 @@ +#include + +#include +#include +#include + +#include "cmath1.h" + +FILE *cp_err; + +int +main(void) +{ + complex *c = NULL; + double *d = NULL; + short int t1; + short int t2; + int n1; + int n2; + + cp_err = stderr; + n1 = 1; + t1 = VF_COMPLEX; + c = alloc_c(n1); + realpart(&c[0]) = .0; + imagpart(&c[0]) = 1.0; + d = (double *) cx_mag((void *) c, t1, n1, &n2, &t2); + if (d[0] == 1) + return 0; + else + return 1; +}