1761727 converted unit test programs to JUnit tests and updated the build targets

This commit is contained in:
clay_shooter
2007-07-27 03:28:44 +00:00
parent bfdc36ad30
commit 78c7ddf199
71 changed files with 1459 additions and 1257 deletions

View File

@@ -1,16 +1,21 @@
package com.jacob.test.safearray;
import com.jacob.com.*;
import com.jacob.com.SafeArray;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
/**
* SafeArrayTest Program
*
* This is more of an exerciser. It doesn't verify that it gets back
* what it expects like a junit test would
* <p>
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
*
*/
class sa_test {
public static void main(String[] args) {
public class SafeArrayBasicTest extends BaseTestCase {
public void testBasicSafeArray(){
//System.runFinalizersOnExit(true);
SafeArray sa = new SafeArray(Variant.VariantVariant, 3);
@@ -60,11 +65,9 @@ class sa_test {
new Variant(1), new Variant(2.3), new Variant("hi") });
System.out.println("sa variant=" + sa);
sa_ND_test();
}
public static void sa_ND_test() {
public void testSafeArrayNumDimensions() {
int[] lowerBounds = new int[] { 0, 0, 0 };
int[] dimensionSizes = new int[] { 3, 3, 3 };

View File

@@ -1,276 +1,273 @@
package com.jacob.test.safearray;
import com.jacob.com.*;
import com.jacob.com.ComFailException;
import com.jacob.com.SafeArray;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
class SafeArrayContents
{
/**
* A safe array contents test (old test)
*
* <p>
* May need to run with some command line options (including from inside
* Eclipse). Look in the docs area at the Jacob usage document for command line
* options.
*/
public class SafeArrayContents extends BaseTestCase {
public static void printArray(boolean a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(boolean a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(int a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(int a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(short a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(short a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(byte a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(byte a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(double a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(double a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(float a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(float a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(String a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(String a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(Variant a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(Variant a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(char a[])
{
System.out.print("[");
for(int i=0;i<a.length;i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void printArray(char a[]) {
System.out.print("[");
for (int i = 0; i < a.length; i++) {
System.out.print(" " + a[i] + " ");
}
System.out.println("]");
}
public static void main(String[] args)
{
// int
System.out.println("Int");
SafeArray ia = new SafeArray(Variant.VariantInt,4);
System.out.println("elem size:"+ia.getElemSize());
int iack[] = new int[] {100000,200000,300000,400000};
printArray(iack);
ia.fromIntArray(iack);
iack = ia.toIntArray();
printArray(iack);
public void testSafeArrayContents() {
// int
System.out.println("Int");
SafeArray ia = new SafeArray(Variant.VariantInt, 4);
System.out.println("elem size:" + ia.getElemSize());
int iack[] = new int[] { 100000, 200000, 300000, 400000 };
printArray(iack);
ia.fromIntArray(iack);
iack = ia.toIntArray();
printArray(iack);
int i4[] = new int[4];
ia.getInts(0, 4, i4, 0);
printArray(i4);
int i4[] = new int[4];
ia.getInts(0, 4, i4, 0);
printArray(i4);
SafeArray ia2 = new SafeArray(Variant.VariantInt,4);
ia2.setInts(0, 4, i4, 0);
iack = ia2.toIntArray();
printArray(iack);
SafeArray ia2 = new SafeArray(Variant.VariantInt, 4);
ia2.setInts(0, 4, i4, 0);
iack = ia2.toIntArray();
printArray(iack);
// double
System.out.println("Double");
SafeArray da = new SafeArray(Variant.VariantDouble,4);
System.out.println("elem size:"+da.getElemSize());
double dack[] = new double[] {123.456,456.123,1234567.89,12.3456789};
printArray(dack);
da.fromDoubleArray(dack);
dack = da.toDoubleArray();
printArray(dack);
// double
System.out.println("Double");
SafeArray da = new SafeArray(Variant.VariantDouble, 4);
System.out.println("elem size:" + da.getElemSize());
double dack[] = new double[] { 123.456, 456.123, 1234567.89, 12.3456789 };
printArray(dack);
da.fromDoubleArray(dack);
dack = da.toDoubleArray();
printArray(dack);
double d4[] = new double[4];
da.getDoubles(0, 4, d4, 0);
printArray(d4);
double d4[] = new double[4];
da.getDoubles(0, 4, d4, 0);
printArray(d4);
SafeArray da2 = new SafeArray(Variant.VariantDouble,4);
da2.setDoubles(0, 4, d4, 0);
dack = da2.toDoubleArray();
printArray(dack);
SafeArray da2 = new SafeArray(Variant.VariantDouble, 4);
da2.setDoubles(0, 4, d4, 0);
dack = da2.toDoubleArray();
printArray(dack);
// float
System.out.println("Float");
SafeArray fa = new SafeArray(Variant.VariantFloat,4);
System.out.println("elem size:"+fa.getElemSize());
float fack[] = new float[] {123.456F,456.123F,1234567.89F,12.3456789F};
printArray(fack);
fa.fromFloatArray(fack);
fack = fa.toFloatArray();
printArray(fack);
// float
System.out.println("Float");
SafeArray fa = new SafeArray(Variant.VariantFloat, 4);
System.out.println("elem size:" + fa.getElemSize());
float fack[] = new float[] { 123.456F, 456.123F, 1234567.89F,
12.3456789F };
printArray(fack);
fa.fromFloatArray(fack);
fack = fa.toFloatArray();
printArray(fack);
float f4[] = new float[4];
fa.getFloats(0, 4, f4, 0);
printArray(f4);
float f4[] = new float[4];
fa.getFloats(0, 4, f4, 0);
printArray(f4);
SafeArray fa2 = new SafeArray(Variant.VariantFloat,4);
fa2.setFloats(0, 4, f4, 0);
fack = fa2.toFloatArray();
printArray(fack);
SafeArray fa2 = new SafeArray(Variant.VariantFloat, 4);
fa2.setFloats(0, 4, f4, 0);
fack = fa2.toFloatArray();
printArray(fack);
// boolean
System.out.println("Boolean");
SafeArray ba = new SafeArray(Variant.VariantBoolean,4);
System.out.println("elem size:"+ba.getElemSize());
boolean back[] = new boolean[] {true, false, true, false};
printArray(back);
ba.fromBooleanArray(back);
back = ba.toBooleanArray();
printArray(back);
// boolean
System.out.println("Boolean");
SafeArray ba = new SafeArray(Variant.VariantBoolean, 4);
System.out.println("elem size:" + ba.getElemSize());
boolean back[] = new boolean[] { true, false, true, false };
printArray(back);
ba.fromBooleanArray(back);
back = ba.toBooleanArray();
printArray(back);
boolean b4[] = new boolean[4];
ba.getBooleans(0, 4, b4, 0);
printArray(b4);
boolean b4[] = new boolean[4];
ba.getBooleans(0, 4, b4, 0);
printArray(b4);
SafeArray ba2 = new SafeArray(Variant.VariantBoolean,4);
ba2.setBooleans(0, 4, b4, 0);
back = ba2.toBooleanArray();
printArray(back);
SafeArray ba2 = new SafeArray(Variant.VariantBoolean, 4);
ba2.setBooleans(0, 4, b4, 0);
back = ba2.toBooleanArray();
printArray(back);
// char
System.out.println("Char");
SafeArray ca = new SafeArray(Variant.VariantShort,4);
System.out.println("elem size:"+ca.getElemSize());
char cack[] = new char[] {'a','b','c','d'};
printArray(cack);
ca.fromCharArray(cack);
cack = ca.toCharArray();
printArray(cack);
// char
System.out.println("Char");
SafeArray ca = new SafeArray(Variant.VariantShort, 4);
System.out.println("elem size:" + ca.getElemSize());
char cack[] = new char[] { 'a', 'b', 'c', 'd' };
printArray(cack);
ca.fromCharArray(cack);
cack = ca.toCharArray();
printArray(cack);
char c4[] = new char[4];
ca.getChars(0, 4, c4, 0);
printArray(c4);
char c4[] = new char[4];
ca.getChars(0, 4, c4, 0);
printArray(c4);
SafeArray ca2 = new SafeArray(Variant.VariantShort,4);
ca2.setChars(0, 4, c4, 0);
cack = ca2.toCharArray();
printArray(cack);
SafeArray ca2 = new SafeArray(Variant.VariantShort, 4);
ca2.setChars(0, 4, c4, 0);
cack = ca2.toCharArray();
printArray(cack);
// short
System.out.println("Short");
SafeArray sha = new SafeArray(Variant.VariantShort,4);
System.out.println("elem size:"+sha.getElemSize());
short shack[] = new short[] {1000,2000,3000,4000};
printArray(shack);
sha.fromShortArray(shack);
shack = sha.toShortArray();
printArray(shack);
// short
System.out.println("Short");
SafeArray sha = new SafeArray(Variant.VariantShort, 4);
System.out.println("elem size:" + sha.getElemSize());
short shack[] = new short[] { 1000, 2000, 3000, 4000 };
printArray(shack);
sha.fromShortArray(shack);
shack = sha.toShortArray();
printArray(shack);
short sh4[] = new short[4];
sha.getShorts(0, 4, sh4, 0);
printArray(sh4);
short sh4[] = new short[4];
sha.getShorts(0, 4, sh4, 0);
printArray(sh4);
SafeArray sha2 = new SafeArray(Variant.VariantShort,4);
sha2.setShorts(0, 4, sh4, 0);
shack = sha2.toShortArray();
printArray(shack);
SafeArray sha2 = new SafeArray(Variant.VariantShort, 4);
sha2.setShorts(0, 4, sh4, 0);
shack = sha2.toShortArray();
printArray(shack);
// string
System.out.println("String");
SafeArray sa = new SafeArray(Variant.VariantString,4);
System.out.println("elem size:"+sa.getElemSize());
String sack[] = new String[] {"aa","bb","cc","dd"};
printArray(sack);
sa.fromStringArray(sack);
sack = sa.toStringArray();
printArray(sack);
// string
System.out.println("String");
SafeArray sa = new SafeArray(Variant.VariantString, 4);
System.out.println("elem size:" + sa.getElemSize());
String sack[] = new String[] { "aa", "bb", "cc", "dd" };
printArray(sack);
sa.fromStringArray(sack);
sack = sa.toStringArray();
printArray(sack);
String s4[] = new String[4];
sa.getStrings(0, 4, s4, 0);
printArray(s4);
String s4[] = new String[4];
sa.getStrings(0, 4, s4, 0);
printArray(s4);
SafeArray sa2 = new SafeArray(Variant.VariantString,4);
sa2.setStrings(0, 4, s4, 0);
sack = sa2.toStringArray();
printArray(sack);
SafeArray sa2 = new SafeArray(Variant.VariantString, 4);
sa2.setStrings(0, 4, s4, 0);
sack = sa2.toStringArray();
printArray(sack);
// variant
System.out.println("Variant");
SafeArray va = new SafeArray(Variant.VariantVariant,4);
System.out.println("elem size:"+va.getElemSize());
Variant vack[] = new Variant[]
{
new Variant(1),
new Variant(2.3),
new Variant(true),
new Variant("four"),
};
printArray(vack);
va.fromVariantArray(vack);
vack = va.toVariantArray();
printArray(vack);
// variant
System.out.println("Variant");
SafeArray va = new SafeArray(Variant.VariantVariant, 4);
System.out.println("elem size:" + va.getElemSize());
Variant vack[] = new Variant[] { new Variant(1), new Variant(2.3),
new Variant(true), new Variant("four"), };
printArray(vack);
va.fromVariantArray(vack);
vack = va.toVariantArray();
printArray(vack);
Variant v4[] = new Variant[4];
va.getVariants(0, 4, v4, 0);
printArray(v4);
Variant v4[] = new Variant[4];
va.getVariants(0, 4, v4, 0);
printArray(v4);
SafeArray va2 = new SafeArray(Variant.VariantVariant,4);
va2.setVariants(0, 4, v4, 0);
vack = va2.toVariantArray();
printArray(vack);
SafeArray va2 = new SafeArray(Variant.VariantVariant, 4);
va2.setVariants(0, 4, v4, 0);
vack = va2.toVariantArray();
printArray(vack);
// byte
System.out.println("Byte");
SafeArray bba = new SafeArray(Variant.VariantByte,4);
System.out.println("elem size:"+bba.getElemSize());
byte bback[] = new byte[] {0x1,0x2,0x3,0x4};
printArray(bback);
bba.fromByteArray(bback);
bback = bba.toByteArray();
printArray(bback);
// byte
System.out.println("Byte");
SafeArray bba = new SafeArray(Variant.VariantByte, 4);
System.out.println("elem size:" + bba.getElemSize());
byte bback[] = new byte[] { 0x1, 0x2, 0x3, 0x4 };
printArray(bback);
bba.fromByteArray(bback);
bback = bba.toByteArray();
printArray(bback);
byte bb4[] = new byte[4];
bba.getBytes(0, 4, bb4, 0);
printArray(bb4);
byte bb4[] = new byte[4];
bba.getBytes(0, 4, bb4, 0);
printArray(bb4);
SafeArray bba2 = new SafeArray(Variant.VariantByte,4);
bba2.setBytes(0, 4, bb4, 0);
bback = bba2.toByteArray();
printArray(bback);
SafeArray bba2 = new SafeArray(Variant.VariantByte, 4);
bba2.setBytes(0, 4, bb4, 0);
bback = bba2.toByteArray();
printArray(bback);
try {
System.out.println("Should see a com exception right after this line...");
// this should throw ComException
bba2.fromCharArray(new char[] {'a'});
} catch (Exception e) {
e.printStackTrace();
}
}
try {
// this should throw ComException
bba2.fromCharArray(new char[] { 'a' });
fail("Failed to catch expected exception");
} catch (ComFailException cfe) {
// do nothing
//cfe.printStackTrace();
}
}
}

View File

@@ -0,0 +1,42 @@
package com.jacob.test.safearray;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComException;
import com.jacob.com.Dispatch;
import com.jacob.com.SafeArray;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
public class SafeArrayDispatchTest extends BaseTestCase {
public void testDispatchWithSafeArray() {
try {
String scriptCommand = "1+(2*4)-3";
String lang = "VBScript";
ActiveXComponent sControl = new ActiveXComponent("ScriptControl");
Dispatch.put(sControl, "Language", lang);
Variant result = Dispatch.call(sControl, "Eval", scriptCommand);
assertTrue(result.toString().equals("6"));
// wrap the script control in a variant
Variant v = new Variant(sControl);
// create a safe array of type dispatch
SafeArray sa = new SafeArray(Variant.VariantDispatch, 1);
// put the variant in the array
sa.setVariant(0, v);
// take it back out
Variant v2 = sa.getVariant(0);
Dispatch d = v2.toDispatch();
// make sure you can call eval on it
result = Dispatch.call(d, "Eval", scriptCommand);
assertTrue(result.toString().equals("6"));
} catch (ComException e) {
e.printStackTrace();
fail("script failure "+e);
}
}
}

View File

@@ -3,6 +3,7 @@ package com.jacob.test.safearray;
import com.jacob.com.ComThread;
import com.jacob.com.SafeArray;
import com.jacob.com.Variant;
import com.jacob.test.BaseTestCase;
/**
* <p>
@@ -73,13 +74,15 @@ import com.jacob.com.Variant;
+-----------+ | VT_ARRAY| +---------+
| parray---->SAFEARRAY|
+------------+ +---------+
*
* <p>
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
*/
public class SafeArrayReleaseTest
{
public class SafeArrayReleaseTest extends BaseTestCase {
final static int MAX = 300;
public static void main(String[] args)
{
public void testSaveArrayRelease() {
int count;
System.out.println("Starting test for max = "+MAX);
for(count = 1; count<MAX; count++)
@@ -105,9 +108,7 @@ public class SafeArrayReleaseTest
}
catch (Exception e)
{
System.out.println("\nTest fails with i = " + i + " (max = "+MAX+")");
e.printStackTrace();
break;
fail("Test fails with i = " + i + " (max = "+MAX+")");
}
}
System.gc();

View File

@@ -1,60 +1,69 @@
package com.jacob.test.safearray;
import com.jacob.com.*;
import com.jacob.test.BaseTestCase;
import com.jacob.activeX.*;
public class SafeArrayViaExcel
{
public static void main(java.lang.String[] args)
{
//deprecated
//System.runFinalizersOnExit(true);
/**
* This does simple tests with SafeArray using Excel as a source
* <p>
* May need to run with some command line options (including from inside Eclipse).
* Look in the docs area at the Jacob usage document for command line options.
* <p>
* This relies on BaseTestCase to provide the root path to the file under test
*/
public class SafeArrayViaExcel extends BaseTestCase {
public void testSafeArrayViaExcel() {
// deprecated
// System.runFinalizersOnExit(true);
ActiveXComponent xl = new ActiveXComponent("Excel.Application");
try {
Dispatch cell;
SafeArray sAProdText;
Dispatch workbooks = xl.getProperty("Workbooks").toDispatch();
System.out.println("have workbooks");
Dispatch workbook = Dispatch.call(workbooks, "Open", "d:\\jacob\\samples\\test\\ExcelSafeArray" +
".xls").toDispatch();
System.out.println("Opened File - jacobtest.xls\n");
Dispatch sheet = Dispatch.get(workbook,"ActiveSheet").toDispatch();
cell = Dispatch.invoke(sheet,"Range",Dispatch.Get,new Object[] {"A1:D1000"},new int[1]).toDispatch();
System.out.println("have cell:"+cell);
sAProdText = Dispatch.get(cell,"Value").toSafeArray();
System.out.println("sa: dim="+sAProdText.getNumDim());
System.out.println("sa: start row="+sAProdText.getLBound(1));
System.out.println("sa: start col="+sAProdText.getLBound(2));
System.out.println("sa: end row="+sAProdText.getUBound(1));
System.out.println("sa: end col="+sAProdText.getUBound(2));
int i;
int lineNumber=1;
int n = 0;
for(lineNumber=1; lineNumber < 1000; lineNumber++)
{
for (i = 1 ; i < 4 ; i++ ) {
System.out.println((n++) + " " + lineNumber+" "+i+" " +sAProdText.getString(lineNumber,i));
/*
if (sAProdText.getString(lineNumber,i).compareTo("aaaa") != 0 ) {
System.out.println("Invalid String in line " + lineNumber + " Cell " + i + " Value = " + sAProdText.getString(lineNumber,i));
stringFound = false;
ActiveXComponent xl = new ActiveXComponent("Excel.Application");
try {
Dispatch cell;
SafeArray sAProdText;
Dispatch workbooks = xl.getProperty("Workbooks").toDispatch();
System.out.println("have workbooks");
Dispatch workbook = Dispatch.call(
workbooks,
"Open",
getWindowsFilePathToPackageResource("SafeArrayViaExcel.xls",this.getClass()))
.toDispatch();
System.out.println("Opened File - SafeArrayViaExcel.xls\n");
Dispatch sheet = Dispatch.get(workbook, "ActiveSheet").toDispatch();
cell = Dispatch.invoke(sheet, "Range", Dispatch.Get,
new Object[] { "A1:D1000" }, new int[1]).toDispatch();
System.out.println("have cell:" + cell);
sAProdText = Dispatch.get(cell, "Value").toSafeArray();
System.out.println("sa: dim=" + sAProdText.getNumDim());
System.out.println("sa: start row=" + sAProdText.getLBound(1));
System.out.println("sa: start col=" + sAProdText.getLBound(2));
System.out.println("sa: end row=" + sAProdText.getUBound(1));
System.out.println("sa: end col=" + sAProdText.getUBound(2));
int i;
int lineNumber = 1;
int n = 0;
for (lineNumber = 1; lineNumber < 1000; lineNumber++) {
for (i = 1; i < 4; i++) {
System.out.println((n++) + " " + lineNumber + " " + i + " "
+ sAProdText.getString(lineNumber, i));
/*
* if (sAProdText.getString(lineNumber,i).compareTo("aaaa") !=
* 0 ) { System.out.println("Invalid String in line " +
* lineNumber + " Cell " + i + " Value = " +
* sAProdText.getString(lineNumber,i)); stringFound = false; } }
* if (stringFound) { System.out.println("Valid Strings in
* line " + lineNumber); lineNumber++; }
*/
}
}
if (stringFound) {
System.out.println("Valid Strings in line " + lineNumber);
lineNumber++;
}
*/
}
Dispatch.call(workbook, "Close");
System.out.println("Closed File\n");
} catch (Exception e) {
e.printStackTrace();
fail("Caught Exception "+e);
} finally {
xl.invoke("Quit", new Variant[] {});
}
Dispatch.call(workbook, "Close");
System.out.println("Closed File\n");
} catch (Exception e) {
e.printStackTrace();
} finally {
xl.invoke("Quit", new Variant[] {});
}
}
}

View File

@@ -1,42 +0,0 @@
package com.jacob.test.safearray;
import com.jacob.com.*;
import com.jacob.activeX.*;
class sa_dispatch
{
public static void main(String args[])
{
// deprecated
//System.runFinalizersOnExit(true);
try {
String lang = "VBScript";
ActiveXComponent sC = new ActiveXComponent("ScriptControl");
Dispatch sControl = (Dispatch)sC.getObject();
Dispatch.put(sControl, "Language", lang);
Variant result = Dispatch.call(sControl, "Eval", args[0]);
System.out.println("eval("+args[0]+") = "+ result);
// wrap the script control in a variant
Variant v = new Variant(sControl);
// create a safe array of type dispatch
SafeArray sa = new SafeArray(Variant.VariantDispatch, 1);
// put the variant in the array
sa.setVariant(0, v);
// take it back out
Variant v2 = sa.getVariant(0);
Dispatch d = v2.toDispatch();
// make sure you can call eval on it
result = Dispatch.call(d, "Eval", args[0]);
System.out.println("eval("+args[0]+") = "+ result);
} catch (ComException e) {
e.printStackTrace();
}
}
}