MCPcopy Create free account
hub / github.com/dolthub/doltgresql / TestSameTypes

Function TestSameTypes

testing/go/types_test.go:3649–3771  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3647}
3648
3649func TestSameTypes(t *testing.T) {
3650 RunScripts(t, []ScriptTest{
3651 {
3652 Name: "Integer types",
3653 SetUpScript: []string{
3654 "CREATE TABLE test1 (v1 SMALLINT, v2 INTEGER, v3 BIGINT);",
3655 "CREATE TABLE test2 (v1 INT2, v2 INT4, v3 INT8);",
3656 "INSERT INTO test1 VALUES (1, 2, 3), (4, 5, 6);",
3657 "INSERT INTO test2 VALUES (1, 2, 3), (4, 5, 6);",
3658 },
3659 Assertions: []ScriptTestAssertion{
3660 {
3661 Query: "SELECT * FROM test1 ORDER BY 1;",
3662 Expected: []sql.Row{
3663 {1, 2, 3},
3664 {4, 5, 6},
3665 },
3666 },
3667 {
3668 Query: "SELECT * FROM test1 ORDER BY v1;",
3669 Expected: []sql.Row{
3670 {1, 2, 3},
3671 {4, 5, 6},
3672 },
3673 },
3674 {
3675 Query: "SELECT * FROM test2 ORDER BY 1;",
3676 Expected: []sql.Row{
3677 {1, 2, 3},
3678 {4, 5, 6},
3679 },
3680 },
3681 {
3682 Query: "SELECT * FROM test2 ORDER BY v1;",
3683 Expected: []sql.Row{
3684 {1, 2, 3},
3685 {4, 5, 6},
3686 },
3687 },
3688 {
3689 Query: "select int2 '2', int4 '3', int8 '4'",
3690 Expected: []sql.Row{{2, 3, 4}},
3691 },
3692 },
3693 },
3694 {
3695 Name: "Arbitrary precision types",
3696 SetUpScript: []string{
3697 "CREATE TABLE test (v1 DECIMAL(10, 1), v2 NUMERIC(11, 2));",
3698 "INSERT INTO test VALUES (14854.5, 2504.25), (566821525.5, 735134574.75), (21525, 134574.7);",
3699 },
3700 Assertions: []ScriptTestAssertion{
3701 {
3702 Query: "SELECT * FROM test ORDER BY 1;",
3703 Expected: []sql.Row{
3704 {Numeric("14854.5"), Numeric("2504.25")},
3705 {Numeric("21525.0"), Numeric("134574.70")},
3706 {Numeric("566821525.5"), Numeric("735134574.75")},

Callers

nothing calls this directly

Calls 2

RunScriptsFunction · 0.70
NumericFunction · 0.70

Tested by

no test coverage detected