Commit | Line | Data |
---|---|---|
866e5b51 FC |
1 | package org.eclipse.linuxtools.ctf.core.tests.trace; |
2 | ||
3 | import static org.junit.Assert.assertEquals; | |
4 | import static org.junit.Assert.assertNotNull; | |
5 | ||
6 | import java.nio.channels.FileChannel; | |
7 | ||
8 | import org.eclipse.linuxtools.ctf.core.tests.TestParams; | |
9 | import org.eclipse.linuxtools.ctf.core.trace.Stream; | |
10 | import org.eclipse.linuxtools.ctf.core.trace.StreamInput; | |
11 | import org.eclipse.linuxtools.ctf.core.trace.StreamInputReader; | |
12 | import org.eclipse.linuxtools.ctf.core.trace.StreamInputReaderTimestampComparator; | |
13 | import org.junit.*; | |
14 | ||
15 | /** | |
16 | * The class <code>StreamInputReaderTimestampComparatorTest</code> contains | |
17 | * tests for the class <code>{@link StreamInputReaderTimestampComparator}</code> | |
18 | * | |
19 | * @author ematkho | |
20 | * @version $Revision: 1.0 $ | |
21 | */ | |
22 | public class StreamInputReaderTimestampComparatorTest { | |
23 | ||
24 | private StreamInputReaderTimestampComparator fixture; | |
25 | ||
26 | /** | |
27 | * Launch the test. | |
28 | * | |
29 | * @param args | |
30 | * the command line arguments | |
31 | */ | |
32 | public static void main(String[] args) { | |
33 | new org.junit.runner.JUnitCore().run(StreamInputReaderTimestampComparatorTest.class); | |
34 | } | |
35 | ||
36 | /** | |
37 | * Perform pre-test initialization. | |
38 | */ | |
39 | @Before | |
40 | public void setUp() { | |
41 | fixture = new StreamInputReaderTimestampComparator(); | |
42 | } | |
43 | ||
44 | /** | |
45 | * Perform post-test clean-up. | |
46 | */ | |
47 | @After | |
48 | public void tearDown() { | |
49 | // Add additional tear down code here | |
50 | } | |
51 | ||
52 | /** | |
53 | * Run the StreamInputReaderTimestampComparator() constructor test. | |
54 | */ | |
55 | @Test | |
56 | public void testStreamInputReaderTimestampComparator_1() throws Exception { | |
57 | assertNotNull(fixture); | |
58 | } | |
59 | ||
60 | /** | |
61 | * Run the int compare(StreamInputReader,StreamInputReader) method test. | |
62 | */ | |
63 | @Test | |
64 | public void testCompare() { | |
65 | StreamInputReader a, b; | |
66 | a = new StreamInputReader(new StreamInput(new Stream( | |
67 | TestParams.createTrace()), (FileChannel) null, | |
68 | TestParams.getEmptyFile())); | |
69 | a.setCurrentEvent(null); | |
70 | b = new StreamInputReader(new StreamInput(new Stream( | |
71 | TestParams.createTrace()), (FileChannel) null, | |
72 | TestParams.getEmptyFile())); | |
73 | ||
74 | int result = fixture.compare(a, b); | |
75 | assertEquals(0, result); | |
76 | } | |
77 | } |