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
, null, 8));
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
, null, 8);
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 query(long) method test.
105 public void testQuery() {
107 String result
= fixture
.query(value
);
113 * Run the String toString() method test.
116 public void testToString() {
117 String result
= fixture
.toString();
119 String left
= "[declaration] enum["; //$NON-NLS-1$
120 assertEquals(left
, result
.substring(0, left
.length()));