github.com/jackc/pgx/v5@v5.5.5/pgtype/zeronull/int_test.go.erb (about)

     1  package zeronull_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/jackc/pgx/v5/pgtype/testutil"
     7  	"github.com/jackc/pgx/v5/pgtype/zeronull"
     8  )
     9  
    10  <% [2, 4, 8].each do |pg_byte_size| %>
    11  <% pg_bit_size = pg_byte_size * 8 %>
    12  func TestInt<%= pg_byte_size %>Transcode(t *testing.T) {
    13  	pgxtest.RunValueRoundTripTests(context.Background(), t, defaultConnTestRunner, nil, "int<%= pg_byte_size %>", []pgxtest.ValueRoundTripTest{
    14  		{
    15  			(zeronull.Int<%= pg_byte_size %>)(1),
    16  			new(zeronull.Int<%= pg_byte_size %>),
    17  			isExpectedEq((zeronull.Int<%= pg_byte_size %>)(1)),
    18  		},
    19  		{
    20  			nil,
    21  			new(zeronull.Int<%= pg_byte_size %>),
    22  			isExpectedEq((zeronull.Int<%= pg_byte_size %>)(0)),
    23  		},
    24  		{
    25  			(zeronull.Int<%= pg_byte_size %>)(0),
    26  			new(any),
    27  			isExpectedEq(nil),
    28  		},
    29  	})
    30  }
    31  <% end %>