From: <de...@us...> - 2003-02-21 16:30:11
|
Update of /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/telemac In directory sc8-pr-cvs1:/tmp/cvs-serv28615/dodico/src/org/fudaa/dodico/test/telemac Modified Files: TestSerafin.java TestSinusx.java Log Message: Modifs mineures Index: TestSerafin.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/telemac/TestSerafin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestSerafin.java 29 Jan 2003 12:14:44 -0000 1.1 --- TestSerafin.java 21 Feb 2003 16:30:07 -0000 1.2 *************** *** 15,19 **** import org.fudaa.dodico.commun.DodicoLib; import org.fudaa.dodico.fortran.*; ! import org.fudaa.dodico.telemac.*; import org.fudaa.dodico.mnt.*; /** --- 15,20 ---- import org.fudaa.dodico.commun.DodicoLib; import org.fudaa.dodico.fortran.*; ! import org.fudaa.dodico.tr.*; ! import org.fudaa.dodico.tr.telemac.*; import org.fudaa.dodico.mnt.*; /** *************** *** 22,27 **** */ ! public class TestSerafin ! extends TestCase { --- 23,27 ---- */ ! public class TestSerafin extends TestCase { *************** *** 30,43 **** SerafinInterface t_; - /** */ public TestSerafin() { eps_ = 1E-15; ! t_=lecture(getFile("exemple.res")); } - - /** * @param _f --- 30,40 ---- SerafinInterface t_; /** */ public TestSerafin() { eps_ = 1E-15; ! t_ = lecture(getFile("exemple.res")); } /** * @param _f *************** *** 46,56 **** private File getFile(String _f) { ! URL url = getClass().getResource(_f); ! if(url == null) return null; return new File(url.getPath()); } - /** * Lit le fichier passe en argument. --- 43,52 ---- private File getFile(String _f) { ! URL url = getClass().getResource(_f); ! if (url == null) return null; return new File(url.getPath()); } /** * Lit le fichier passe en argument. *************** *** 62,77 **** try { ! File fic = new File(args[args.length - 1]); ! InputStream in = new FileInputStream(fic); ! SerafinReader t = new SerafinReader(in); System.out.println(""); System.out.println("les champs"); System.out.println(""); ! DodicoLib.printStringArray(t.read()); in.close(); ! DodicoLib.printFields(t, false); } ! catch(IOException _e) { _e.printStackTrace(); --- 58,74 ---- try { ! File fic = new File(args[args.length - 1]); ! InputStream in = new FileInputStream(fic); ! SerafinReader t = new SerafinReader(in); System.out.println(""); System.out.println("les champs"); System.out.println(""); ! SerafinInterface si = t.read(); ! DodicoLib.printStringArray(t.getMessages()); in.close(); ! DodicoLib.printFields(si, false); } ! catch (IOException _e) { _e.printStackTrace(); *************** *** 80,96 **** } ! ! private final static SerafinInterface lecture(File _f) { ! SerafinReader t=null; try { assertNotNull(_f); ! InputStream in = new FileInputStream(_f); ! t = new SerafinReader(in); ! t.read(); in.close(); } ! catch(IOException _e) { _e.printStackTrace(); --- 77,91 ---- } ! private final static synchronized SerafinInterface lecture(File _f) { ! SerafinInterface t = null; try { assertNotNull(_f); ! InputStream in = new FileInputStream(_f); ! t = new SerafinReader(in).read(); in.close(); } ! catch (IOException _e) { _e.printStackTrace(); *************** *** 103,111 **** assertNotNull(t_); //TITRE ! assertEquals(t_.getTitre(), "MODELE MARITIME - CALCUL1 SERAPHIN"); //NBV1 assertEquals(t_.getNbv1(), 6); //TEXT ! String temp = t_.getNomVariables(0); assertEquals(temp, "VITESSE U"); temp = t_.getNomVariables(5); --- 98,108 ---- assertNotNull(t_); //TITRE ! assertEquals( ! t_.getTitre(), ! "MODELE MARITIME - CALCUL1 SERAPHIN"); //NBV1 assertEquals(t_.getNbv1(), 6); //TEXT ! String temp = t_.getNomVariables(0); assertEquals(temp, "VITESSE U"); temp = t_.getNomVariables(5); *************** *** 127,149 **** assertEquals(t_.getNppel1(), 3); //IKLE1 ! assertEquals(t_.getIkle1(0,1), 1546); ! assertEquals(t_.getIkle1(t_.getNelem1()-1,0), 220); //IPOBO1 assertEquals(t_.getIpobo1(4), 1); //X1 ! assertEquals(t_.getX1(9), (double)Float.intBitsToFloat(1160462115), eps_); //Y1 ! assertEquals(t_.getY1(11), (double)Float.intBitsToFloat(1140111573), eps_); //Nombre de pas temps ! int tempInt = t_.getNbPasTemps(); assertEquals(tempInt, 2); ! double tempDouble = t_.getPasTemps()[1]; ! assertEquals(tempDouble, (double)Float.intBitsToFloat(1153138688), eps_); //pas de temps 1, variable 3 //premiere variable ! assertEquals(t_.getDonnees(0, 2,0), (double)Float.intBitsToFloat(1076258406), eps_); //pas de temps 2, variable 4 //derniere variable ! assertEquals(t_.getDonnees(1, 3,t_.getNpoin1() - 1), (double)Float.intBitsToFloat(1093124747), eps_); } --- 124,152 ---- assertEquals(t_.getNppel1(), 3); //IKLE1 ! assertEquals(t_.getIkle1(0, 1), 1546); ! assertEquals(t_.getIkle1(t_.getNelem1() - 1, 0), 220); //IPOBO1 assertEquals(t_.getIpobo1(4), 1); //X1 ! assertEquals(t_.getX1(9), (double) Float.intBitsToFloat(1160462115), eps_); //Y1 ! assertEquals(t_.getY1(11), (double) Float.intBitsToFloat(1140111573), eps_); //Nombre de pas temps ! int tempInt = t_.getNbPasDeTemps(); assertEquals(tempInt, 2); ! double tempDouble = t_.getPasDeTemps()[1]; ! assertEquals(tempDouble, (double) Float.intBitsToFloat(1153138688), eps_); //pas de temps 1, variable 3 //premiere variable ! assertEquals( ! t_.getDonnees(0, 2, 0), ! (double) Float.intBitsToFloat(1076258406), ! eps_); //pas de temps 2, variable 4 //derniere variable ! assertEquals( ! t_.getDonnees(1, 3, t_.getNpoin1() - 1), ! (double) Float.intBitsToFloat(1093124747), ! eps_); } *************** *** 151,167 **** public void testEcriture() { ! File f = null; try { f = File.createTempFile("testSerafin", ".ser"); assertNotNull(f); ! OutputStream out=new FileOutputStream(f); ! SerafinWriter w = new SerafinWriter(t_,out); ! String[] r=w.write(); assertNull(r); ! t_=lecture(f); testLecture(); } ! catch(Exception _e) { fail(_e.toString()); --- 154,170 ---- public void testEcriture() { ! File f = null; try { f = File.createTempFile("testSerafin", ".ser"); assertNotNull(f); ! OutputStream out = new FileOutputStream(f); ! SerafinWriter w = new SerafinWriter(t_, out); ! String[] r = w.write(); assertNull(r); ! t_ = lecture(f); testLecture(); } ! catch (Exception _e) { fail(_e.toString()); *************** *** 169,202 **** finally { ! if(f != null) f.delete(); } } ! public void testMntAdapter() { assertNotNull(t_); ! int id=SerafinMNTAdapter.getIndex(t_, "HAUTEUR D'EAU"); ! assertEquals(id,2); ! SerafinMNTAdapter a=new SerafinMNTAdapter(t_,id,0); try { ! String[] r=a.read(); ! System.out.println("la conversion"); ! DodicoLib.printStringArray(r); assertNull(r); ! MNTZone[] zones= a.getMNTZones(); assertNotNull(zones); assertNotNull(zones[0]); ! MNTSemis semis=zones[0].getSemis(); assertNotNull(semis); //X1 ! assertEquals(semis.getX(9), (double)Float.intBitsToFloat(1160462115), eps_); //Y1 ! assertEquals(semis.getY(11), (double)Float.intBitsToFloat(1140111573), eps_); ! assertEquals(semis.getZ(0), (double)Float.intBitsToFloat(1076258406), eps_); } ! catch(Exception _e) { _e.printStackTrace(); --- 172,214 ---- finally { ! if (f != null) f.delete(); } } ! public void testMntAdapter() { assertNotNull(t_); ! int id = SerafinMNTAdapter.getIndex(t_, "HAUTEUR D'EAU"); ! assertEquals(id, 2); ! SerafinMNTAdapter a = new SerafinMNTAdapter(t_, id, 0); try { ! String[] r = a.read(); ! if (r != null) ! DodicoLib.printStringArray(r); assertNull(r); ! MNTZone[] zones = a.getMNTZones(); assertNotNull(zones); assertNotNull(zones[0]); ! MNTSemis semis = zones[0].getSemis(); assertNotNull(semis); //X1 ! assertEquals( ! semis.getX(9), ! (double) Float.intBitsToFloat(1160462115), ! eps_); //Y1 ! assertEquals( ! semis.getY(11), ! (double) Float.intBitsToFloat(1140111573), ! eps_); ! assertEquals( ! semis.getZ(0), ! (double) Float.intBitsToFloat(1076258406), ! eps_); } ! catch (Exception _e) { _e.printStackTrace(); *************** *** 206,209 **** } - - --- 218,219 ---- Index: TestSinusx.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/dodico/src/org/fudaa/dodico/test/telemac/TestSinusx.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TestSinusx.java 29 Jan 2003 12:14:44 -0000 1.1 --- TestSinusx.java 21 Feb 2003 16:30:07 -0000 1.2 *************** *** 18,22 **** import org.fudaa.dodico.mnt.*; ! import org.fudaa.dodico.telemac.*; /** --- 18,23 ---- import org.fudaa.dodico.mnt.*; ! import org.fudaa.dodico.tr.*; ! import org.fudaa.dodico.tr.telemac.*; /** |