github.com/jxskiss/gopkg/v2@v2.14.9-0.20240514120614-899f3e7952b4/utils/ptr/conv_test.go (about)

     1  package ptr
     2  
     3  import (
     4  	"fmt"
     5  	"math"
     6  	"testing"
     7  
     8  	"github.com/stretchr/testify/assert"
     9  )
    10  
    11  func TestIntToStringp(t *testing.T) {
    12  	got1 := IntToStringp(1234)
    13  	assert.Equal(t, "1234", *got1)
    14  
    15  	want2 := fmt.Sprint(uint64(math.MaxUint64))
    16  	got2 := IntToStringp(uint64(math.MaxUint64))
    17  	assert.Equal(t, want2, *got2)
    18  }
    19  
    20  func TestIntpToStringp(t *testing.T) {
    21  	got1 := IntpToStringp(Int32(1234))
    22  	assert.Equal(t, "1234", *got1)
    23  
    24  	want2 := fmt.Sprint(uint64(math.MaxUint64))
    25  	got2 := IntpToStringp(Uint64(uint64(math.MaxUint64)))
    26  	assert.Equal(t, want2, *got2)
    27  }
    28  
    29  func TestIntpToString(t *testing.T) {
    30  	got1 := IntpToString(Int32(1234))
    31  	assert.Equal(t, "1234", got1)
    32  
    33  	want2 := fmt.Sprint(uint64(math.MaxUint64))
    34  	got2 := IntpToString(Uint64(uint64(math.MaxUint64)))
    35  	assert.Equal(t, want2, got2)
    36  }