1
/*******************************************************************************
2
* Copyright (c) 2013 Ericsson
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Matthew Khouzam - Initial API and implementation
10
*******************************************************************************/
1
12
package org.eclipse.linuxtools.ctf.core.tests.types;
3
14
import static org.junit.Assert.assertEquals;
6
17
import java.nio.ByteOrder;
19
import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
8
20
import org.eclipse.linuxtools.ctf.core.event.types.Encoding;
9
21
import org.eclipse.linuxtools.ctf.core.event.types.IDefinitionScope;
10
22
import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration;
11
23
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
24
import org.junit.Before;
15
25
import org.junit.Test;
24
34
public class IntegerDefinitionTest {
26
36
private IntegerDefinition fixture;
27
String name = "testInt"; //$NON-NLS-1$
28
String clockName = "clock"; //$NON-NLS-1$
33
* the command line arguments
35
public static void main(String[] args) {
36
new org.junit.runner.JUnitCore().run(IntegerDefinitionTest.class);
37
String name = "testInt";
38
String clockName = "clock";
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.
41
* Perform pre-test initialization.
44
44
public void setUp() {
46
// StructDefinition structDef = null;
47
// boolean found = false;
48
IntegerDeclaration id = new IntegerDeclaration( 1, true, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8);
45
IntegerDeclaration id = new IntegerDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8);
49
46
fixture = id.createDefinition(null, name);
53
* Perform post-test clean-up.
56
public void tearDown() {
57
// Add additional tear down code here
61
50
* Run the IntegerDefinition(IntegerDeclaration,DefinitionScope,String)
62
51
* constructor test.
65
54
public void testIntegerDefinition() {
66
IntegerDeclaration declaration = new IntegerDeclaration(1, true, 1,
55
IntegerDeclaration declaration = new IntegerDeclaration(1, false, 1,
67
56
ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 8);
68
57
IDefinitionScope definitionScope = null;
69
String fieldName = ""; //$NON-NLS-1$
58
String fieldName = "";
71
60
IntegerDefinition result = new IntegerDefinition(declaration,
72
61
definitionScope, fieldName);