...

Source file src/github.com/jackc/pgtype/box_test.go

Documentation: github.com/jackc/pgtype

     1  package pgtype_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/jackc/pgtype"
     7  	"github.com/jackc/pgtype/testutil"
     8  )
     9  
    10  func TestBoxTranscode(t *testing.T) {
    11  	testutil.TestSuccessfulTranscode(t, "box", []interface{}{
    12  		&pgtype.Box{
    13  			P:      [2]pgtype.Vec2{{7.1, 5.2345678}, {3.14, 1.678}},
    14  			Status: pgtype.Present,
    15  		},
    16  		&pgtype.Box{
    17  			P:      [2]pgtype.Vec2{{7.1, 1.678}, {-13.14, -5.234}},
    18  			Status: pgtype.Present,
    19  		},
    20  		&pgtype.Box{Status: pgtype.Null},
    21  	})
    22  }
    23  
    24  func TestBoxNormalize(t *testing.T) {
    25  	testutil.TestSuccessfulNormalize(t, []testutil.NormalizeTest{
    26  		{
    27  			SQL: "select '3.14, 1.678, 7.1, 5.234'::box",
    28  			Value: &pgtype.Box{
    29  				P:      [2]pgtype.Vec2{{7.1, 5.234}, {3.14, 1.678}},
    30  				Status: pgtype.Present,
    31  			},
    32  		},
    33  	})
    34  }
    35  

View as plain text