+/*******************************************************************************
+ * 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;
/**
* The class <code>SequenceDeclarationTest</code> contains tests for the class
* <code>{@link SequenceDeclaration}</code>.
- *
+ *
* @author ematkho
* @version $Revision: 1.0 $
*/
+@SuppressWarnings("javadoc")
public class SequenceDeclarationTest {
private SequenceDeclaration fixture;
+ static final String fieldName = "LengthName";
/**
* Launch the test.
- *
+ *
* @param args
* the command line arguments
*/
@Before
public void setUp() {
- fixture = new SequenceDeclaration("", new StringDeclaration()); //$NON-NLS-1$
+ fixture = new SequenceDeclaration(fieldName, new StringDeclaration());
}
@After
*/
@Test
public void testSequenceDeclaration() {
- String lengthName = ""; //$NON-NLS-1$
+ String lengthName = "";
IDeclaration elemType = new StringDeclaration();
- SequenceDeclaration result = new SequenceDeclaration(lengthName,
- elemType);
+ SequenceDeclaration result = new SequenceDeclaration(lengthName, elemType);
assertNotNull(result);
- String string = "[declaration] sequence["; //$NON-NLS-1$
+ String string = "[declaration] sequence[";
assertEquals(string, result.toString().substring(0, string.length()));
}
@Test
public void testCreateDefinition() {
IntegerDeclaration id = new IntegerDeclaration(8, false, 8,
- ByteOrder.LITTLE_ENDIAN, Encoding.UTF8);
- String fieldName = "LengthName"; //$NON-NLS-1$
+ ByteOrder.LITTLE_ENDIAN, Encoding.UTF8, null, 32);
+
StructDeclaration structDec = new StructDeclaration(0);
structDec.addField(fieldName, id);
- StructDefinition structDef = new StructDefinition(structDec, null, "x"); //$NON-NLS-1$
+ StructDefinition structDef = new StructDefinition(structDec, null, "x");
long seqLen = 10;
structDef.lookupInteger(fieldName).setValue(seqLen);
- SequenceDefinition result = this.fixture.createDefinition(structDef,
- fieldName);
+ SequenceDefinition result = this.fixture.createDefinition(structDef, fieldName);
assertNotNull(result);
}
@Test
public void testToString() {
String result = fixture.toString();
- String left = "[declaration] sequence["; //$NON-NLS-1$
+ String left = "[declaration] sequence[";
assertEquals(left, result.substring(0, left.length()));
}
}