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.DoubleValue;
13:
14: /**
15: * Tests for JDI com.sun.jdi.DoubleValue.
16: */
17: public class DoubleValueTest extends AbstractJDITest {
18:
19: private DoubleValue fValue;
20:
21: /**
22: * Creates a new test.
23: */
24: public DoubleValueTest() {
25: super ();
26: }
27:
28: /**
29: * Init the fields that are used by this test only.
30: */
31: public void localSetUp() {
32: // Get double value for 12345.6789
33: fValue = fVM.mirrorOf(12345.6789);
34: }
35:
36: /**
37: * Run all tests and output to standard output.
38: * @param args
39: */
40: public static void main(java.lang.String[] args) {
41: new DoubleValueTest().runSuite(args);
42: }
43:
44: /**
45: * Gets the name of the test case.
46: * @see junit.framework.TestCase#getName()
47: */
48: public String getName() {
49: return "com.sun.jdi.DoubleValue";
50: }
51:
52: /**
53: * Test JDI equals() and hashCode().
54: */
55: public void testJDIEquality() {
56: assertTrue("1", fValue.equals(fVM.mirrorOf(12345.6789)));
57: assertTrue("2", !fValue.equals(fVM.mirrorOf(98765.4321)));
58: assertTrue("3", !fValue.equals(new Object()));
59: assertTrue("4", !fValue.equals(null));
60: assertEquals("5", fValue.hashCode(), fVM.mirrorOf(12345.6789)
61: .hashCode());
62: assertTrue("6", fValue.hashCode() != fVM.mirrorOf(98765.4321)
63: .hashCode());
64: }
65:
66: /**
67: * Test JDI value().
68: */
69: public void testJDIValue() {
70: assertTrue("1", 12345.6789 == fValue.value());
71: }
72: }
|