Merge master in TmfTraceModel
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / src / org / eclipse / linuxtools / ctf / core / tests / trace / StreamInputReaderComparatorTest.java
CommitLineData
866e5b51
FC
1package org.eclipse.linuxtools.ctf.core.tests.trace;
2
3import static org.junit.Assert.assertEquals;
4import static org.junit.Assert.assertNotNull;
5
6import java.nio.channels.FileChannel;
7import org.eclipse.linuxtools.ctf.core.event.EventDeclaration;
8import org.eclipse.linuxtools.ctf.core.event.EventDefinition;
9import org.eclipse.linuxtools.ctf.core.tests.TestParams;
13be1a8f 10import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
866e5b51 11import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader;
ce2388e0
FC
12import org.eclipse.linuxtools.internal.ctf.core.trace.Stream;
13import org.eclipse.linuxtools.internal.ctf.core.trace.StreamInput;
14import org.eclipse.linuxtools.internal.ctf.core.trace.StreamInputReaderComparator;
866e5b51
FC
15import org.junit.*;
16
17/**
18 * The class <code>StreamInputReaderComparatorTest</code> contains tests for the
19 * class <code>{@link StreamInputReaderComparator}</code>.
20 *
21 * @author ematkho
22 * @version $Revision: 1.0 $
23 */
24public class StreamInputReaderComparatorTest {
25
26 private StreamInputReaderComparator fixture;
27
28 /**
29 * Launch the test.
30 *
31 * @param args
32 * the command line arguments
33 */
34 public static void main(String[] args) {
35 new org.junit.runner.JUnitCore().run(StreamInputReaderComparatorTest.class);
36 }
37
38 /**
39 * Perform pre-test initialization.
40 */
41 @Before
42 public void setUp() {
43 fixture = new StreamInputReaderComparator();
44 }
45
46 /**
47 * Perform post-test clean-up.
48 */
49 @After
50 public void tearDown() {
51 // Add additional tear down code here
52 }
53
54 /**
55 * Run the StreamInputReaderComparator() constructor test.
56 */
57 @Test
58 public void testStreamInputReaderComparator() {
59 assertNotNull(fixture);
60 }
61
62 /**
63 * Run the int compare(StreamInputReader,StreamInputReader) method test.
13be1a8f
AM
64 *
65 * @throws CTFReaderException
866e5b51
FC
66 */
67 @Test
13be1a8f 68 public void testCompare() throws CTFReaderException {
866e5b51
FC
69 StreamInputReader sir1, sir2;
70 EventDefinition ed1, ed2;
71
72 sir1 = new StreamInputReader(new StreamInput(new Stream(
73 TestParams.createTrace()), (FileChannel) null,
74 TestParams.getEmptyFile()));
75 ed1 = new EventDefinition(new EventDeclaration(),
76 new StreamInputReader(new StreamInput(new Stream(
77 TestParams.createTrace()), (FileChannel) null,
78 TestParams.getEmptyFile())));
79 ed1.timestamp = 1L;
80 sir1.setCurrentEvent(ed1);
81
82 sir2 = new StreamInputReader(new StreamInput(new Stream(
83 TestParams.createTrace()), (FileChannel) null,
84 TestParams.getEmptyFile()));
85 ed2 = new EventDefinition(new EventDeclaration(),
86 new StreamInputReader(new StreamInput(new Stream(
87 TestParams.createTrace()), (FileChannel) null,
88 TestParams.getEmptyFile())));
89
90 ed2.timestamp = 1L;
91 sir2.setCurrentEvent(ed2);
92
93 int result = fixture.compare(sir1, sir2);
94 assertEquals(0, result);
95 }
96}
This page took 0.029595 seconds and 5 git commands to generate.