Merging B-1_9_1 back to head
This commit is contained in:
44
unittest/com/jacob/com/DateUtilitiesTest.java
Normal file
44
unittest/com/jacob/com/DateUtilitiesTest.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.jacob.com;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import com.jacob.com.DateUtilities;
|
||||
|
||||
/**
|
||||
* test cases that should exercise the new date conversion code
|
||||
* run this test with options
|
||||
* <code>-Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=true -Dcom.jacob.debug=false</code>
|
||||
* @author joe
|
||||
*
|
||||
*/
|
||||
|
||||
public class DateUtilitiesTest {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Date now = new Date();
|
||||
double comTimeForNow = DateUtilities.convertDateToWindowsTime(now);
|
||||
Date retrievedNow = DateUtilities.convertWindowsTimeToDate(comTimeForNow);
|
||||
if (!now.equals(retrievedNow)){
|
||||
System.out.println("Variant Date Test failed " +now+ " != " +retrievedNow );
|
||||
} else {
|
||||
System.out.println("Variant Date Test passed");
|
||||
}
|
||||
|
||||
// this is a magic time in the windows world
|
||||
Date beginningOfWindowsTime =
|
||||
new GregorianCalendar(1899, Calendar.DECEMBER, 30).getTime();
|
||||
double comTimeForBeginningOfWindowsTime =
|
||||
DateUtilities.convertDateToWindowsTime(beginningOfWindowsTime);
|
||||
if (comTimeForBeginningOfWindowsTime > 0){
|
||||
System.out.println("Beginning of windows time test failed "
|
||||
+comTimeForBeginningOfWindowsTime);
|
||||
} else {
|
||||
System.out.println("Beginning of windows time test passed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@ package com.jacob.com;
|
||||
* This will eventually be changed to a unit test.
|
||||
*
|
||||
* Run in Eclipse with command line arguments
|
||||
* -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false
|
||||
* -Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=false -Dcom.jacob.debug=false
|
||||
*/
|
||||
public class ROT2Test
|
||||
{
|
||||
@@ -35,8 +35,6 @@ class ROT2TestThread extends Thread
|
||||
{
|
||||
private java.util.List ThreadObjects;
|
||||
|
||||
private boolean DivideMode = true;
|
||||
|
||||
private int initialRunSize = 0;
|
||||
/**
|
||||
* @param arg0
|
||||
|
||||
@@ -35,8 +35,6 @@ class ROT3TestThread extends Thread
|
||||
{
|
||||
private java.util.List ThreadObjects;
|
||||
|
||||
private boolean DivideMode = true;
|
||||
|
||||
private int initialRunSize = 0;
|
||||
/**
|
||||
* @param arg0
|
||||
@@ -74,7 +72,7 @@ class ROT3TestThread extends Thread
|
||||
String message = "";
|
||||
message = getName()+" Workingset=" +ThreadObjects.size()
|
||||
+" ROT: "+ROT.getThreadObjects(true).hashCode();
|
||||
message += "before mods and gc "+ROT.getThreadObjects(true).size()+")";
|
||||
message += " before mods and gc "+ROT.getThreadObjects(true).size()+")";
|
||||
// if there is an odd number of objects greater than 2
|
||||
if (ThreadObjects.size() > 10)
|
||||
{
|
||||
@@ -94,6 +92,8 @@ class ROT3TestThread extends Thread
|
||||
{
|
||||
// remove the reference so gc can get it
|
||||
if (!ROT.USE_AUTOMATIC_GARBAGE_COLLECTION){
|
||||
// uses deprecated API to set up a special situation
|
||||
// because this is an ROT test
|
||||
ROT.removeObject((JacobObject)ThreadObjects.get(i-1));
|
||||
}
|
||||
ThreadObjects.remove(i-1);
|
||||
|
||||
@@ -87,6 +87,9 @@ public class SafeArrayReleaseTest
|
||||
a1.setVariant(1, new Variant("bar"));
|
||||
Variant v = new Variant(a1);
|
||||
SafeArray a2 = v.toSafeArray(true);
|
||||
if (a2 == null){
|
||||
System.out.println("got null back from toSafeArray()");
|
||||
}
|
||||
}
|
||||
ComThread.Release();
|
||||
System.gc();
|
||||
|
||||
29
unittest/com/jacob/com/VariantDateTest.java
Normal file
29
unittest/com/jacob/com/VariantDateTest.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.jacob.com;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.jacob.com.Variant;
|
||||
|
||||
/**
|
||||
* test cases that should exercise the new date conversion code
|
||||
* run this test with options
|
||||
* <code>-Djava.library.path=d:/jacob/release -Dcom.jacob.autogc=true -Dcom.jacob.debug=false</code>
|
||||
* @author joe
|
||||
*
|
||||
*/
|
||||
public class VariantDateTest {
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Date now = new Date();
|
||||
Variant holder = new Variant();
|
||||
holder.putDate(now);
|
||||
Date retrievedNow = holder.getJavaDate();
|
||||
if (!now.equals(retrievedNow)){
|
||||
System.out.println("Variant Date Test failed " +now+ " != " +retrievedNow );
|
||||
} else {
|
||||
System.out.println("Variant Date Test passed");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user