Move init and test results data to separate repo.
This commit is contained in:
parent
96cc6d15b5
commit
d5466a91e6
21 changed files with 21 additions and 414048 deletions
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 463b73ecd040e19a4489c676e5fa5bbf7fea48df
|
||||
|
|
@ -50,7 +50,7 @@ func initMySQLDB() {
|
|||
|
||||
for _, dbName := range mySQLDBs {
|
||||
cmdLine := fmt.Sprintf("mysql -h 127.0.0.1 -u %s -p%s %s < %s",
|
||||
dbconfig.MySQLUser, dbconfig.MySQLPassword, dbName, "./init/data/mysql/"+dbName+".sql")
|
||||
dbconfig.MySQLUser, dbconfig.MySQLPassword, dbName, "./testdata/init/mysql/"+dbName+".sql")
|
||||
|
||||
fmt.Println(cmdLine)
|
||||
|
||||
|
|
@ -74,7 +74,6 @@ func initMySQLDB() {
|
|||
|
||||
panicOnError(err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func initPostgresDB() {
|
||||
|
|
@ -96,7 +95,7 @@ func initPostgresDB() {
|
|||
|
||||
for _, schemaName := range schemaNames {
|
||||
|
||||
execFile(db, "./init/data/postgres/"+schemaName+".sql")
|
||||
execFile(db, "./testdata/init/postgres/"+schemaName+".sql")
|
||||
|
||||
err = postgres.Generate("./.gentestdata", postgres.DBConnection{
|
||||
Host: dbconfig.Host,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"github.com/go-jet/jet/internal/testutils"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/table"
|
||||
"github.com/go-jet/jet/tests/testdata/common"
|
||||
"github.com/go-jet/jet/tests/testdata/results/common"
|
||||
"github.com/google/uuid"
|
||||
"time"
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ FROM test_sample.all_types;
|
|||
|
||||
assert.NilError(t, err)
|
||||
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/common/bool_operators.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/common/bool_operators.json")
|
||||
}
|
||||
|
||||
func TestFloatOperators(t *testing.T) {
|
||||
|
|
@ -290,7 +290,7 @@ LIMIT ?;
|
|||
|
||||
assert.NilError(t, err)
|
||||
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/common/float_operators.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/common/float_operators.json")
|
||||
}
|
||||
|
||||
func TestIntegerOperators(t *testing.T) {
|
||||
|
|
@ -429,7 +429,7 @@ LIMIT ?;
|
|||
|
||||
//testutils.PrintJson(dest)
|
||||
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/common/int_operators.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/common/int_operators.json")
|
||||
}
|
||||
|
||||
func TestStringOperators(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ ORDER BY actor.actor_id;
|
|||
|
||||
//testutils.PrintJson(dest)
|
||||
//testutils.SaveJsonFile(dest, "mysql/testdata/all_actors.json")
|
||||
testutils.AssertJSONFile(t, dest, "mysql/testdata/all_actors.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/mysql/all_actors.json")
|
||||
}
|
||||
|
||||
func TestSelectGroupByHaving(t *testing.T) {
|
||||
|
|
@ -138,7 +138,7 @@ ORDER BY payment.customer_id, SUM(payment.amount) ASC;
|
|||
assert.Equal(t, len(dest), 174)
|
||||
|
||||
//testutils.SaveJsonFile(dest, "mysql/testdata/customer_payment_sum.json")
|
||||
testutils.AssertJSONFile(t, dest, "mysql/testdata/customer_payment_sum.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/mysql/customer_payment_sum.json")
|
||||
}
|
||||
|
||||
func TestSubQuery(t *testing.T) {
|
||||
|
|
@ -174,7 +174,7 @@ func TestSubQuery(t *testing.T) {
|
|||
assert.NilError(t, err)
|
||||
|
||||
//testutils.SaveJsonFile(dest, "mysql/testdata/r_rating_films.json")
|
||||
testutils.AssertJSONFile(t, dest, "mysql/testdata/r_rating_films.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/mysql/r_rating_films.json")
|
||||
}
|
||||
|
||||
func TestSelectAndUnionInProjection(t *testing.T) {
|
||||
|
|
@ -405,7 +405,7 @@ LIMIT ?;
|
|||
|
||||
//testutils.SaveJsonFile(dest, "./mysql/testdata/lang_film_actor_inventory_rental.json")
|
||||
|
||||
testutils.AssertJSONFile(t, dest, "./mysql/testdata/lang_film_actor_inventory_rental.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/mysql/lang_film_actor_inventory_rental.json")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
1202
tests/mysql/testdata/all_actors.json
vendored
1202
tests/mysql/testdata/all_actors.json
vendored
File diff suppressed because it is too large
Load diff
3134
tests/mysql/testdata/customer_payment_sum.json
vendored
3134
tests/mysql/testdata/customer_payment_sum.json
vendored
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
9469
tests/mysql/testdata/r_rating_films.json
vendored
9469
tests/mysql/testdata/r_rating_films.json
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -6,7 +6,7 @@ import (
|
|||
. "github.com/go-jet/jet/postgres"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/jetdb/test_sample/table"
|
||||
"github.com/go-jet/jet/tests/testdata/common"
|
||||
"github.com/go-jet/jet/tests/testdata/results/common"
|
||||
"github.com/google/uuid"
|
||||
"gotest.tools/assert"
|
||||
"testing"
|
||||
|
|
@ -308,7 +308,7 @@ LIMIT $5;
|
|||
|
||||
assert.NilError(t, err)
|
||||
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/common/bool_operators.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/common/bool_operators.json")
|
||||
}
|
||||
|
||||
func TestFloatOperators(t *testing.T) {
|
||||
|
|
@ -406,7 +406,7 @@ LIMIT $35;
|
|||
|
||||
//testutils.PrintJson(dest)
|
||||
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/common/float_operators.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/common/float_operators.json")
|
||||
}
|
||||
|
||||
func TestIntegerOperators(t *testing.T) {
|
||||
|
|
@ -545,7 +545,7 @@ LIMIT $23;
|
|||
|
||||
//testutils.SaveJsonFile("./testdata/common/int_operators.json", dest)
|
||||
//testutils.PrintJson(dest)
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/common/int_operators.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/common/int_operators.json")
|
||||
}
|
||||
|
||||
func TestTimeExpression(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ func TestJoinEverything(t *testing.T) {
|
|||
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, len(dest), 275)
|
||||
testutils.AssertJSONFile(t, dest, "./postgres/testdata/joined_everything.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/postgres/joined_everything.json")
|
||||
}
|
||||
|
||||
func TestSelfJoin(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -62,5 +62,5 @@ func TestNorthwindJoinEverything(t *testing.T) {
|
|||
assert.NilError(t, err)
|
||||
|
||||
//jsonSave("./testdata/northwind-all.json", dest)
|
||||
testutils.AssertJSONFile(t, dest, "./postgres/testdata/northwind-all.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/postgres/northwind-all.json")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1061,7 +1061,7 @@ ORDER BY customer.customer_id, SUM(payment.amount) ASC;
|
|||
assert.Equal(t, len(dest), 104)
|
||||
|
||||
//testutils.SaveJsonFile(dest, "postgres/testdata/customer_payment_sum.json")
|
||||
testutils.AssertJSONFile(t, dest, "postgres/testdata/customer_payment_sum.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/postgres/customer_payment_sum.json")
|
||||
}
|
||||
|
||||
func TestSelectGroupBy2(t *testing.T) {
|
||||
|
|
@ -1506,7 +1506,7 @@ ORDER BY actor.actor_id ASC, film.film_id ASC;
|
|||
assert.NilError(t, err)
|
||||
|
||||
//jsonSave("./testdata/quick-start-dest.json", dest)
|
||||
testutils.AssertJSONFile(t, dest, "./postgres/testdata/quick-start-dest.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/postgres/quick-start-dest.json")
|
||||
|
||||
var dest2 []struct {
|
||||
model.Category
|
||||
|
|
@ -1519,7 +1519,7 @@ ORDER BY actor.actor_id ASC, film.film_id ASC;
|
|||
assert.NilError(t, err)
|
||||
|
||||
//jsonSave("./testdata/quick-start-dest2.json", dest2)
|
||||
testutils.AssertJSONFile(t, dest2, "./postgres/testdata/quick-start-dest2.json")
|
||||
testutils.AssertJSONFile(t, dest2, "./testdata/results/postgres/quick-start-dest2.json")
|
||||
}
|
||||
|
||||
func TestQuickStartWithSubQueries(t *testing.T) {
|
||||
|
|
@ -1571,7 +1571,7 @@ func TestQuickStartWithSubQueries(t *testing.T) {
|
|||
assert.NilError(t, err)
|
||||
|
||||
//jsonSave("./testdata/quick-start-dest.json", dest)
|
||||
testutils.AssertJSONFile(t, dest, "./postgres/testdata/quick-start-dest.json")
|
||||
testutils.AssertJSONFile(t, dest, "./testdata/results/postgres/quick-start-dest.json")
|
||||
|
||||
var dest2 []struct {
|
||||
model.Category
|
||||
|
|
@ -1584,7 +1584,7 @@ func TestQuickStartWithSubQueries(t *testing.T) {
|
|||
assert.NilError(t, err)
|
||||
|
||||
//jsonSave("./testdata/quick-start-dest2.json", dest2)
|
||||
testutils.AssertJSONFile(t, dest2, "./postgres/testdata/quick-start-dest2.json")
|
||||
testutils.AssertJSONFile(t, dest2, "./testdata/results/postgres/quick-start-dest2.json")
|
||||
}
|
||||
|
||||
func TestExpressionWrappers(t *testing.T) {
|
||||
|
|
|
|||
1978
tests/postgres/testdata/customer_payment_sum.json
vendored
1978
tests/postgres/testdata/customer_payment_sum.json
vendored
File diff suppressed because it is too large
Load diff
252320
tests/postgres/testdata/joined_everything.json
vendored
252320
tests/postgres/testdata/joined_everything.json
vendored
File diff suppressed because it is too large
Load diff
135339
tests/postgres/testdata/northwind-all.json
vendored
135339
tests/postgres/testdata/northwind-all.json
vendored
File diff suppressed because it is too large
Load diff
6067
tests/postgres/testdata/quick-start-dest.json
vendored
6067
tests/postgres/testdata/quick-start-dest.json
vendored
File diff suppressed because it is too large
Load diff
1769
tests/postgres/testdata/quick-start-dest2.json
vendored
1769
tests/postgres/testdata/quick-start-dest2.json
vendored
File diff suppressed because it is too large
Load diff
38
tests/testdata/common/bool_operators.json
vendored
38
tests/testdata/common/bool_operators.json
vendored
|
|
@ -1,38 +0,0 @@
|
|||
[
|
||||
{
|
||||
"Eq1": false,
|
||||
"Eq2": false,
|
||||
"NEq1": true,
|
||||
"NEq2": false,
|
||||
"Distinct1": true,
|
||||
"Distinct2": true,
|
||||
"NotDistinct1": false,
|
||||
"NotDistinct2": false,
|
||||
"IsTrue": false,
|
||||
"IsNotTrue": true,
|
||||
"IsFalse": true,
|
||||
"IsNotFalse": false,
|
||||
"IsUnknown": false,
|
||||
"IsNotUnknown": true,
|
||||
"Complex1": true,
|
||||
"Complex2": true
|
||||
},
|
||||
{
|
||||
"Eq1": null,
|
||||
"Eq2": false,
|
||||
"NEq1": null,
|
||||
"NEq2": false,
|
||||
"Distinct1": true,
|
||||
"Distinct2": true,
|
||||
"NotDistinct1": false,
|
||||
"NotDistinct2": false,
|
||||
"IsTrue": false,
|
||||
"IsNotTrue": true,
|
||||
"IsFalse": true,
|
||||
"IsNotFalse": false,
|
||||
"IsUnknown": false,
|
||||
"IsNotUnknown": true,
|
||||
"Complex1": true,
|
||||
"Complex2": true
|
||||
}
|
||||
]
|
||||
93
tests/testdata/common/common.go
vendored
93
tests/testdata/common/common.go
vendored
|
|
@ -1,93 +0,0 @@
|
|||
package common
|
||||
|
||||
type ExpressionTestResult struct {
|
||||
IsNull *bool
|
||||
IsNotNull *bool
|
||||
In *bool
|
||||
InSelect *bool
|
||||
NotIn *bool
|
||||
NotInSelect *bool
|
||||
}
|
||||
|
||||
type EqualityExpResult struct {
|
||||
Eq1 *bool
|
||||
Eq2 *bool
|
||||
Distinct1 *bool
|
||||
Distinct2 *bool
|
||||
NotDistinct1 *bool
|
||||
NotDistinct2 *bool
|
||||
Lt1 *bool
|
||||
Lt2 *bool
|
||||
Lte1 *bool
|
||||
Lte2 *bool
|
||||
Gt1 *bool
|
||||
Gt2 *bool
|
||||
Gte1 *bool
|
||||
Gte2 *bool
|
||||
}
|
||||
|
||||
type AllTypesIntegerExpResult struct {
|
||||
EqualityExpResult `alias:"."`
|
||||
|
||||
Add1 *int64
|
||||
Add2 *int64
|
||||
Sub1 *int64
|
||||
Sub2 *int64
|
||||
Mul1 *int64
|
||||
Mul2 *int64
|
||||
Div1 *int64
|
||||
Div2 *int64
|
||||
Mod1 *int64
|
||||
Mod2 *int64
|
||||
Pow1 *int64
|
||||
Pow2 *int64
|
||||
BitAnd1 *int64
|
||||
BitAnd2 *int64
|
||||
BitOr1 *int64
|
||||
BitOr2 *int64
|
||||
BitXor1 *int64
|
||||
BitXor2 *int64
|
||||
BitShiftLeft1 *int64
|
||||
BitShiftLeft2 *int64
|
||||
BitShiftRight1 *int64
|
||||
BitShiftRight2 *int64
|
||||
}
|
||||
|
||||
type FloatExpressionTestResult struct {
|
||||
Eq1 *bool
|
||||
Eq2 *bool
|
||||
Eq3 *bool
|
||||
Distinct1 *bool
|
||||
Distinct2 *bool
|
||||
Distinct3 *bool
|
||||
NotDistinct1 *bool
|
||||
NotDistinct2 *bool
|
||||
NotDistinct3 *bool
|
||||
Lt1 *bool
|
||||
Lt2 *bool
|
||||
Gt1 *bool
|
||||
Gt2 *bool
|
||||
Add1 *float64
|
||||
Add2 *float64
|
||||
Sub1 *float64
|
||||
Sub2 *float64
|
||||
Mul1 *float64
|
||||
Mul2 *float64
|
||||
Div1 *float64
|
||||
Div2 *float64
|
||||
Mod1 *float64
|
||||
Mod2 *float64
|
||||
Pow1 *float64
|
||||
Pow2 *float64
|
||||
|
||||
Abs *float64
|
||||
Power *float64
|
||||
Sqrt *float64
|
||||
Cbrt *float64
|
||||
Ceil *float64
|
||||
Floor *float64
|
||||
Round1 *float64
|
||||
Round2 *float64
|
||||
Sign *float64
|
||||
Trunc *float64
|
||||
}
|
||||
76
tests/testdata/common/float_operators.json
vendored
76
tests/testdata/common/float_operators.json
vendored
|
|
@ -1,76 +0,0 @@
|
|||
[
|
||||
{
|
||||
"Eq1": true,
|
||||
"Eq2": false,
|
||||
"Eq3": false,
|
||||
"Distinct1": false,
|
||||
"Distinct2": true,
|
||||
"Distinct3": true,
|
||||
"NotDistinct1": true,
|
||||
"NotDistinct2": false,
|
||||
"NotDistinct3": false,
|
||||
"Lt1": true,
|
||||
"Lt2": true,
|
||||
"Gt1": false,
|
||||
"Gt2": false,
|
||||
"Add1": 2.22,
|
||||
"Add2": 12.33,
|
||||
"Sub1": 0,
|
||||
"Sub2": -10.11,
|
||||
"Mul1": 1.23,
|
||||
"Mul2": 12.45,
|
||||
"Div1": 1,
|
||||
"Div2": 0.09,
|
||||
"Mod1": 0,
|
||||
"Mod2": 1.11,
|
||||
"Pow1": 1.12,
|
||||
"Pow2": 1.24,
|
||||
"Abs": 1.11,
|
||||
"Power": 1.24,
|
||||
"Sqrt": 1.05,
|
||||
"Cbrt": 1.03,
|
||||
"Ceil": 6,
|
||||
"Floor": 5,
|
||||
"Round1": 1,
|
||||
"Round2": 1.11,
|
||||
"Sign": 1,
|
||||
"Trunc": 1.1
|
||||
},
|
||||
{
|
||||
"Eq1": true,
|
||||
"Eq2": false,
|
||||
"Eq3": false,
|
||||
"Distinct1": false,
|
||||
"Distinct2": true,
|
||||
"Distinct3": true,
|
||||
"NotDistinct1": true,
|
||||
"NotDistinct2": false,
|
||||
"NotDistinct3": false,
|
||||
"Lt1": true,
|
||||
"Lt2": true,
|
||||
"Gt1": false,
|
||||
"Gt2": false,
|
||||
"Add1": 2.22,
|
||||
"Add2": 12.33,
|
||||
"Sub1": null,
|
||||
"Sub2": -10.11,
|
||||
"Mul1": null,
|
||||
"Mul2": 12.45,
|
||||
"Div1": null,
|
||||
"Div2": 0.09,
|
||||
"Mod1": null,
|
||||
"Mod2": 1.11,
|
||||
"Pow1": null,
|
||||
"Pow2": 1.24,
|
||||
"Abs": 1.11,
|
||||
"Power": 1.24,
|
||||
"Sqrt": 1.05,
|
||||
"Cbrt": 1.03,
|
||||
"Ceil": 6,
|
||||
"Floor": 5,
|
||||
"Round1": 1,
|
||||
"Round2": 1.11,
|
||||
"Sign": 1,
|
||||
"Trunc": 1.1
|
||||
}
|
||||
]
|
||||
78
tests/testdata/common/int_operators.json
vendored
78
tests/testdata/common/int_operators.json
vendored
|
|
@ -1,78 +0,0 @@
|
|||
[
|
||||
{
|
||||
"Eq1": true,
|
||||
"Eq2": false,
|
||||
"Distinct1": false,
|
||||
"Distinct2": true,
|
||||
"NotDistinct1": true,
|
||||
"NotDistinct2": false,
|
||||
"Lt1": true,
|
||||
"Lt2": false,
|
||||
"Lte1": true,
|
||||
"Lte2": false,
|
||||
"Gt1": false,
|
||||
"Gt2": true,
|
||||
"Gte1": false,
|
||||
"Gte2": true,
|
||||
"Add1": 10000,
|
||||
"Add2": 5011,
|
||||
"Sub1": 0,
|
||||
"Sub2": 4989,
|
||||
"Mul1": 25000000,
|
||||
"Mul2": 55000,
|
||||
"Div1": 1,
|
||||
"Div2": 454,
|
||||
"Mod1": 0,
|
||||
"Mod2": 6,
|
||||
"Pow1": 38416,
|
||||
"Pow2": 7529536,
|
||||
"BitAnd1": 14,
|
||||
"BitAnd2": 14,
|
||||
"BitOr1": 14,
|
||||
"BitOr2": 30,
|
||||
"BitXor1": 0,
|
||||
"BitXor2": 5,
|
||||
"BitShiftLeft1": 1792,
|
||||
"BitShiftLeft2": 224,
|
||||
"BitShiftRight1": 3,
|
||||
"BitShiftRight2": 7
|
||||
},
|
||||
{
|
||||
"Eq1": true,
|
||||
"Eq2": false,
|
||||
"Distinct1": false,
|
||||
"Distinct2": true,
|
||||
"NotDistinct1": true,
|
||||
"NotDistinct2": false,
|
||||
"Lt1": null,
|
||||
"Lt2": false,
|
||||
"Lte1": null,
|
||||
"Lte2": false,
|
||||
"Gt1": null,
|
||||
"Gt2": true,
|
||||
"Gte1": null,
|
||||
"Gte2": true,
|
||||
"Add1": 10000,
|
||||
"Add2": 5011,
|
||||
"Sub1": 0,
|
||||
"Sub2": 4989,
|
||||
"Mul1": 25000000,
|
||||
"Mul2": 55000,
|
||||
"Div1": 1,
|
||||
"Div2": 454,
|
||||
"Mod1": 0,
|
||||
"Mod2": 6,
|
||||
"Pow1": 38416,
|
||||
"Pow2": 7529536,
|
||||
"BitAnd1": 14,
|
||||
"BitAnd2": 14,
|
||||
"BitOr1": 14,
|
||||
"BitOr2": 30,
|
||||
"BitXor1": 0,
|
||||
"BitXor2": 5,
|
||||
"BitShiftLeft1": 1792,
|
||||
"BitShiftLeft2": 224,
|
||||
"BitShiftRight1": 3,
|
||||
"BitShiftRight2": 7
|
||||
}
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue