1 package org
.eclipse
.linuxtools
.ctf
.core
.tests
.types
;
3 import static org
.junit
.Assert
.assertEquals
;
4 import static org
.junit
.Assert
.assertNotNull
;
5 import static org
.junit
.Assert
.assertNull
;
6 import static org
.junit
.Assert
.assertTrue
;
8 import java
.nio
.ByteOrder
;
10 import org
.eclipse
.linuxtools
.ctf
.core
.event
.types
.Encoding
;
11 import org
.eclipse
.linuxtools
.ctf
.core
.event
.types
.EnumDeclaration
;
12 import org
.eclipse
.linuxtools
.ctf
.core
.event
.types
.EnumDefinition
;
13 import org
.eclipse
.linuxtools
.ctf
.core
.event
.types
.IDefinitionScope
;
14 import org
.eclipse
.linuxtools
.ctf
.core
.event
.types
.IntegerDeclaration
;
15 import org
.junit
.After
;
16 import org
.junit
.Before
;
17 import org
.junit
.Test
;
20 * The class <code>EnumDeclarationTest</code> contains tests for the class
21 * <code>{@link EnumDeclaration}</code>.
24 * @version $Revision: 1.0 $
26 public class EnumDeclarationTest
{
28 private EnumDeclaration fixture
;
34 * the command line arguments
36 public static void main(String
[] args
) {
37 new org
.junit
.runner
.JUnitCore().run(EnumDeclarationTest
.class);
41 * Perform pre-test initialization.
45 fixture
= new EnumDeclaration(new IntegerDeclaration(1, true, 1,
46 ByteOrder
.BIG_ENDIAN
, Encoding
.ASCII
));
50 * Perform post-test clean-up.
53 public void tearDown() {
54 // Add additional tear down code here
58 * Run the EnumDeclaration(IntegerDeclaration) constructor test.
61 public void testEnumDeclaration() {
62 IntegerDeclaration containerType
= new IntegerDeclaration(1, true, 1,
63 ByteOrder
.BIG_ENDIAN
, Encoding
.ASCII
);
65 EnumDeclaration result
= new EnumDeclaration(containerType
);
67 assertNotNull(result
);
68 String left
= "[declaration] enum["; //$NON-NLS-1$
69 assertEquals(left
, result
.toString().substring(0, left
.length()));
73 * Run the boolean add(long,long,String) method test.
76 public void testAdd() {
79 String label
= ""; //$NON-NLS-1$
81 boolean result
= fixture
.add(low
, high
, label
);
87 * Run the EnumDefinition createDefinition(DefinitionScope,String) method
91 public void testCreateDefinition() {
92 IDefinitionScope definitionScope
= null;
93 String fieldName
= ""; //$NON-NLS-1$
95 EnumDefinition result
= fixture
.createDefinition(definitionScope
,
98 assertNotNull(result
);
102 * Run the String getLabel(long) method test.
105 public void testGetLabel() {
107 String result
= fixture
.getLabel(i
);
113 * Run the String query(long) method test.
116 public void testQuery() {
118 String result
= fixture
.query(value
);
124 * Run the String toString() method test.
127 public void testToString() {
128 String result
= fixture
.toString();
130 String left
= "[declaration] enum["; //$NON-NLS-1$
131 assertEquals(left
, result
.substring(0, left
.length()));