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
.assertTrue
;
7 import java
.nio
.ByteBuffer
;
8 import java
.nio
.ByteOrder
;
10 import org
.eclipse
.linuxtools
.ctf
.core
.event
.io
.BitBuffer
;
11 import org
.eclipse
.linuxtools
.ctf
.core
.event
.types
.Encoding
;
12 import org
.eclipse
.linuxtools
.ctf
.core
.event
.types
.EnumDeclaration
;
13 import org
.eclipse
.linuxtools
.ctf
.core
.event
.types
.EnumDefinition
;
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>EnumDefinitionTest</code> contains tests for the class
21 * <code>{@link EnumDefinition}</code>.
24 * @version $Revision: 1.0 $
26 public class EnumDefinitionTest
{
28 private EnumDefinition fixture
;
34 * the command line arguments
36 public static void main(String
[] args
) {
37 new org
.junit
.runner
.JUnitCore().run(EnumDefinitionTest
.class);
41 * Perform pre-test initialization.
45 EnumDeclaration declaration
= new EnumDeclaration(
46 new IntegerDeclaration(1, true, 1, ByteOrder
.BIG_ENDIAN
,
47 Encoding
.ASCII
, null, 8));
48 String fieldName
= ""; //$NON-NLS-1$
50 fixture
= new EnumDefinition(declaration
, null, fieldName
);
54 * Perform post-test clean-up.
57 public void tearDown() {
58 // Add additional tear down code here
62 * Run the EnumDefinition(EnumDeclaration,DefinitionScope,String)
66 public void testEnumDefinition() {
67 assertNotNull(fixture
);
71 * Run the String getValue() method test.
74 public void testGetValue() {
75 String result
= fixture
.getValue();
77 assertNotNull(result
);
81 * Run the long getIntegerValue() method test.
84 public void testGetIntegerValue_one() {
85 fixture
.setIntegerValue(1L);
86 long result
= fixture
.getIntegerValue();
88 assertEquals(1L, result
);
92 * Run the String getValue() method test.
95 public void testGetIntegerValue_zero() {
96 fixture
.setIntegerValue(0);
97 long result
= fixture
.getIntegerValue();
99 assertTrue(0 == result
);
103 * Run the void read(BitBuffer) method test.
106 public void testRead() {
107 fixture
.setIntegerValue(1L);
108 BitBuffer input
= new BitBuffer(ByteBuffer
.allocateDirect(128));