Skip to content

Commit

Permalink
MONDRIAN: [MONDRIAN-1040] Adds a unit test for the DelegatingTupleLis…
Browse files Browse the repository at this point in the history
…t class.

[git-p4: depot-paths = "//open/mondrian/": change = 14755]
  • Loading branch information
lucboudreau committed Nov 11, 2011
1 parent 4441710 commit 6880390
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions testsrc/main/mondrian/test/TupleListTest.java
Expand Up @@ -13,6 +13,8 @@
import mondrian.calc.TupleList;
import mondrian.calc.impl.*;
import mondrian.olap.*;
import mondrian.rolap.RolapConnection;
import mondrian.server.Locus;

import java.util.*;

Expand Down Expand Up @@ -178,6 +180,7 @@ public void testDelegatingTupleList() {
* method was mixing up the column and index variables.
*/
public void testDelegatingTupleListSlice() {
// Functional test.
assertQueryReturns(
"select {[Measures].[Store Sales]} ON COLUMNS, Hierarchize(Except({[Customers].[All Customers], [Customers].[All Customers].Children}, {[Customers].[All Customers]})) ON ROWS from [Sales] ",
"Axis #0:\n"
Expand All @@ -191,6 +194,25 @@ public void testDelegatingTupleListSlice() {
+ "Row #0: \n"
+ "Row #1: \n"
+ "Row #2: 565,238.13\n");
Locus.execute(
(RolapConnection)getTestContext().getConnection(),
"testDelegatingTupleListSlice",
new Locus.Action<Void>() {
public Void execute() {
// Unit test
final Member genderFMember = xxx("[Gender].[F]");
final Member storeUsaMember = xxx("[Store].[USA]");
final List<List<Member>> arrayList =
new ArrayList<List<Member>>();
final TupleList fm =
new DelegatingTupleList(2, arrayList);
fm.addTuple(genderFMember, storeUsaMember);
final List<Member> sliced = fm.slice(0);
assertEquals(2, sliced.size());
assertEquals(1, fm.size());
return null;
}
});
}

private void checkProject(TupleList fm) {
Expand Down

0 comments on commit 6880390

Please sign in to comment.