package org.eclipse.linuxtools.tmf.core.tests.ctfadaptor;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertArrayEquals;
import java.nio.ByteOrder;
import org.eclipse.linuxtools.ctf.core.event.types.StructDeclaration;
import org.eclipse.linuxtools.ctf.core.event.types.StructDefinition;
import org.eclipse.linuxtools.ctf.core.event.types.VariantDeclaration;
+import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfEventField;
import org.junit.Before;
import org.junit.Test;
/**
* Perform pre-test initialization.
+ * @throws CTFReaderException error
*/
@Before
- public void setUp() {
+ public void setUp() throws CTFReaderException {
StructDeclaration sDec = new StructDeclaration(1l);
StringDeclaration strDec = new StringDeclaration();
IntegerDeclaration intDec = new IntegerDeclaration(8, false, 8,
sDec.addField(STR, strDec);
sDec.addField(ARRAY, arrDec);
sDec.addField(SEQ, seqDec);
- structDec.addField(STR,strDec);
+ structDec.addField(STR, strDec);
structDec.addField(INT, intDec);
sDec.addField(STRUCT, structDec);
enumDec.add(0, 1, LEN);
enumDec.add(2, 3, FLOAT);
- sDec.addField(ENUM, enumDec);
+ sDec.addField(ENUM, enumDec);
varDec.addField(LEN, intDec);
varDec.addField(FLOAT, flDec);
varDec.setTag(ENUM);
public void testParseField_sequence_value() {
Definition fieldDef = fixture.lookupDefinition(SEQ);
CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("[2, 2]", result.getValue().toString());
+ long[] values = (long[]) result.getValue();
+ long[] expected = new long[] { 2, 2 };
+ assertArrayEquals(expected, values);
}
/**
public void testParseField_variant() {
Definition fieldDef = fixture.lookupDefinition(VARIANT);
CtfTmfEventField result = CtfTmfEventField.parseField(fieldDef, NAME);
- assertEquals("float=9.551467814359616E-38", result.toString());
+ assertEquals("test=float=9.551467814359616E-38", result.toString());
}
}