1 package org
.eclipse
.linuxtools
.ctf
.core
.tests
.trace
;
3 import static org
.junit
.Assert
.assertEquals
;
4 import static org
.junit
.Assert
.assertNotNull
;
6 import java
.nio
.channels
.FileChannel
;
7 import org
.eclipse
.linuxtools
.ctf
.core
.event
.EventDeclaration
;
8 import org
.eclipse
.linuxtools
.ctf
.core
.event
.EventDefinition
;
9 import org
.eclipse
.linuxtools
.ctf
.core
.tests
.TestParams
;
10 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.Stream
;
11 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.StreamInput
;
12 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.StreamInputReader
;
13 import org
.eclipse
.linuxtools
.ctf
.core
.trace
.StreamInputReaderComparator
;
17 * The class <code>StreamInputReaderComparatorTest</code> contains tests for the
18 * class <code>{@link StreamInputReaderComparator}</code>.
21 * @version $Revision: 1.0 $
23 public class StreamInputReaderComparatorTest
{
25 private StreamInputReaderComparator fixture
;
31 * the command line arguments
33 public static void main(String
[] args
) {
34 new org
.junit
.runner
.JUnitCore().run(StreamInputReaderComparatorTest
.class);
38 * Perform pre-test initialization.
42 fixture
= new StreamInputReaderComparator();
46 * Perform post-test clean-up.
49 public void tearDown() {
50 // Add additional tear down code here
54 * Run the StreamInputReaderComparator() constructor test.
57 public void testStreamInputReaderComparator() {
58 assertNotNull(fixture
);
62 * Run the int compare(StreamInputReader,StreamInputReader) method test.
65 public void testCompare() {
66 StreamInputReader sir1
, sir2
;
67 EventDefinition ed1
, ed2
;
69 sir1
= new StreamInputReader(new StreamInput(new Stream(
70 TestParams
.createTrace()), (FileChannel
) null,
71 TestParams
.getEmptyFile()));
72 ed1
= new EventDefinition(new EventDeclaration(),
73 new StreamInputReader(new StreamInput(new Stream(
74 TestParams
.createTrace()), (FileChannel
) null,
75 TestParams
.getEmptyFile())));
77 sir1
.setCurrentEvent(ed1
);
79 sir2
= new StreamInputReader(new StreamInput(new Stream(
80 TestParams
.createTrace()), (FileChannel
) null,
81 TestParams
.getEmptyFile()));
82 ed2
= new EventDefinition(new EventDeclaration(),
83 new StreamInputReader(new StreamInput(new Stream(
84 TestParams
.createTrace()), (FileChannel
) null,
85 TestParams
.getEmptyFile())));
88 sir2
.setCurrentEvent(ed2
);
90 int result
= fixture
.compare(sir1
, sir2
);
91 assertEquals(0, result
);