summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsimon2008-07-04 09:20:30 +0000
committersimon2008-07-04 09:20:30 +0000
commit971c703d0ed71d4b21a86d78ab79042ae0df5f8f (patch)
treefb5ad6aaaaa5d7d8294fad89fff1e6639dcf6cee /src
parenta1af47f017abe7a9bac370e0f1cd2eb0b8bc8ff7 (diff)
downloadscilab2c-971c703d0ed71d4b21a86d78ab79042ae0df5f8f.tar.gz
scilab2c-971c703d0ed71d4b21a86d78ab79042ae0df5f8f.tar.bz2
scilab2c-971c703d0ed71d4b21a86d78ab79042ae0df5f8f.zip
added testString and modified convertion functions in order to suit to
the good format
Diffstat (limited to 'src')
-rw-r--r--src/string/string/Makefile.am13
-rw-r--r--src/string/string/Makefile.in83
-rw-r--r--src/string/string/cstrings.c2
-rw-r--r--src/string/string/dstrings.c2
-rw-r--r--src/string/string/sstrings.c2
-rw-r--r--src/string/string/testString.c241
-rw-r--r--src/string/string/zstrings.c2
7 files changed, 276 insertions, 69 deletions
diff --git a/src/string/string/Makefile.am b/src/string/string/Makefile.am
index 9c503953..9dfe3ef4 100644
--- a/src/string/string/Makefile.am
+++ b/src/string/string/Makefile.am
@@ -39,17 +39,14 @@ check_LDADD = $(top_builddir)/type/libDoubleComplex.la \
$(top_builddir)/type/libFloatComplex.la \
$(top_builddir)/string/string/libString.la
-check_PROGRAMS = testFloatString testDoubleString
+check_PROGRAMS = testString
-TESTS = testFloatString testDoubleString
+TESTS = testString
#
# -*- Dispine Tests -*-
#
-testFloatString_SOURCES = testString.h testFloatString.c
-testFloatString_CFLAGS = $(check_INCLUDES)
-testFloatString_LDADD = $(check_LDADD)
+testString_SOURCES = testString.c
+testString_CFLAGS = $(check_INCLUDES)
+testString_LDADD = $(check_LDADD)
-testDoubleString_SOURCES = testString.h testDoubleString.c
-testDoubleString_CFLAGS = $(check_INCLUDES)
-testDoubleString_LDADD = $(check_LDADD)
diff --git a/src/string/string/Makefile.in b/src/string/string/Makefile.in
index f9f543bf..b4ccfda3 100644
--- a/src/string/string/Makefile.in
+++ b/src/string/string/Makefile.in
@@ -32,8 +32,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-check_PROGRAMS = testFloatString$(EXEEXT) testDoubleString$(EXEEXT)
-TESTS = testFloatString$(EXEEXT) testDoubleString$(EXEEXT)
+check_PROGRAMS = testString$(EXEEXT)
+TESTS = testString$(EXEEXT)
subdir = string/string
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -63,19 +63,11 @@ libString_la_OBJECTS = $(am_libString_la_OBJECTS)
libString_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libString_la_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-am_testDoubleString_OBJECTS = \
- testDoubleString-testDoubleString.$(OBJEXT)
-testDoubleString_OBJECTS = $(am_testDoubleString_OBJECTS)
-testDoubleString_DEPENDENCIES = $(check_LDADD)
-testDoubleString_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testDoubleString_CFLAGS) \
- $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-am_testFloatString_OBJECTS = \
- testFloatString-testFloatString.$(OBJEXT)
-testFloatString_OBJECTS = $(am_testFloatString_OBJECTS)
-testFloatString_DEPENDENCIES = $(check_LDADD)
-testFloatString_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testFloatString_CFLAGS) \
+am_testString_OBJECTS = testString-testString.$(OBJEXT)
+testString_OBJECTS = $(am_testString_OBJECTS)
+testString_DEPENDENCIES = $(check_LDADD)
+testString_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(testString_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/includes
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
@@ -89,10 +81,8 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(libString_la_SOURCES) $(testDoubleString_SOURCES) \
- $(testFloatString_SOURCES)
-DIST_SOURCES = $(libString_la_SOURCES) $(testDoubleString_SOURCES) \
- $(testFloatString_SOURCES)
+SOURCES = $(libString_la_SOURCES) $(testString_SOURCES)
+DIST_SOURCES = $(libString_la_SOURCES) $(testString_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -236,12 +226,9 @@ check_LDADD = $(top_builddir)/type/libDoubleComplex.la \
#
# -*- Dispine Tests -*-
#
-testFloatString_SOURCES = testString.h testFloatString.c
-testFloatString_CFLAGS = $(check_INCLUDES)
-testFloatString_LDADD = $(check_LDADD)
-testDoubleString_SOURCES = testString.h testDoubleString.c
-testDoubleString_CFLAGS = $(check_INCLUDES)
-testDoubleString_LDADD = $(check_LDADD)
+testString_SOURCES = testString.c
+testString_CFLAGS = $(check_INCLUDES)
+testString_LDADD = $(check_LDADD)
all: all-am
.SUFFIXES:
@@ -311,12 +298,9 @@ clean-checkPROGRAMS:
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
-testDoubleString$(EXEEXT): $(testDoubleString_OBJECTS) $(testDoubleString_DEPENDENCIES)
- @rm -f testDoubleString$(EXEEXT)
- $(testDoubleString_LINK) $(testDoubleString_OBJECTS) $(testDoubleString_LDADD) $(LIBS)
-testFloatString$(EXEEXT): $(testFloatString_OBJECTS) $(testFloatString_DEPENDENCIES)
- @rm -f testFloatString$(EXEEXT)
- $(testFloatString_LINK) $(testFloatString_OBJECTS) $(testFloatString_LDADD) $(LIBS)
+testString$(EXEEXT): $(testString_OBJECTS) $(testString_DEPENDENCIES)
+ @rm -f testString$(EXEEXT)
+ $(testString_LINK) $(testString_OBJECTS) $(testString_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -332,8 +316,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libString_la-sstrings.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libString_la-zstringa.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libString_la-zstrings.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testDoubleString-testDoubleString.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testFloatString-testFloatString.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testString-testString.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -412,33 +395,19 @@ libString_la-zstringa.lo: zstringa.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libString_la_CFLAGS) $(CFLAGS) -c -o libString_la-zstringa.lo `test -f 'zstringa.c' || echo '$(srcdir)/'`zstringa.c
-testDoubleString-testDoubleString.o: testDoubleString.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleString_CFLAGS) $(CFLAGS) -MT testDoubleString-testDoubleString.o -MD -MP -MF $(DEPDIR)/testDoubleString-testDoubleString.Tpo -c -o testDoubleString-testDoubleString.o `test -f 'testDoubleString.c' || echo '$(srcdir)/'`testDoubleString.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testDoubleString-testDoubleString.Tpo $(DEPDIR)/testDoubleString-testDoubleString.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleString.c' object='testDoubleString-testDoubleString.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleString_CFLAGS) $(CFLAGS) -c -o testDoubleString-testDoubleString.o `test -f 'testDoubleString.c' || echo '$(srcdir)/'`testDoubleString.c
-
-testDoubleString-testDoubleString.obj: testDoubleString.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleString_CFLAGS) $(CFLAGS) -MT testDoubleString-testDoubleString.obj -MD -MP -MF $(DEPDIR)/testDoubleString-testDoubleString.Tpo -c -o testDoubleString-testDoubleString.obj `if test -f 'testDoubleString.c'; then $(CYGPATH_W) 'testDoubleString.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleString.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testDoubleString-testDoubleString.Tpo $(DEPDIR)/testDoubleString-testDoubleString.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testDoubleString.c' object='testDoubleString-testDoubleString.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testDoubleString_CFLAGS) $(CFLAGS) -c -o testDoubleString-testDoubleString.obj `if test -f 'testDoubleString.c'; then $(CYGPATH_W) 'testDoubleString.c'; else $(CYGPATH_W) '$(srcdir)/testDoubleString.c'; fi`
-
-testFloatString-testFloatString.o: testFloatString.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatString_CFLAGS) $(CFLAGS) -MT testFloatString-testFloatString.o -MD -MP -MF $(DEPDIR)/testFloatString-testFloatString.Tpo -c -o testFloatString-testFloatString.o `test -f 'testFloatString.c' || echo '$(srcdir)/'`testFloatString.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatString-testFloatString.Tpo $(DEPDIR)/testFloatString-testFloatString.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatString.c' object='testFloatString-testFloatString.o' libtool=no @AMDEPBACKSLASH@
+testString-testString.o: testString.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testString_CFLAGS) $(CFLAGS) -MT testString-testString.o -MD -MP -MF $(DEPDIR)/testString-testString.Tpo -c -o testString-testString.o `test -f 'testString.c' || echo '$(srcdir)/'`testString.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testString-testString.Tpo $(DEPDIR)/testString-testString.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testString.c' object='testString-testString.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatString_CFLAGS) $(CFLAGS) -c -o testFloatString-testFloatString.o `test -f 'testFloatString.c' || echo '$(srcdir)/'`testFloatString.c
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testString_CFLAGS) $(CFLAGS) -c -o testString-testString.o `test -f 'testString.c' || echo '$(srcdir)/'`testString.c
-testFloatString-testFloatString.obj: testFloatString.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatString_CFLAGS) $(CFLAGS) -MT testFloatString-testFloatString.obj -MD -MP -MF $(DEPDIR)/testFloatString-testFloatString.Tpo -c -o testFloatString-testFloatString.obj `if test -f 'testFloatString.c'; then $(CYGPATH_W) 'testFloatString.c'; else $(CYGPATH_W) '$(srcdir)/testFloatString.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testFloatString-testFloatString.Tpo $(DEPDIR)/testFloatString-testFloatString.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testFloatString.c' object='testFloatString-testFloatString.obj' libtool=no @AMDEPBACKSLASH@
+testString-testString.obj: testString.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testString_CFLAGS) $(CFLAGS) -MT testString-testString.obj -MD -MP -MF $(DEPDIR)/testString-testString.Tpo -c -o testString-testString.obj `if test -f 'testString.c'; then $(CYGPATH_W) 'testString.c'; else $(CYGPATH_W) '$(srcdir)/testString.c'; fi`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/testString-testString.Tpo $(DEPDIR)/testString-testString.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testString.c' object='testString-testString.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testFloatString_CFLAGS) $(CFLAGS) -c -o testFloatString-testFloatString.obj `if test -f 'testFloatString.c'; then $(CYGPATH_W) 'testFloatString.c'; else $(CYGPATH_W) '$(srcdir)/testFloatString.c'; fi`
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testString_CFLAGS) $(CFLAGS) -c -o testString-testString.obj `if test -f 'testString.c'; then $(CYGPATH_W) 'testString.c'; else $(CYGPATH_W) '$(srcdir)/testString.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
diff --git a/src/string/string/cstrings.c b/src/string/string/cstrings.c
index ac524edd..57e562c8 100644
--- a/src/string/string/cstrings.c
+++ b/src/string/string/cstrings.c
@@ -17,6 +17,6 @@ void cstrings (floatComplex in, char* out) {
float RealIn = creals(in);
float ImgIn = cimags(in);
- sprintf ( out, "%e + %ei" ,RealIn ,ImgIn );
+ sprintf ( out, "%5.20e + %5.20ei" ,RealIn ,ImgIn );
}
diff --git a/src/string/string/dstrings.c b/src/string/string/dstrings.c
index 702ec523..46720b9e 100644
--- a/src/string/string/dstrings.c
+++ b/src/string/string/dstrings.c
@@ -15,5 +15,5 @@
void dstrings (double in, char* out) {
- sprintf (out, "%e" ,in );
+ sprintf (out, "%5.20e" ,in );
}
diff --git a/src/string/string/sstrings.c b/src/string/string/sstrings.c
index 43da041c..365833b4 100644
--- a/src/string/string/sstrings.c
+++ b/src/string/string/sstrings.c
@@ -15,5 +15,5 @@
void sstrings (float in, char* out) {
- sprintf (out, "%e" ,in );
+ sprintf (out, "%5.20e" ,in );
}
diff --git a/src/string/string/testString.c b/src/string/string/testString.c
new file mode 100644
index 00000000..6106cb65
--- /dev/null
+++ b/src/string/string/testString.c
@@ -0,0 +1,241 @@
+/*
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008-2008 - INRIA - Allan Simon
+ *
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <assert.h>
+#include <math.h>
+#include "string.h"
+
+#define SIZE 10000
+
+/*
+** \test pour les float s
+*/
+static void sstringaTest (void) {
+ float tabF[SIZE];
+ float tabF2[SIZE];
+ char** tabC = NULL ;
+ int i = 0 ;
+
+ printf("\n>>>> sstringaTest Tests\n");
+
+ tabC = malloc( SIZE *sizeof(char*));
+
+ for ( i=0;i< SIZE ; ++i )
+ {
+ tabC[i] = (char *)malloc( 26 * sizeof(char));
+ }
+
+ srand( 1 ) ;
+
+ for ( i = 0 ; i < SIZE ; ++i)
+ {
+ tabF[i] = (float) rand () ;
+ }
+
+/* appel de la fonction à tester */
+ sstringa ( tabF , SIZE , tabC ) ;
+
+/* on reconvertit dans le sens inverse */
+ for ( i = 0 ; i < SIZE ; ++i)
+ {
+ sscanf ( tabC[i] , "%e" , &(tabF2[i]) ) ;
+ }
+
+/* et on compare si les floatants initiaux et finaux sont identiques ,
+ à une marge d'erreur pres à cause de l'epsilon machine */
+
+ for ( i = 0 ; i < SIZE ; ++i)
+ {
+ assert ( fabs( tabF[i] - tabF2[i]) / ( fabs ( tabF[i] )) < 1e-07 ) ;
+ }
+
+
+
+}
+
+
+/*
+** \test pour les double s
+*/
+
+static void dstringaTest (void) {
+ double tabD[SIZE];
+ double tabD2[SIZE];
+ char** tabC = NULL ;
+ int i = 0 ;
+
+ srand( 1 ) ;
+
+ printf("\n>>>> dstringaTest Tests\n");
+
+ tabC = malloc( SIZE *sizeof(char*));
+
+ for ( i=0;i< SIZE ; ++i )
+ {
+ tabC[i] = (char *)malloc( 26 * sizeof(char));
+ }
+
+
+ for ( i = 0 ; i < SIZE ; ++i)
+ {
+ tabD[i] = (double) rand () ;
+ }
+
+/* appel de la fonction à tester sstringa ( tabD , SIZE , tabC ) ; */
+
+ dstringa ( tabD , SIZE , tabC ) ;
+/* on reconvertit dans le sens inverse */
+ for ( i = 0 ; i < SIZE ; ++i)
+ {
+
+ tabD2[i] = strtod (tabC[i] , NULL);
+
+ }
+
+/* et on compare si les floatants initiaux et finaux sont identique ,
+ à une marge d'erreur pres à cause de l'epsilon machine*/
+
+ for ( i = 0 ; i < SIZE ; ++i)
+ {
+ assert ( fabs( tabD[i] - tabD2[i]) / ( fabs ( tabD[i] )) < 1e-16 ) ;
+ }
+
+
+
+}
+
+
+/*
+** \test pour les float c
+*/
+
+static void cstringaTest (void) {
+ floatComplex tabF[SIZE];
+ floatComplex tabF2[SIZE] ;
+ float img ;
+ float real ;
+ char** tabC = NULL ;
+
+ int i = 0 ;
+
+ srand( 1 ) ;
+
+ printf("\n>>>> cstringaTest Tests\n");
+ tabC = malloc( SIZE *sizeof(char*));
+
+ for ( i=0;i< SIZE ; ++i )
+ {
+ tabC[i] = (char *)malloc( 53 * sizeof(char));
+ }
+
+ for ( i = 0 ; i < SIZE ; ++i)
+ {
+ tabF[i] = FloatComplex ((float) rand (), (float) rand());
+ }
+
+/* appel de la fonction à tester */
+ cstringa ( tabF , SIZE , tabC ) ;
+
+/* on reconvertit dans le sens inverse */
+ for ( i = 0 ; i < SIZE ; ++i)
+ {
+ sscanf (tabC[i] , "%e + %e" , &real , &img );
+
+
+ tabF2[i] = FloatComplex (real ,img );
+ }
+
+/* et on compare si les floats initiaux et finaux sont identique ,
+ à une marge d'erreur pres à cause de l'epsilon machine */
+
+ for ( i = 0 ; i < SIZE ; ++i)
+ {
+ assert ( fabs( creals(tabF2[i]) - creals (tabF[i]) ) / fabs (creals (tabF[i])) < 1e-07 );
+ assert ( fabs( cimags(tabF2[i]) - cimags (tabF[i]) ) / fabs (cimags (tabF[i])) < 1e-07 ) ;
+ }
+
+
+
+}
+
+
+/*
+** \test pour les doubles 07
+*/
+static void zstringaTest (void) {
+ doubleComplex tabD[SIZE];
+ doubleComplex tabD2[SIZE] ;
+ double img ;
+ double real ;
+ char* temp = NULL ;
+ char** tabC = NULL ;
+
+ int i = 0 ;
+
+ srand( 1 ) ;
+
+ printf("\n>>>> zstringaTest Tests\n");
+
+ tabC = malloc( SIZE *sizeof(char*));
+
+ for ( i=0;i< SIZE ; ++i )
+ {
+ tabC[i] = (char *)malloc( 53 * sizeof(char));
+ }
+
+
+ for ( i = 0 ; i < SIZE ; ++i)
+ {
+ tabD[i] = DoubleComplex ((double) rand (), (double) rand());
+ }
+
+/* appel de la fonction à tester*/
+ zstringa ( tabD , SIZE , tabC ) ;
+
+/* on reconvertit dans le sens inverse*/
+ for ( i = 0 ; i < SIZE ; ++i)
+ {
+ real = (double) strtod (tabC[i] ,&temp );
+ img = (double) strtod (temp + 3 ,NULL );
+
+ tabD2[i] = DoubleComplex (real ,img );
+ }
+
+/* et on compare si les doubles initiaux et finaux sont identique ,
+ à une marge d'erreur pres à cause de l'epsilon machine */
+
+ for ( i = 0 ; i < SIZE ; ++i)
+ {
+ assert ( fabs( zreals(tabD2[i]) - zreals (tabD[i]) ) / fabs (zreals (tabD[i])) < 1e-16 );
+ assert ( fabs( zimags(tabD2[i]) - zimags (tabD[i]) ) / fabs (zimags (tabD[i])) < 1e-16 );
+ }
+
+
+}
+
+static int testString (void) {
+
+ printf("\n>>>> String Tests\n");
+ sstringaTest();
+ dstringaTest();
+ cstringaTest();
+ zstringaTest();
+
+ return 0;
+}
+
+int main(void) {
+ assert(testString() == 0);
+ return 0;
+}
diff --git a/src/string/string/zstrings.c b/src/string/string/zstrings.c
index f6b593b9..1423d7a1 100644
--- a/src/string/string/zstrings.c
+++ b/src/string/string/zstrings.c
@@ -18,5 +18,5 @@ void zstrings (doubleComplex in, char* out) {
double RealIn = zreals(in);
double ImgIn = zimags(in);
- sprintf (out, "%e + %ei" ,RealIn ,ImgIn );
+ sprintf (out, "%5.20e + %5.20ei" ,RealIn ,ImgIn );
}