github.com/Schaudge/grailbase@v0.0.0-20240223061707-44c758a471c0/gtl/tests/unsafe_test.go (about) 1 package tests 2 3 //go:generate ../generate.py --prefix= -DELEM=int32 --package=tests --output=unsafe.go ../unsafe.go.tpl 4 5 import ( 6 "runtime" 7 "testing" 8 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestUnsafe(t *testing.T) { 13 b := int32sToBytes([]int32{10, 20, 30}) 14 assert.Equal(t, len(b), 4*3) 15 runtime.GC() 16 assert.Equal(t, []int32{10, 20, 30}, BytesToint32s(b)) 17 }