01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.debug.jdi.tests;
11:
12: import com.sun.jdi.Value;
13:
14: /**
15: * Tests for JDI com.sun.jdi.Value.
16: */
17: public class ValueTest extends AbstractJDITest {
18: private Value fBoolean, fByte, fChar, fDouble, fFloat, fInteger,
19: fLong, fShort, fArray, fObject;
20:
21: /**
22: * Creates a new test.
23: */
24: public ValueTest() {
25: super ();
26: }
27:
28: /**
29: * Init the fields that are used by this test only.
30: */
31: public void localSetUp() {
32: // Get primitive values
33: fBoolean = fVM.mirrorOf(true);
34: fByte = fVM.mirrorOf((byte) 1);
35: fChar = fVM.mirrorOf('a');
36: fDouble = fVM.mirrorOf(12345.6789);
37: fFloat = fVM.mirrorOf(12345.6789f);
38: fInteger = fVM.mirrorOf(12345);
39: fLong = fVM.mirrorOf(123456789l);
40: fShort = fVM.mirrorOf((short) 12345);
41:
42: // Get object references
43: fArray = getObjectArrayReference();
44: fObject = getObjectReference();
45: }
46:
47: /**
48: * Run all tests and output to standard output.
49: * @param args
50: */
51: public static void main(java.lang.String[] args) {
52: new ValueTest().runSuite(args);
53: }
54:
55: /**
56: * Gets the name of the test case.
57: * @see junit.framework.TestCase#getName()
58: */
59: public String getName() {
60: return "com.sun.jdi.Value";
61: }
62:
63: /**
64: * Test JDI type().
65: */
66: public void testJDIType() {
67: assertEquals("1", "boolean", fBoolean.type().name());
68: assertEquals("2", "byte", fByte.type().name());
69: assertEquals("3", "char", fChar.type().name());
70: assertEquals("4", "double", fDouble.type().name());
71: assertEquals("5", "float", fFloat.type().name());
72: assertEquals("6", "int", fInteger.type().name());
73: assertEquals("7", "long", fLong.type().name());
74: assertEquals("8", "short", fShort.type().name());
75: assertEquals("9", "java.lang.String[]", fArray.type().name());
76: assertEquals("10",
77: "org.eclipse.debug.jdi.tests.program.MainClass",
78: fObject.type().name());
79: }
80: }
|