+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
package org.eclipse.linuxtools.ctf.core.tests.types;
import static org.junit.Assert.assertEquals;
import java.nio.ByteOrder;
+import org.eclipse.linuxtools.ctf.core.event.io.BitBuffer;
import org.eclipse.linuxtools.ctf.core.event.types.Definition;
import org.eclipse.linuxtools.ctf.core.event.types.Encoding;
import org.eclipse.linuxtools.ctf.core.event.types.IntegerDeclaration;
import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
-import org.eclipse.linuxtools.internal.ctf.core.event.io.BitBuffer;
-import org.junit.After;
import org.junit.Before;
import org.junit.Test;
* @author ematkho
* @version $Revision: 1.0 $
*/
+@SuppressWarnings("javadoc")
public class SequenceDefinitionTest {
private SequenceDefinition fixture;
private final static int seqLen = 15;
- /**
- * Launch the test.
- *
- * @param args
- * the command line arguments
- */
- public static void main(String[] args) {
- new org.junit.runner.JUnitCore().run(SequenceDefinitionTest.class);
- }
-
/**
* Perform pre-test initialization.
* @throws CTFReaderException
IntegerDeclaration id = new IntegerDeclaration(8, false, 8,
ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, null, 8);
- String lengthName = "LengthName"; //$NON-NLS-1$
+ String lengthName = "LengthName";
structDec = new StructDeclaration(0);
structDec.addField(lengthName, id);
- structDef = new StructDefinition(structDec, null, "x"); //$NON-NLS-1$
+ structDef = new StructDefinition(structDec, null, "x");
structDef.lookupInteger(lengthName).setValue(seqLen);
SequenceDeclaration sd = new SequenceDeclaration(lengthName, id);
- fixture = new SequenceDefinition(sd, structDef, "TestX"); //$NON-NLS-1$
+ fixture = new SequenceDefinition(sd, structDef, "TestX");
BitBuffer input = new BitBuffer(
java.nio.ByteBuffer.allocateDirect(seqLen * 8));
for (int i = 0; i < seqLen; i++) {
assert (fixture != null);
}
- /**
- * Perform post-test clean-up.
- */
- @After
- public void tearDown() {
- // Add additional tear down code here
- }
-
private static SequenceDefinition initNonString() throws CTFReaderException {
StructDeclaration structDec;
StructDefinition structDef;
int len = 32;
IntegerDeclaration id = new IntegerDeclaration(len, false, len,
ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, null,8);
- String lengthName = "LengthName"; //$NON-NLS-1$
+ String lengthName = "LengthName";
structDec = new StructDeclaration(0);
structDec.addField(lengthName, id);
- structDef = new StructDefinition(structDec, null, "x"); //$NON-NLS-1$
+ structDef = new StructDefinition(structDec, null, "x");
structDef.lookupInteger(lengthName).setValue(seqLen);
SequenceDeclaration sd = new SequenceDeclaration(lengthName, id);
- SequenceDefinition ret = new SequenceDefinition(sd, structDef, "TestX"); //$NON-NLS-1$
+ SequenceDefinition ret = new SequenceDefinition(sd, structDef, "TestX");
BitBuffer input = new BitBuffer(
java.nio.ByteBuffer.allocateDirect(seqLen * len));
for (int i = 0; i < seqLen; i++) {