Commit c8fd4ad8 authored by Ricco Førgaard's avatar Ricco Førgaard

Sanitazion, test data, and pom-fixing.

Sanitized Level 6.
Added test data for publishing.
Removed Surefire stuff from pom.xml. It doesn't seem to be necessary and
it just makes a lot of noise.
parent 6fb56f4f
......@@ -37,16 +37,6 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<includes>
<include>**/Level*.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>
......@@ -44,41 +44,58 @@ public class Level06 {
}
/**
* Create a slice using the dimensions Foo and Bar and
* then retrieve the value of the cell at Foo.c, Bar.z
* Create a slice using Region, Party and Year as dimensions and
* number of votes as measure.
*
* Then find out how many votes the Moderate Party (1) had in the entire
* country (SE) in 1994.
*
* Hint: The party dimension is at index 0, region is 1 and year is 2.
* The measure has index 0.
*/
public void getCellValuesFromSlice() {
double cellValue = Double.NaN;
@Test
public void getCellValueFromSlice() {
double value = Double.NaN;
assertEquals(123d, cellValue, 0d);
assertEquals(1243253d, value, 0d);
}
/**
* Create a slice using foo and bar as dimensions and baz
* as measure. Also add the members a and b from Foo and
* the members x, y, and z from Bar.
* Create a slice using the dimensions Year, Region, and Party.
* Find out how many percent invalid votes (13) there were in
* Sydsverige (SE22) in 2002.
*
* Then retrieve the value for Foo.a and Bar.y
* Hint: See the previous test for dimension indexes.
* The "% votes" measure has index 1.
*/
@Test
public void getSliceWithMembers() {
double value = Double.NaN;
public void getCellValuesFromSlice() {
double cellValue = Double.NaN;
assertEquals(123d, value, 0d);
assertEquals(1.33d, cellValue, 0.01d);
}
/**
* Create a slice using Foo and Bar as dimensions and
* Baz as Measure. For Foo you must also limit the slice
* to the members a, b, and c.
* Create a slice using the following dimensions and their members:
* - Party: Moderate Party (1), Centre Party (6), and Green Party (7).
* - Region: Stockholm (SE11)
* - Year: 2002, 2006, 2010
*
* Then traverse the slice and put all cells in the list.
* Then traverse the cells in the slice and put all cells in the list.
* Optionally, you can print the list to System.out if you like.
*
* Hint: To traverse the cells, traverse lists of the members you used as
* input and build coordinates for each combination.
*/
@Test
public void getListOfCells() {
public void limitByMembers() {
List<Cell> allCells = null;
assertEquals(20, allCells.size());
assertEquals(9, allCells.size());
assertEquals(5.46d, (double) allCells.get(4).getValue(), 0.01d);
}
// Bonus assignment: do the last test again but try to print the output
// as a table.
// Hint: you need to traverse the members of the dimensions' levels...
}
This diff is collapsed.
This diff is collapsed.
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