//*********************************************************************************
// class TestTig default package
// Software released under the General Public License (version 2 or later), available at
// http://www.gnu.org/copyleft/gpl.html
//*********************************************************************************
import tig.*;
import java.util.*;
import java.io.*;
/** Class containing methods to test tig methods */
public class TestTig implements GeneralConstants{
public static void main(String[] args){
try{
testPrefs();
//testDebug();
//testJdToDate(args[0]);
//testTigBundle();
System.exit(0);
}catch(Exception e){
System.out.println("Exception in main TestTig : " + e.getMessage() + "\n");
e.printStackTrace();
}// end try-catch
}// end main()
//*****************************************************
public static void testPrefs() throws IOException{
TigPrefs tp = new TigPrefs();
boolean bool=true;
int[] intArray={1, 3, 5, 6};
int i = -764;
double d = -6534.98;
tp.setBooleanProperty("bool", bool);
tp.setIntArrayProperty("intArray", intArray);
tp.setIntProperty("i", i);
tp.setDoubleProperty("d", d);
System.out.println("bool : " + tp.getProperty("bool"));
System.out.println("intArray : " + tp.getProperty("intArray"));
System.out.println("i : " + tp.getProperty("i"));
System.out.println("d : " + tp.getProperty("d"));
}// end testDebug
//*****************************************************
public static void testDebug() throws IOException{
Debug.traceError(new Exception("test exception"));
}// end testDebug
//*****************************************************
public static void testTigBundle() throws IOException{
try{
TigBundle tb = new TigBundle("C:\\b_dvpt\\JEphem\\data\\lang\\Astro.properties", new Locale("en", ""));
Properties data = tb.getData();
Enumeration keys = data.keys();
FileOutputStream fos = new FileOutputStream(new File("tests.txt"));
int count = 0;
for (; keys.hasMoreElements() ;) {
fos.write((keys.nextElement() + LS).getBytes());
count ++;
}
fos.write(("-------------" + LS).getBytes());
fos.write((String.valueOf(count) + " items").getBytes());
fos.close();
}
catch(IOException ioe){ throw ioe; }
} // end testTigBundle
//*****************************************************
/* public static void testJdToDate(String strJd) throws TigException{
try{
double jd = Double.parseDouble(strJd);
int[] date = Time.jdToDate(jd);
String[] labels = {"y", "m", "d", "h", "m", "s"};
for (int i=0; i<6; i++)
System.out.println(labels[i] + " = " + date[i]);
}
catch(TigException te){throw te;}
} // end testJdToDate
*/
}// end class test