summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlzhang2011-09-27 05:18:33 (EDT)
committer xgu2011-09-27 05:18:33 (EDT)
commitab271169d4bbd8d14cf41c750c996b95ccc99639 (patch)
tree1258ac76ecba61335ea2cd8cf34e7c5e8b564746
parent3eda780182ee5a7ef3a316f7ff8d8211e0ad1c84 (diff)
downloadorg.eclipse.birt-ab271169d4bbd8d14cf41c750c996b95ccc99639.zip
org.eclipse.birt-ab271169d4bbd8d14cf41c750c996b95ccc99639.tar.gz
org.eclipse.birt-ab271169d4bbd8d14cf41c750c996b95ccc99639.tar.bz2
Checkin: Add Test cases for MDX Functions
"YearToDate,QuarterToDate,PreviousNPeriod"
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunctionTest.java219
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/QuarterToDateFunctionTest.java123
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/YearToDateFunctionTest.java130
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions.txt1
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions1.txt2
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions2.txt3
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions3.txt49
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions4.txt7
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions.txt1
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions1.txt8
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions2.txt9
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions3.txt231
-rw-r--r--data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions4.txt35
13 files changed, 818 insertions, 0 deletions
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunctionTest.java b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunctionTest.java
new file mode 100644
index 0000000..b01e059
--- /dev/null
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/PreviousNPeriodsFunctionTest.java
@@ -0,0 +1,219 @@
+package org.eclipse.birt.data.engine.olap.data.impl.aggregation.function;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+
+public class PreviousNPeriodsFunctionTest extends TestCase
+{
+ protected void setUp( ) throws Exception
+ {
+ super.setUp( );
+ }
+
+ /*
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown( ) throws Exception
+ {
+ super.tearDown( );
+ }
+
+ public void testFunctions1( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 3, 8, 7
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_QUARTER,
+ TimeMember.TIME_LEVEL_TYPE_MONTH,
+ TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_YEAR,
+ 1 )
+ .getResult( member );
+ int[] result = new int[]{
+ 2001, 3, 8, 7
+ };
+ assertEquals( resultMember.getMemberValue( )[0], result[0] );
+ assertEquals( resultMember.getMemberValue( )[1], result[1] );
+ assertEquals( resultMember.getMemberValue( )[2], result[2] );
+ assertEquals( resultMember.getMemberValue( )[3], result[3] );
+ }
+
+ public void testFunctions2( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 3, 8, 7
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_QUARTER,
+ TimeMember.TIME_LEVEL_TYPE_MONTH,
+ TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_QUARTER, 5 ).getResult( member );
+ int[] result = new int[]{
+ 2001, 2, 5, 7
+ };
+ assertEquals( resultMember.getMemberValue( )[0], result[0] );
+ assertEquals( resultMember.getMemberValue( )[1], result[1] );
+ assertEquals( resultMember.getMemberValue( )[2], result[2] );
+ assertEquals( resultMember.getMemberValue( )[3], result[3] );
+ }
+
+ public void testFunctions3( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 3, 8, 7
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_QUARTER,
+ TimeMember.TIME_LEVEL_TYPE_MONTH,
+ TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_MONTH, 4 ).getResult( member );
+ int[] result = new int[]{
+ 2002, 2, 4, 7
+ };
+ assertEquals( resultMember.getMemberValue( )[0], result[0] );
+ assertEquals( resultMember.getMemberValue( )[1], result[1] );
+ assertEquals( resultMember.getMemberValue( )[2], result[2] );
+ assertEquals( resultMember.getMemberValue( )[3], result[3] );
+ }
+
+ public void testFunctions4( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 3, 8, 7
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_QUARTER,
+ TimeMember.TIME_LEVEL_TYPE_MONTH,
+ TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH, 4 ).getResult( member );
+ int[] result = new int[]{
+ 2002, 3, 8, 3
+ };
+ assertEquals( resultMember.getMemberValue( )[0], result[0] );
+ assertEquals( resultMember.getMemberValue( )[1], result[1] );
+ assertEquals( resultMember.getMemberValue( )[2], result[2] );
+ assertEquals( resultMember.getMemberValue( )[3], result[3] );
+ }
+
+ public void testFunctions5( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 3, 8, 7
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_QUARTER,
+ TimeMember.TIME_LEVEL_TYPE_MONTH,
+ TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH, 10 ).getResult( member );
+ int[] result = new int[]{
+ 2002, 3, 7, 28
+ };
+ assertEquals( resultMember.getMemberValue( )[0], result[0] );
+ assertEquals( resultMember.getMemberValue( )[1], result[1] );
+ assertEquals( resultMember.getMemberValue( )[2], result[2] );
+ assertEquals( resultMember.getMemberValue( )[3], result[3] );
+ }
+
+ public void testFunctions6( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 8, 7
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_MONTH,
+ TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH, 10 ).getResult( member );
+ int[] result = new int[]{
+ 2002, 7, 28
+ };
+ assertEquals( resultMember.getMemberValue( )[0], result[0] );
+ assertEquals( resultMember.getMemberValue( )[1], result[1] );
+ assertEquals( resultMember.getMemberValue( )[2], result[2] );
+ }
+
+ public void testFunctions7( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 8, 3
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_MONTH,
+ TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH, 5 ).getResult( member );
+ int[] result = new int[]{
+ 2002, 7, 2
+ };
+ assertEquals( resultMember.getMemberValue( )[0], result[0] );
+ assertEquals( resultMember.getMemberValue( )[1], result[1] );
+ assertEquals( resultMember.getMemberValue( )[2], result[2] );
+ }
+
+ public void testFunctions8( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 125
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_DAY_OF_YEAR, 25 ).getResult( member );
+ int[] result = new int[]{
+ 2002, 100
+ };
+ assertEquals( resultMember.getMemberValue( )[0], result[0] );
+ assertEquals( resultMember.getMemberValue( )[1], result[1] );
+ }
+
+ public void testFunctions9( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 23
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ TimeMember resultMember = TimeFunctionFactory.createParallelPeriodFunction( TimeMember.TIME_LEVEL_TYPE_WEEK_OF_YEAR, 10 ).getResult( member );
+ int[] result = new int[]{
+ 2002, 13
+ };
+ assertEquals( resultMember.getMemberValue( )[0], result[0] );
+ assertEquals( resultMember.getMemberValue( )[1], result[1] );
+ }
+}
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/QuarterToDateFunctionTest.java b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/QuarterToDateFunctionTest.java
new file mode 100644
index 0000000..acde73d
--- /dev/null
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/QuarterToDateFunctionTest.java
@@ -0,0 +1,123 @@
+package org.eclipse.birt.data.engine.olap.data.impl.aggregation.function;
+
+import java.io.IOException;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import testutil.BaseTestCase;
+public class QuarterToDateFunctionTest extends BaseTestCase
+{
+ protected void setUp( ) throws Exception
+ {
+ super.setUp( );
+ }
+
+ /*
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown( ) throws Exception
+ {
+ super.tearDown( );
+ }
+
+ private void printResult( List<TimeMember> resultMember )
+ throws IOException
+ {
+ for ( int i = 0; i < resultMember.size( ); i++ )
+ {
+ int[] resultValues = resultMember.get( i ).getMemberValue( );
+ for ( int j = 0; j < resultValues.length; j++ )
+ {
+ testPrint( String.valueOf( resultValues[j] ) );
+ testPrint( " " );
+ }
+ testPrint( "\n" );
+ }
+ }
+
+ public void testFunctions( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 2
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_QUARTER
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ List<TimeMember> resultMember = TimeFunctionFactory.createPeriodsToDateFunction( TimeMember.TIME_LEVEL_TYPE_QUARTER ).getResult( member );
+ printResult( resultMember );
+ this.checkOutputFile( );
+ }
+
+ public void testFunctions1( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 8
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ List<TimeMember> resultMember = TimeFunctionFactory.createPeriodsToDateFunction( TimeMember.TIME_LEVEL_TYPE_QUARTER ).getResult( member );
+ printResult( resultMember );
+ this.checkOutputFile( );
+ }
+
+ public void testFunctions2( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 3, 9
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_QUARTER,
+ TimeMember.TIME_LEVEL_TYPE_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ List<TimeMember> resultMember = TimeFunctionFactory.createPeriodsToDateFunction( TimeMember.TIME_LEVEL_TYPE_QUARTER ).getResult( member );
+ printResult( resultMember );
+ this.checkOutputFile( );
+ }
+
+ public void testFunctions3( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 3, 8, 18
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_QUARTER,
+ TimeMember.TIME_LEVEL_TYPE_MONTH,
+ TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ List<TimeMember> resultMember = TimeFunctionFactory.createPeriodsToDateFunction( TimeMember.TIME_LEVEL_TYPE_QUARTER ).getResult( member );
+ printResult( resultMember );
+ this.checkOutputFile( );
+ }
+
+ public void testFunctions4( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 3, 8, 3
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_QUARTER,
+ TimeMember.TIME_LEVEL_TYPE_MONTH,
+ TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ List<TimeMember> resultMember = TimeFunctionFactory.createPeriodsToDateFunction( TimeMember.TIME_LEVEL_TYPE_QUARTER ).getResult( member );
+ printResult( resultMember );
+ this.checkOutputFile( );
+ }
+}
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/YearToDateFunctionTest.java b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/YearToDateFunctionTest.java
new file mode 100644
index 0000000..ea60514
--- /dev/null
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/YearToDateFunctionTest.java
@@ -0,0 +1,130 @@
+
+package org.eclipse.birt.data.engine.olap.data.impl.aggregation.function;
+
+import java.io.IOException;
+import java.util.List;
+
+import testutil.BaseTestCase;
+
+public class YearToDateFunctionTest extends BaseTestCase
+{
+
+ protected void setUp( ) throws Exception
+ {
+ super.setUp( );
+ }
+
+ /*
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown( ) throws Exception
+ {
+ super.tearDown( );
+ }
+
+ private void printResult( List<TimeMember> resultMember )
+ throws IOException
+ {
+ for ( int i = 0; i < resultMember.size( ); i++ )
+ {
+ int[] resultValues = resultMember.get( i ).getMemberValue( );
+ for ( int j = 0; j < resultValues.length; j++ )
+ {
+ testPrint( String.valueOf( resultValues[j]) );
+ testPrint( " " );
+ }
+ testPrint( "\n" );
+ }
+ }
+
+ public void testFunctions( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ List<TimeMember> resultMember = TimeFunctionFactory.createPeriodsToDateFunction( TimeMember.TIME_LEVEL_TYPE_YEAR )
+ .getResult( member );
+
+ printResult( resultMember );
+ this.checkOutputFile( );
+ }
+
+ public void testFunctions1( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 8
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ List<TimeMember> resultMember = TimeFunctionFactory.createPeriodsToDateFunction( TimeMember.TIME_LEVEL_TYPE_YEAR )
+ .getResult( member );
+ printResult( resultMember );
+ this.checkOutputFile( );
+ }
+
+ public void testFunctions2( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2002, 3, 9
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_QUARTER,
+ TimeMember.TIME_LEVEL_TYPE_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ List<TimeMember> resultMember = TimeFunctionFactory.createPeriodsToDateFunction( TimeMember.TIME_LEVEL_TYPE_YEAR )
+ .getResult( member );
+ printResult( resultMember );
+ this.checkOutputFile( );
+ }
+
+ public void testFunctions3( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2004, 3, 8, 18
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_QUARTER,
+ TimeMember.TIME_LEVEL_TYPE_MONTH,
+ TimeMember.TIME_LEVEL_TYPE_DAY_OF_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ List<TimeMember> resultMember = TimeFunctionFactory.createPeriodsToDateFunction( TimeMember.TIME_LEVEL_TYPE_YEAR )
+ .getResult( member );
+
+ printResult( resultMember );
+ this.checkOutputFile( );
+ }
+
+ public void testFunctions4( ) throws IOException
+ {
+ int[] values = new int[]{
+ 2004, 3, 8, 4
+ };
+ String[] levels = new String[]{
+ TimeMember.TIME_LEVEL_TYPE_YEAR,
+ TimeMember.TIME_LEVEL_TYPE_QUARTER,
+ TimeMember.TIME_LEVEL_TYPE_MONTH,
+ TimeMember.TIME_LEVEL_TYPE_WEEK_OF_MONTH
+ };
+ TimeMember member = new TimeMember( values, levels );
+
+ List<TimeMember> resultMember = TimeFunctionFactory.createPeriodsToDateFunction( TimeMember.TIME_LEVEL_TYPE_YEAR )
+ .getResult( member );
+ printResult( resultMember );
+ this.checkOutputFile( );
+ }
+}
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions.txt b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions.txt
new file mode 100644
index 0000000..b1a25b2
--- /dev/null
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions.txt
@@ -0,0 +1 @@
+2002 2
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions1.txt b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions1.txt
new file mode 100644
index 0000000..8f94552
--- /dev/null
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions1.txt
@@ -0,0 +1,2 @@
+2002 8
+2002 7
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions2.txt b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions2.txt
new file mode 100644
index 0000000..15107b3
--- /dev/null
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions2.txt
@@ -0,0 +1,3 @@
+2002 3 9
+2002 3 8
+2002 3 7
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions3.txt b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions3.txt
new file mode 100644
index 0000000..1693066
--- /dev/null
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions3.txt
@@ -0,0 +1,49 @@
+2002 3 8 18
+2002 3 8 17
+2002 3 8 16
+2002 3 8 15
+2002 3 8 14
+2002 3 8 13
+2002 3 8 12
+2002 3 8 11
+2002 3 8 10
+2002 3 8 9
+2002 3 8 8
+2002 3 8 7
+2002 3 8 6
+2002 3 8 5
+2002 3 8 4
+2002 3 8 3
+2002 3 8 2
+2002 3 8 1
+2002 3 7 31
+2002 3 7 30
+2002 3 7 29
+2002 3 7 28
+2002 3 7 27
+2002 3 7 26
+2002 3 7 25
+2002 3 7 24
+2002 3 7 23
+2002 3 7 22
+2002 3 7 21
+2002 3 7 20
+2002 3 7 19
+2002 3 7 18
+2002 3 7 17
+2002 3 7 16
+2002 3 7 15
+2002 3 7 14
+2002 3 7 13
+2002 3 7 12
+2002 3 7 11
+2002 3 7 10
+2002 3 7 9
+2002 3 7 8
+2002 3 7 7
+2002 3 7 6
+2002 3 7 5
+2002 3 7 4
+2002 3 7 3
+2002 3 7 2
+2002 3 7 1
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions4.txt b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions4.txt
new file mode 100644
index 0000000..cb438ce
--- /dev/null
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/QuarterToDateFunctionTest.testFunctions4.txt
@@ -0,0 +1,7 @@
+2002 3 8 3
+2002 3 8 2
+2002 3 7 5
+2002 3 7 4
+2002 3 7 3
+2002 3 7 2
+2002 3 7 1
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions.txt b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions.txt
new file mode 100644
index 0000000..1497a5b
--- /dev/null
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions.txt
@@ -0,0 +1 @@
+2002
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions1.txt b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions1.txt
new file mode 100644
index 0000000..9b31cfc
--- /dev/null
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions1.txt
@@ -0,0 +1,8 @@
+2002 8
+2002 7
+2002 6
+2002 5
+2002 4
+2002 3
+2002 2
+2002 1
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions2.txt b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions2.txt
new file mode 100644
index 0000000..3aeaa2a
--- /dev/null
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions2.txt
@@ -0,0 +1,9 @@
+2002 3 9
+2002 3 8
+2002 3 7
+2002 2 6
+2002 2 5
+2002 2 4
+2002 1 3
+2002 1 2
+2002 1 1
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions3.txt b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions3.txt
new file mode 100644
index 0000000..1b7051f
--- /dev/null
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions3.txt
@@ -0,0 +1,231 @@
+2004 3 8 18
+2004 3 8 17
+2004 3 8 16
+2004 3 8 15
+2004 3 8 14
+2004 3 8 13
+2004 3 8 12
+2004 3 8 11
+2004 3 8 10
+2004 3 8 9
+2004 3 8 8
+2004 3 8 7
+2004 3 8 6
+2004 3 8 5
+2004 3 8 4
+2004 3 8 3
+2004 3 8 2
+2004 3 8 1
+2004 3 7 31
+2004 3 7 30
+2004 3 7 29
+2004 3 7 28
+2004 3 7 27
+2004 3 7 26
+2004 3 7 25
+2004 3 7 24
+2004 3 7 23
+2004 3 7 22
+2004 3 7 21
+2004 3 7 20
+2004 3 7 19
+2004 3 7 18
+2004 3 7 17
+2004 3 7 16
+2004 3 7 15
+2004 3 7 14
+2004 3 7 13
+2004 3 7 12
+2004 3 7 11
+2004 3 7 10
+2004 3 7 9
+2004 3 7 8
+2004 3 7 7
+2004 3 7 6
+2004 3 7 5
+2004 3 7 4
+2004 3 7 3
+2004 3 7 2
+2004 3 7 1
+2004 2 6 30
+2004 2 6 29
+2004 2 6 28
+2004 2 6 27
+2004 2 6 26
+2004 2 6 25
+2004 2 6 24
+2004 2 6 23
+2004 2 6 22
+2004 2 6 21
+2004 2 6 20
+2004 2 6 19
+2004 2 6 18
+2004 2 6 17
+2004 2 6 16
+2004 2 6 15
+2004 2 6 14
+2004 2 6 13
+2004 2 6 12
+2004 2 6 11
+2004 2 6 10
+2004 2 6 9
+2004 2 6 8
+2004 2 6 7
+2004 2 6 6
+2004 2 6 5
+2004 2 6 4
+2004 2 6 3
+2004 2 6 2
+2004 2 6 1
+2004 2 5 31
+2004 2 5 30
+2004 2 5 29
+2004 2 5 28
+2004 2 5 27
+2004 2 5 26
+2004 2 5 25
+2004 2 5 24
+2004 2 5 23
+2004 2 5 22
+2004 2 5 21
+2004 2 5 20
+2004 2 5 19
+2004 2 5 18
+2004 2 5 17
+2004 2 5 16
+2004 2 5 15
+2004 2 5 14
+2004 2 5 13
+2004 2 5 12
+2004 2 5 11
+2004 2 5 10
+2004 2 5 9
+2004 2 5 8
+2004 2 5 7
+2004 2 5 6
+2004 2 5 5
+2004 2 5 4
+2004 2 5 3
+2004 2 5 2
+2004 2 5 1
+2004 2 4 30
+2004 2 4 29
+2004 2 4 28
+2004 2 4 27
+2004 2 4 26
+2004 2 4 25
+2004 2 4 24
+2004 2 4 23
+2004 2 4 22
+2004 2 4 21
+2004 2 4 20
+2004 2 4 19
+2004 2 4 18
+2004 2 4 17
+2004 2 4 16
+2004 2 4 15
+2004 2 4 14
+2004 2 4 13
+2004 2 4 12
+2004 2 4 11
+2004 2 4 10
+2004 2 4 9
+2004 2 4 8
+2004 2 4 7
+2004 2 4 6
+2004 2 4 5
+2004 2 4 4
+2004 2 4 3
+2004 2 4 2
+2004 2 4 1
+2004 1 3 31
+2004 1 3 30
+2004 1 3 29
+2004 1 3 28
+2004 1 3 27
+2004 1 3 26
+2004 1 3 25
+2004 1 3 24
+2004 1 3 23
+2004 1 3 22
+2004 1 3 21
+2004 1 3 20
+2004 1 3 19
+2004 1 3 18
+2004 1 3 17
+2004 1 3 16
+2004 1 3 15
+2004 1 3 14
+2004 1 3 13
+2004 1 3 12
+2004 1 3 11
+2004 1 3 10
+2004 1 3 9
+2004 1 3 8
+2004 1 3 7
+2004 1 3 6
+2004 1 3 5
+2004 1 3 4
+2004 1 3 3
+2004 1 3 2
+2004 1 3 1
+2004 1 2 29
+2004 1 2 28
+2004 1 2 27
+2004 1 2 26
+2004 1 2 25
+2004 1 2 24
+2004 1 2 23
+2004 1 2 22
+2004 1 2 21
+2004 1 2 20
+2004 1 2 19
+2004 1 2 18
+2004 1 2 17
+2004 1 2 16
+2004 1 2 15
+2004 1 2 14
+2004 1 2 13
+2004 1 2 12
+2004 1 2 11
+2004 1 2 10
+2004 1 2 9
+2004 1 2 8
+2004 1 2 7
+2004 1 2 6
+2004 1 2 5
+2004 1 2 4
+2004 1 2 3
+2004 1 2 2
+2004 1 2 1
+2004 1 1 31
+2004 1 1 30
+2004 1 1 29
+2004 1 1 28
+2004 1 1 27
+2004 1 1 26
+2004 1 1 25
+2004 1 1 24
+2004 1 1 23
+2004 1 1 22
+2004 1 1 21
+2004 1 1 20
+2004 1 1 19
+2004 1 1 18
+2004 1 1 17
+2004 1 1 16
+2004 1 1 15
+2004 1 1 14
+2004 1 1 13
+2004 1 1 12
+2004 1 1 11
+2004 1 1 10
+2004 1 1 9
+2004 1 1 8
+2004 1 1 7
+2004 1 1 6
+2004 1 1 5
+2004 1 1 4
+2004 1 1 3
+2004 1 1 2
+2004 1 1 1
diff --git a/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions4.txt b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions4.txt
new file mode 100644
index 0000000..0c75f23
--- /dev/null
+++ b/data/org.eclipse.birt.data.tests/test/org/eclipse/birt/data/engine/olap/data/impl/aggregation/function/golden/YearToDateFunctionTest.testFunctions4.txt
@@ -0,0 +1,35 @@
+2004 3 8 4
+2004 3 8 3
+2004 3 8 2
+2004 3 8 1
+2004 3 7 5
+2004 3 7 4
+2004 3 7 3
+2004 3 7 2
+2004 2 6 5
+2004 2 6 4
+2004 2 6 3
+2004 2 6 2
+2004 2 6 1
+2004 2 5 5
+2004 2 5 4
+2004 2 5 3
+2004 2 5 2
+2004 2 4 5
+2004 2 4 4
+2004 2 4 3
+2004 2 4 2
+2004 1 3 5
+2004 1 3 4
+2004 1 3 3
+2004 1 3 2
+2004 1 3 1
+2004 1 2 4
+2004 1 2 3
+2004 1 2 2
+2004 1 2 1
+2004 1 1 5
+2004 1 1 4
+2004 1 1 3
+2004 1 1 2
+2003 4 12 5