ctf: Fix API inconsistencies
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / types / ArrayDefinitionTest.java
index 3bdf3f9c08d746929b643117efcde35aa6100368..b2df5813a5109632f46593c0ab7df0ad36039e86 100644 (file)
@@ -7,6 +7,7 @@ import static org.junit.Assert.assertTrue;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 
+import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
 import org.eclipse.linuxtools.ctf.core.event.types.ArrayDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.ArrayDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.Definition;
@@ -17,10 +18,7 @@ import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition;
 import org.eclipse.linuxtools.ctf.core.event.types.StringDeclaration;
 import org.eclipse.linuxtools.ctf.core.event.types.StringDefinition;
-import org.eclipse.linuxtools.ctf.core.tests.TestParams;
-import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
-import org.eclipse.linuxtools.internal.ctf.core.event.io.BitBuffer;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -54,27 +52,23 @@ public class ArrayDefinitionTest {
      *
      * structDef shouldn't be null after parsing the CTFTraceReader object, so
      * we can ignore the warning.
-     *
-     * @throws CTFReaderException
      */
     @Before
-    public void setUp() throws CTFReaderException {
-        this.trace = TestParams.createTrace();
-
+    public void setUp() {
         charArrayFixture = createCharArray();
         stringArrayFixture = createStringArray();
         longArrayFixture = createLongArray();
     }
 
     private ArrayDefinition createLongArray() {
-        IntegerDeclaration decl = new IntegerDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "none"); //$NON-NLS-1$
+        IntegerDeclaration decl = new IntegerDeclaration(32, false, 10, ByteOrder.BIG_ENDIAN, Encoding.NONE, "none",8); //$NON-NLS-1$
         IntegerDefinition[] defs = createIntDefs(10, 32);
         ArrayDefinition temp = setUpDeclaration(decl, defs);
         return temp;
     }
 
     private ArrayDefinition createCharArray() {
-        IntegerDeclaration decl = new IntegerDeclaration(8, false, 10, ByteOrder.BIG_ENDIAN, Encoding.UTF8, "none"); //$NON-NLS-1$
+        IntegerDeclaration decl = new IntegerDeclaration(8, false, 10, ByteOrder.BIG_ENDIAN, Encoding.UTF8, "none",8); //$NON-NLS-1$
         IntegerDefinition[] defs = createIntDefs(4,8);
         ArrayDefinition temp = setUpDeclaration(decl, defs);
         return temp;
@@ -107,13 +101,13 @@ public class ArrayDefinitionTest {
      * @param bits
      * @return
      */
-    private IntegerDefinition[] createIntDefs(int size, int bits) {
+    private static IntegerDefinition[] createIntDefs(int size, int bits) {
         IntegerDefinition[] defs = new IntegerDefinition[size];
         for (int i = 0; i < size; i++) {
 
             String content = "test" + i; //$NON-NLS-1$
             defs[i] = new IntegerDefinition(new IntegerDeclaration(bits, false,
-                    16, ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, content), null, content);
+                    16, ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, content, 24), null, content);
             defs[i].setValue(i);
         }
         return defs;
@@ -226,7 +220,7 @@ public class ArrayDefinitionTest {
     @Test
     public void testIsString_complex() {
         final IntegerDeclaration id = new IntegerDeclaration(8, false, 16,
-                ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, null);
+                ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, null, 8);
         ArrayDeclaration ad = new ArrayDeclaration(0, id);
         ArrayDefinition ownFixture = new ArrayDefinition(ad, this.trace,
                 "Testx"); //$NON-NLS-1$
This page took 0.026476 seconds and 5 git commands to generate.