gitlab.com/picnic-app/backend/role-api@v0.0.0-20230614140944-06a76ff3696d/internal/util/convert/convert_test.go (about)

     1  package convert
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestToPointers(t *testing.T) {
    10  	array := []int{2, 3}
    11  
    12  	got := ToPointers(array)
    13  	assert.Equal(t, 2, *got[0])
    14  	assert.Equal(t, 3, *got[1])
    15  }
    16  
    17  func TestToValues(t *testing.T) {
    18  	num1 := 2
    19  	num2 := 3
    20  	array := []*int{&num1, &num2}
    21  
    22  	got := ToValues(array)
    23  	assert.Equal(t, 2, got[0])
    24  	assert.Equal(t, 3, got[1])
    25  }