1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 package org.perfidix;
28
29 import static org.junit.Assert.assertArrayEquals;
30 import static org.junit.Assert.assertEquals;
31 import static org.junit.Assert.fail;
32
33 import org.junit.Test;
34 import org.perfidix.benchmarktests.ToTestConfig;
35 import org.perfidix.meter.AbstractMeter;
36 import org.perfidix.ouput.AbstractOutput;
37
38
39
40
41
42
43 public class PerfidixTest {
44
45
46
47
48 @Test
49 public void testRunBenchs() {
50 final String[] benchs = {
51 "org.perfidix.benchmarktests.NormalCompleteBench"
52 };
53 try {
54 Perfidix.runBenchs(benchs);
55 } catch (final ClassNotFoundException e) {
56 fail(e.toString());
57 } catch (final InstantiationException e) {
58 fail(e.toString());
59 } catch (final IllegalAccessException e) {
60 fail(e.toString());
61 }
62 }
63
64
65
66
67
68 @Test
69 public void testSetUpBenchmark() {
70 final String[] benchs = {
71 "org.perfidix.benchmarktests.NormalCompleteBench"
72 };
73 final Benchmark bench = new Benchmark();
74 try {
75 Perfidix.setUpBenchmark(benchs, bench);
76 } catch (final ClassNotFoundException e) {
77 fail(e.toString());
78 }
79 }
80
81
82
83
84 @Test
85 public void testGetConfiguration() {
86 final String[] confs = {
87 "org.perfidix.benchmarktests.ToTestConfig"
88 };
89 try {
90 final AbstractConfig conf = Perfidix.getConfiguration(confs);
91 assertEquals("runs must be the same", conf.getRuns(), ToTestConfig.TESTRUNS);
92 assertArrayEquals("meters must be the same", conf.getMeters(), ToTestConfig.TESTMETERS
93 .toArray(new AbstractMeter[ToTestConfig.TESTMETERS.size()]));
94 assertArrayEquals("listeners must be the same", conf.getListener(), ToTestConfig.TESTLISTENER
95 .toArray(new AbstractOutput[ToTestConfig.LISTENERS.size()]));
96 assertEquals("arrangement must be the same", conf.getArrangement(), ToTestConfig.TESTARR);
97 assertEquals("gc prob must be the same", conf.getGcProb(), ToTestConfig.TESTGC, 0);
98 } catch (final ClassNotFoundException e) {
99 fail(e.toString());
100 } catch (final InstantiationException e) {
101 fail(e.toString());
102 } catch (final IllegalAccessException e) {
103 fail(e.toString());
104 }
105 }
106
107
108
109
110 @Test
111 public void testMain() {
112 final String[] benchs = {
113 "org.perfidix.benchmarktests.NormalCompleteBench"
114 };
115 try {
116 Perfidix.runBenchs(benchs);
117 } catch (final ClassNotFoundException e) {
118 fail(e.toString());
119 } catch (final InstantiationException e) {
120 fail(e.toString());
121 } catch (final IllegalAccessException e) {
122 fail(e.toString());
123 }
124 }
125 }