Internalize some classes and fix a pile of warnings
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / types / IntegerDefinitionTest.java
CommitLineData
866e5b51
FC
1package org.eclipse.linuxtools.ctf.core.tests.types;
2
3import static org.junit.Assert.assertEquals;
4import static org.junit.Assert.assertNotNull;
5
6import java.nio.ByteOrder;
7
866e5b51
FC
8import org.eclipse.linuxtools.ctf.core.event.types.Encoding;
9import org.eclipse.linuxtools.ctf.core.event.types.IDefinitionScope;
10import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration;
11import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition;
13be1a8f 12import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
ce2388e0 13import org.eclipse.linuxtools.internal.ctf.core.event.io.BitBuffer;
866e5b51
FC
14import org.junit.After;
15import org.junit.Before;
16import org.junit.Test;
17
18/**
19 * The class <code>IntegerDefinitionTest</code> contains tests for the class
20 * <code>{@link IntegerDefinition}</code>.
284fdee8 21 *
866e5b51
FC
22 * @author ematkho
23 * @version $Revision: 1.0 $
24 */
25public class IntegerDefinitionTest {
26
27 private IntegerDefinition fixture;
024373d7
MK
28 String name = "testInt"; //$NON-NLS-1$
29 String clockName = "clock"; //$NON-NLS-1$
866e5b51
FC
30 /**
31 * Launch the test.
284fdee8 32 *
866e5b51
FC
33 * @param args
34 * the command line arguments
35 */
36 public static void main(String[] args) {
37 new org.junit.runner.JUnitCore().run(IntegerDefinitionTest.class);
38 }
39
40 /**
41 * Perform pre-test initialization. We know the structDef won't be null (or
42 * else the tests will fail), so we can safely suppress the warning.
fd74e6c1
MK
43 *
44 * @throws CTFReaderException
866e5b51
FC
45 */
46 @Before
13be1a8f 47 public void setUp() throws CTFReaderException {
024373d7 48
8fd82db5
FC
49// StructDefinition structDef = null;
50// boolean found = false;
024373d7
MK
51 IntegerDeclaration id = new IntegerDeclaration( 1, true, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8);
52 fixture = id.createDefinition(null, name);
866e5b51
FC
53 }
54
55 /**
56 * Perform post-test clean-up.
57 */
58 @After
59 public void tearDown() {
60 // Add additional tear down code here
61 }
62
63 /**
64 * Run the IntegerDefinition(IntegerDeclaration,DefinitionScope,String)
65 * constructor test.
66 */
67 @Test
68 public void testIntegerDefinition() {
69 IntegerDeclaration declaration = new IntegerDeclaration(1, true, 1,
fd74e6c1 70 ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 8);
866e5b51
FC
71 IDefinitionScope definitionScope = null;
72 String fieldName = ""; //$NON-NLS-1$
73
74 IntegerDefinition result = new IntegerDefinition(declaration,
75 definitionScope, fieldName);
76 assertNotNull(result);
77 }
78
79 /**
80 * Run the IntegerDeclaration getDeclaration() method test.
81 */
82 @Test
83 public void testGetDeclaration() {
84 fixture.setValue(1L);
85
86 IntegerDeclaration result = fixture.getDeclaration();
87 assertNotNull(result);
88 }
89
90 /**
91 * Run the long getValue() method test.
92 */
93 @Test
94 public void testGetValue() {
95 fixture.setValue(1L);
96
97 long result = fixture.getValue();
98 assertEquals(1L, result);
99 }
100
101 /**
102 * Run the void read(BitBuffer) method test.
103 */
104 @Test
105 public void testRead() {
106 fixture.setValue(1L);
107 BitBuffer input = new BitBuffer(java.nio.ByteBuffer.allocateDirect(128));
108
109 fixture.read(input);
110 }
111
112 /**
113 * Run the String toString() method test.
114 */
115 @Test
116 public void testToString() {
117 fixture.setValue(1L);
118
119 String result = fixture.toString();
120 assertNotNull(result);
121 }
284fdee8 122}
This page took 0.02971 seconds and 5 git commands to generate.