Skip to content

Commit

Permalink
MONDRIAN: Minimal testcase for bug 1642828.
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//open/mondrian/": change = 8591]
  • Loading branch information
julianhyde committed Jan 26, 2007
1 parent 5f7575c commit ad30f57
Showing 1 changed file with 20 additions and 25 deletions.
45 changes: 20 additions & 25 deletions testsrc/main/mondrian/test/ClearViewTest.java
Expand Up @@ -11,20 +11,6 @@
*/
package mondrian.test;

import mondrian.olap.*;
import mondrian.olap.type.NumericType;
import mondrian.olap.type.Type;
import mondrian.rolap.cache.CachePool;
import mondrian.spi.UserDefinedFunction;

import java.util.regex.Pattern;
import java.util.List;
import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;

import junit.framework.Assert;

/**
* <code>ClearViewTest</code> is a test case which tests complex
* queries against the FoodMart database.
Expand All @@ -47,10 +33,13 @@ public ClearViewTest(String name) {
super(name);
}

private static final QueryAndResult[] sampleQueries = new QueryAndResult[] {
// 0
new QueryAndResult(
"with set [*NATIVE_CJ_SET] as \n" +
/**
* Complex query involving Head(Crossjoin(...)), which was the testcase for
* bug 1642828.
*/
public void testHeadCrossjoinComplex() {
assertQueryReturns(
"with set [*NATIVE_CJ_SET] as \n" +
"'NonEmptyCrossJoin([*BASE_MEMBERS_Product], [*BASE_MEMBERS_Education Level])' \n" +
"set [*GENERATED_MEMBERS_Measures] as \n" +
"'{[Measures].[Unit Sales], [Measures].[Store Cost], [Measures].[*SUMMARY_METRIC_0]}' \n" +
Expand All @@ -76,7 +65,7 @@ public ClearViewTest(String name) {
"Generate([*NATIVE_CJ_SET], \n" +
"{([Product].CurrentMember, [Education Level].CurrentMember)}))) ON ROWS \n" +
"from [Sales]\n",
"Axis #0:\n" +
fold("Axis #0:\n" +
"{}\n" +
"Axis #1:\n" +
"{[Measures].[Unit Sales]}\n" +
Expand Down Expand Up @@ -158,15 +147,21 @@ public ClearViewTest(String name) {
"Row #17: 35,492\n" +
"Row #18: 14,744\n" +
"Row #18: 12,638.49\n" +
"Row #18: 50,236\n"
),
"Row #18: 50,236\n"));
}

};

public void testSample0() {
assertQueryReturns(sampleQueries[0].query, sampleQueries[0].result);
/**
* Simplified version of {@link #testHeadCrossjoinComplex()}.
*/
public void testHeadCrossjoin() {
assertAxisReturns(
"Head(Crossjoin([Gender].Members, [Marital Status].Members), 4)",
fold("{[Gender].[All Gender], [Marital Status].[All Marital Status]}\n" +
"{[Gender].[All Gender], [Marital Status].[All Marital Status].[M]}\n" +
"{[Gender].[All Gender], [Marital Status].[All Marital Status].[S]}\n" +
"{[Gender].[All Gender].[F], [Marital Status].[All Marital Status]}"));
}

}

// End ClearViewTest.java

0 comments on commit ad30f57

Please sign in to comment.