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