Commit 4b0dca77 authored by Anton Beloglazov's avatar Anton Beloglazov

Reorganized the unit tests

parent 9006b427
package org.cloudbus.cloudsim.examples;
import org.junit.Test;
import flanagan.analysis.Regression;
public class PowerVmAllocationPolicyMigrationLocalRegressionTest {
public static final double[] X = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21 };
public static final double[] Y = { 55, 60, 62, 59, 67, 73, 85, 97, 73, 68, 69, 52, 51, 55, 48, 46, 52,
55, 58, 65, 70 };
@Test
public void testData() {
Regression regression = new Regression(X, Y);
regression.constantPlot();
}
}
package org.cloudbus.cloudsim.examples;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
public class UtilizationModelPlanetLabTest {
public static final String FILE = "UtilizationModelPlanetLabTest.dat";
private UtilizationModelPlanetLab utilizationModel;
@Before
public void setUp() throws Exception {
utilizationModel = new UtilizationModelPlanetLab(getClass().getClassLoader().getResource(FILE)
.getPath());
}
@Test
public void testGetPowerModel() {
assertEquals(10.1, utilizationModel.getUtilization(0), 0);
assertEquals(11.1, utilizationModel.getUtilization(1), 0);
assertEquals(12.1, utilizationModel.getUtilization(2), 0);
assertEquals(13.1, utilizationModel.getUtilization(3), 0);
assertEquals(14.1, utilizationModel.getUtilization(4), 0);
assertEquals(15.1, utilizationModel.getUtilization(5), 0);
assertEquals(10.1, utilizationModel.getUtilization(0), 0);
assertEquals(11.1, utilizationModel.getUtilization(1), 0);
assertEquals(12.1, utilizationModel.getUtilization(2), 0);
assertEquals(16.1, utilizationModel.getUtilization(6), 0);
assertEquals(17.1, utilizationModel.getUtilization(7), 0);
assertEquals(18.1, utilizationModel.getUtilization(8), 0);
assertEquals(13.1, utilizationModel.getUtilization(3), 0);
assertEquals(14.1, utilizationModel.getUtilization(4), 0);
assertEquals(15.1, utilizationModel.getUtilization(5), 0);
assertEquals(19.1, utilizationModel.getUtilization(9), 0);
assertEquals(20.1, utilizationModel.getUtilization(10), 0);
assertEquals(21.1, utilizationModel.getUtilization(11), 0);
assertEquals(22.1, utilizationModel.getUtilization(12), 0);
assertEquals(23.1, utilizationModel.getUtilization(13), 0);
assertEquals(24.1, utilizationModel.getUtilization(14), 0);
assertEquals(25.1, utilizationModel.getUtilization(15), 0);
assertEquals(0.0, utilizationModel.getUtilization(16), 0);
assertEquals(10.1, utilizationModel.getUtilization(0), 0);
assertEquals(11.1, utilizationModel.getUtilization(1), 0);
assertEquals(12.1, utilizationModel.getUtilization(2), 0);
assertEquals(13.1, utilizationModel.getUtilization(3), 0);
}
}
package org.cloudbus.cloudsim.examples;
import org.cloudbus.cloudsim.Log;
import org.junit.Ignore;
import org.junit.Test;
public class UtilizationModelStochasticExponentialSmoothingTest {
@Test
@Ignore
public void testGeneratedValues() {
double alpha = 0.1;
for (int i = 0; i < 10; i++) {
UtilizationModelStochasticExponentialSmoothing utilizationModel = new UtilizationModelStochasticExponentialSmoothing();
UtilizationModelStochasticExponentialSmoothing.ALPHA = alpha;
Log.printLine("\n\nalpha = " + UtilizationModelStochasticExponentialSmoothing.ALPHA + "\n\n");
for (int j = 0; j < 100; j++) {
Log.printLine(j + ";" + utilizationModel.getUtilization(j));
}
alpha += 0.1;
}
}
}
package org.cloudbus.cloudsim.examples; package org.cloudbus.cloudsim;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
......
package org.cloudbus.cloudsim.examples; package org.cloudbus.cloudsim.power;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
......
package org.cloudbus.cloudsim.examples; package org.cloudbus.cloudsim.util;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment