Skip to content

Commit

Permalink
Merge pull request #131 from jainkaran98/fix-goldfile-generation
Browse files Browse the repository at this point in the history
fix: add missing goldfile for diff DBs
  • Loading branch information
sahil-here authored Aug 4, 2023
2 parents 1e0071f + 2360985 commit 158803f
Show file tree
Hide file tree
Showing 41 changed files with 1,904 additions and 235 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<testCase name="testAddWithDivision">
<testInstance formula="customnumber1__c/(customnumber2__c + 1)" returntype="Double" precision="12" scale="2">
<SqlOutput nullAsNull="true">
<Sql>(COALESCE($!s0s!$.customnumber1__c, 0)/(COALESCE($!s0s!$.customnumber2__c, 0)+1))</Sql>
<Guard>(COALESCE($!s0s!$.customnumber2__c, 0)+1)=0</Guard>
</SqlOutput>
<SqlOutput nullAsNull="false">
<Sql>($!s0s!$.customnumber1__c/($!s0s!$.customnumber2__c+1))</Sql>
<Guard>($!s0s!$.customnumber2__c+1)=0</Guard>
</SqlOutput>
<result>
<inputvalues>[9, 9]</inputvalues>
<formula>0.9</formula>
<sql>0.9</sql>
<formulaNullAsNull>0.9</formulaNullAsNull>
<sqlNullAsNull>0.9</sqlNullAsNull>
</result>
<result>
<inputvalues>[9, 10]</inputvalues>
<formula>0.81818181818181818181818181818182</formula>
<sql>0.818181818</sql>
<formulaNullAsNull>0.81818181818181818181818181818182</formulaNullAsNull>
<sqlNullAsNull>0.818181818</sqlNullAsNull>
</result>
<result>
<inputvalues>[12, 11]</inputvalues>
<formula>1</formula>
<sql>1</sql>
<formulaNullAsNull>1</formulaNullAsNull>
<sqlNullAsNull>1</sqlNullAsNull>
</result>
</testInstance>
<testInstance formula="customnumber2__c/(customnumber1__c + 1)" returntype="Double" precision="12" scale="2">
<SqlOutput nullAsNull="true">
<Sql>(COALESCE($!s0s!$.customnumber2__c, 0)/(COALESCE($!s0s!$.customnumber1__c, 0)+1))</Sql>
<Guard>(COALESCE($!s0s!$.customnumber1__c, 0)+1)=0</Guard>
</SqlOutput>
<SqlOutput nullAsNull="false">
<Sql>($!s0s!$.customnumber2__c/($!s0s!$.customnumber1__c+1))</Sql>
<Guard>($!s0s!$.customnumber1__c+1)=0</Guard>
</SqlOutput>
<result>
<inputvalues>[ 9, 9]</inputvalues>
<formula>0.9</formula>
<sql>0.9</sql>
<formulaNullAsNull>0.9</formulaNullAsNull>
<sqlNullAsNull>0.9</sqlNullAsNull>
</result>
<result>
<inputvalues>[ 10, 9]</inputvalues>
<formula>1</formula>
<sql>1</sql>
<formulaNullAsNull>1</formulaNullAsNull>
<sqlNullAsNull>1</sqlNullAsNull>
</result>
<result>
<inputvalues>[ 11, 12]</inputvalues>
<formula>0.84615384615384615384615384615385</formula>
<sql>0.846153846</sql>
<formulaNullAsNull>0.84615384615384615384615384615385</formulaNullAsNull>
<sqlNullAsNull>0.846153846</sqlNullAsNull>
</result>
</testInstance>
</testCase>
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<testCase name="testAddWithDivisionSimple">
<testInstance formula="customnumber1__c/customnumber2__c + 1" returntype="Double" precision="12" scale="2">
<SqlOutput nullAsNull="true">
<Sql>((COALESCE($!s0s!$.customnumber1__c, 0)/COALESCE($!s0s!$.customnumber2__c, 0))+1)</Sql>
<Guard>COALESCE($!s0s!$.customnumber2__c, 0)=0</Guard>
</SqlOutput>
<SqlOutput nullAsNull="false">
<Sql>(($!s0s!$.customnumber1__c/$!s0s!$.customnumber2__c)+1)</Sql>
<Guard>$!s0s!$.customnumber2__c=0</Guard>
</SqlOutput>
<result>
<inputvalues>[9, 9]</inputvalues>
<formula>2</formula>
<sql>2</sql>
<formulaNullAsNull>2</formulaNullAsNull>
<sqlNullAsNull>2</sqlNullAsNull>
</result>
<result>
<inputvalues>[9, 10]</inputvalues>
<formula>1.9</formula>
<sql>1.9</sql>
<formulaNullAsNull>1.9</formulaNullAsNull>
<sqlNullAsNull>1.9</sqlNullAsNull>
</result>
<result>
<inputvalues>[12, 11]</inputvalues>
<formula>2.09090909090909090909090909090909</formula>
<sql>2.090909091</sql>
<formulaNullAsNull>2.09090909090909090909090909090909</formulaNullAsNull>
<sqlNullAsNull>2.090909091</sqlNullAsNull>
</result>
</testInstance>
<testInstance formula="customnumber2__c/customnumber1__c + 1" returntype="Double" precision="12" scale="2">
<SqlOutput nullAsNull="true">
<Sql>((COALESCE($!s0s!$.customnumber2__c, 0)/COALESCE($!s0s!$.customnumber1__c, 0))+1)</Sql>
<Guard>COALESCE($!s0s!$.customnumber1__c, 0)=0</Guard>
</SqlOutput>
<SqlOutput nullAsNull="false">
<Sql>(($!s0s!$.customnumber2__c/$!s0s!$.customnumber1__c)+1)</Sql>
<Guard>$!s0s!$.customnumber1__c=0</Guard>
</SqlOutput>
<result>
<inputvalues>[ 9, 9]</inputvalues>
<formula>2</formula>
<sql>2</sql>
<formulaNullAsNull>2</formulaNullAsNull>
<sqlNullAsNull>2</sqlNullAsNull>
</result>
<result>
<inputvalues>[ 10, 9]</inputvalues>
<formula>2.11111111111111111111111111111111</formula>
<sql>2.111111111</sql>
<formulaNullAsNull>2.11111111111111111111111111111111</formulaNullAsNull>
<sqlNullAsNull>2.111111111</sqlNullAsNull>
</result>
<result>
<inputvalues>[ 11, 12]</inputvalues>
<formula>1.91666666666666666666666666666667</formula>
<sql>1.916666667</sql>
<formulaNullAsNull>1.91666666666666666666666666666667</formulaNullAsNull>
<sqlNullAsNull>1.916666667</sqlNullAsNull>
</result>
</testInstance>
</testCase>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<testCase name="testMonths">
<testInstance formula="month(customdate1__c)" returntype="Double" precision="12" scale="2">
<SqlOutput nullAsNull="true">
<Sql>EXTRACT(MONTH FROM $!s0s!$.customdate1__c)</Sql>
<Guard>null</Guard>
</SqlOutput>
<SqlOutput nullAsNull="false">
<Sql>EXTRACT(MONTH FROM $!s0s!$.customdate1__c)</Sql>
<Guard>null</Guard>
</SqlOutput>
<result>
<inputvalues>[2023:02:27]</inputvalues>
<formula>2</formula>
<sql>2</sql>
<formulaNullAsNull>2</formulaNullAsNull>
<sqlNullAsNull>2</sqlNullAsNull>
</result>
</testInstance>
</testCase>
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<testCase name="testSubWithDivision">
<testInstance formula="customnumber1__c/(customnumber2__c - 1)" returntype="Double" precision="12" scale="2">
<SqlOutput nullAsNull="true">
<Sql>(COALESCE($!s0s!$.customnumber1__c, 0)/(COALESCE($!s0s!$.customnumber2__c, 0)-1))</Sql>
<Guard>(COALESCE($!s0s!$.customnumber2__c, 0)-1)=0</Guard>
</SqlOutput>
<SqlOutput nullAsNull="false">
<Sql>($!s0s!$.customnumber1__c/($!s0s!$.customnumber2__c-1))</Sql>
<Guard>($!s0s!$.customnumber2__c-1)=0</Guard>
</SqlOutput>
<result>
<inputvalues>[9, 9]</inputvalues>
<formula>1.125</formula>
<sql>1.125</sql>
<formulaNullAsNull>1.125</formulaNullAsNull>
<sqlNullAsNull>1.125</sqlNullAsNull>
</result>
<result>
<inputvalues>[9, 10]</inputvalues>
<formula>1</formula>
<sql>1</sql>
<formulaNullAsNull>1</formulaNullAsNull>
<sqlNullAsNull>1</sqlNullAsNull>
</result>
<result>
<inputvalues>[12, 11]</inputvalues>
<formula>1.2</formula>
<sql>1.2</sql>
<formulaNullAsNull>1.2</formulaNullAsNull>
<sqlNullAsNull>1.2</sqlNullAsNull>
</result>
</testInstance>
<testInstance formula="customnumber2__c/(customnumber1__c - 1)" returntype="Double" precision="12" scale="2">
<SqlOutput nullAsNull="true">
<Sql>(COALESCE($!s0s!$.customnumber2__c, 0)/(COALESCE($!s0s!$.customnumber1__c, 0)-1))</Sql>
<Guard>(COALESCE($!s0s!$.customnumber1__c, 0)-1)=0</Guard>
</SqlOutput>
<SqlOutput nullAsNull="false">
<Sql>($!s0s!$.customnumber2__c/($!s0s!$.customnumber1__c-1))</Sql>
<Guard>($!s0s!$.customnumber1__c-1)=0</Guard>
</SqlOutput>
<result>
<inputvalues>[ 9, 9]</inputvalues>
<formula>1.125</formula>
<sql>1.125</sql>
<formulaNullAsNull>1.125</formulaNullAsNull>
<sqlNullAsNull>1.125</sqlNullAsNull>
</result>
<result>
<inputvalues>[ 10, 9]</inputvalues>
<formula>1.25</formula>
<sql>1.25</sql>
<formulaNullAsNull>1.25</formulaNullAsNull>
<sqlNullAsNull>1.25</sqlNullAsNull>
</result>
<result>
<inputvalues>[ 11, 12]</inputvalues>
<formula>1</formula>
<sql>1</sql>
<formulaNullAsNull>1</formulaNullAsNull>
<sqlNullAsNull>1</sqlNullAsNull>
</result>
</testInstance>
</testCase>
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<testCase name="testSubWithDivisionSimple">
<testInstance formula="customnumber1__c/customnumber2__c - 1" returntype="Double" precision="12" scale="2">
<SqlOutput nullAsNull="true">
<Sql>((COALESCE($!s0s!$.customnumber1__c, 0)/COALESCE($!s0s!$.customnumber2__c, 0))-1)</Sql>
<Guard>COALESCE($!s0s!$.customnumber2__c, 0)=0</Guard>
</SqlOutput>
<SqlOutput nullAsNull="false">
<Sql>(($!s0s!$.customnumber1__c/$!s0s!$.customnumber2__c)-1)</Sql>
<Guard>$!s0s!$.customnumber2__c=0</Guard>
</SqlOutput>
<result>
<inputvalues>[9, 9]</inputvalues>
<formula>0</formula>
<sql>0</sql>
<formulaNullAsNull>0</formulaNullAsNull>
<sqlNullAsNull>0</sqlNullAsNull>
</result>
<result>
<inputvalues>[9, 10]</inputvalues>
<formula>-0.1</formula>
<sql>-0.1</sql>
<formulaNullAsNull>-0.1</formulaNullAsNull>
<sqlNullAsNull>-0.1</sqlNullAsNull>
</result>
<result>
<inputvalues>[12, 11]</inputvalues>
<formula>0.09090909090909090909090909090909</formula>
<sql>0.090909091</sql>
<formulaNullAsNull>0.09090909090909090909090909090909</formulaNullAsNull>
<sqlNullAsNull>0.090909091</sqlNullAsNull>
</result>
</testInstance>
<testInstance formula="customnumber2__c/customnumber1__c - 1" returntype="Double" precision="12" scale="2">
<SqlOutput nullAsNull="true">
<Sql>((COALESCE($!s0s!$.customnumber2__c, 0)/COALESCE($!s0s!$.customnumber1__c, 0))-1)</Sql>
<Guard>COALESCE($!s0s!$.customnumber1__c, 0)=0</Guard>
</SqlOutput>
<SqlOutput nullAsNull="false">
<Sql>(($!s0s!$.customnumber2__c/$!s0s!$.customnumber1__c)-1)</Sql>
<Guard>$!s0s!$.customnumber1__c=0</Guard>
</SqlOutput>
<result>
<inputvalues>[ 9, 9]</inputvalues>
<formula>0</formula>
<sql>0</sql>
<formulaNullAsNull>0</formulaNullAsNull>
<sqlNullAsNull>0</sqlNullAsNull>
</result>
<result>
<inputvalues>[ 10, 9]</inputvalues>
<formula>0.11111111111111111111111111111111</formula>
<sql>0.111111111</sql>
<formulaNullAsNull>0.11111111111111111111111111111111</formulaNullAsNull>
<sqlNullAsNull>0.111111111</sqlNullAsNull>
</result>
<result>
<inputvalues>[ 11, 12]</inputvalues>
<formula>-0.08333333333333333333333333333333</formula>
<sql>-0.083333333</sql>
<formulaNullAsNull>-0.08333333333333333333333333333333</formulaNullAsNull>
<sqlNullAsNull>-0.083333333</sqlNullAsNull>
</result>
</testInstance>
</testCase>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<testCase name="testTextFunctionWithCustomDate">
<testInstance formula="TEXT(customdate1__c)" returntype="Text">
<SqlOutput nullAsNull="true">
<Sql>(FORMAT_TIMESTAMP('%Y-%m-%d', $!s0s!$.customdate1__c, 'UTC'))</Sql>
<Guard>null</Guard>
</SqlOutput>
<SqlOutput nullAsNull="false">
<Sql>(FORMAT_TIMESTAMP('%Y-%m-%d', $!s0s!$.customdate1__c, 'UTC'))</Sql>
<Guard>null</Guard>
</SqlOutput>
</testInstance>
</testCase>
65 changes: 65 additions & 0 deletions h2-test/src/test/goldfiles/FormulaFields/testAddWithDivision.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<testCase name="testAddWithDivision">
<testInstance formula="customnumber1__c/(customnumber2__c + 1)" returntype="Double" precision="12" scale="2">
<SqlOutput nullAsNull="true">
<Sql>(COALESCE($!s0s!$.customnumber1__c, 0)/(COALESCE($!s0s!$.customnumber2__c, 0)+1))</Sql>
<Guard>(COALESCE($!s0s!$.customnumber2__c, 0)+1)=0</Guard>
</SqlOutput>
<SqlOutput nullAsNull="false">
<Sql>($!s0s!$.customnumber1__c/($!s0s!$.customnumber2__c+1))</Sql>
<Guard>($!s0s!$.customnumber2__c+1)=0</Guard>
</SqlOutput>
<result>
<inputvalues>[9, 9]</inputvalues>
<formula>0.9</formula>
<sql>0.9</sql>
<formulaNullAsNull>0.9</formulaNullAsNull>
<sqlNullAsNull>0.9</sqlNullAsNull>
</result>
<result>
<inputvalues>[9, 10]</inputvalues>
<formula>0.81818181818181818181818181818182</formula>
<sql>0.81818181818181818181818181818182</sql>
<formulaNullAsNull>0.81818181818181818181818181818182</formulaNullAsNull>
<sqlNullAsNull>0.81818181818181818181818181818182</sqlNullAsNull>
</result>
<result>
<inputvalues>[12, 11]</inputvalues>
<formula>1</formula>
<sql>1</sql>
<formulaNullAsNull>1</formulaNullAsNull>
<sqlNullAsNull>1</sqlNullAsNull>
</result>
</testInstance>
<testInstance formula="customnumber2__c/(customnumber1__c + 1)" returntype="Double" precision="12" scale="2">
<SqlOutput nullAsNull="true">
<Sql>(COALESCE($!s0s!$.customnumber2__c, 0)/(COALESCE($!s0s!$.customnumber1__c, 0)+1))</Sql>
<Guard>(COALESCE($!s0s!$.customnumber1__c, 0)+1)=0</Guard>
</SqlOutput>
<SqlOutput nullAsNull="false">
<Sql>($!s0s!$.customnumber2__c/($!s0s!$.customnumber1__c+1))</Sql>
<Guard>($!s0s!$.customnumber1__c+1)=0</Guard>
</SqlOutput>
<result>
<inputvalues>[ 9, 9]</inputvalues>
<formula>0.9</formula>
<sql>0.9</sql>
<formulaNullAsNull>0.9</formulaNullAsNull>
<sqlNullAsNull>0.9</sqlNullAsNull>
</result>
<result>
<inputvalues>[ 10, 9]</inputvalues>
<formula>1</formula>
<sql>1</sql>
<formulaNullAsNull>1</formulaNullAsNull>
<sqlNullAsNull>1</sqlNullAsNull>
</result>
<result>
<inputvalues>[ 11, 12]</inputvalues>
<formula>0.84615384615384615384615384615385</formula>
<sql>0.84615384615384615384615384615385</sql>
<formulaNullAsNull>0.84615384615384615384615384615385</formulaNullAsNull>
<sqlNullAsNull>0.84615384615384615384615384615385</sqlNullAsNull>
</result>
</testInstance>
</testCase>
Loading

0 comments on commit 158803f

Please sign in to comment.