* 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.
This commit is contained in:
parent
ded99cd9e9
commit
5b7863e305
|
|
@ -1,3 +1,9 @@
|
|||
2000-05-30 Arno W. Peters <A.W.Peters@ieee.org>
|
||||
|
||||
* 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 <A.W.Peters@ieee.org>
|
||||
|
||||
* src/circuit/inp2dot.c: First refactoring of INP2dot into smaller
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include <memory.h>
|
||||
#include <dvec.h>
|
||||
#include <complex.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include <memory.h>
|
||||
#include <dvec.h>
|
||||
#include <complex.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
Loading…
Reference in New Issue