예제 #1
0
func TestStructWithDupList(t *testing.T) {
	assert := assert.New(t)

	def := gen.StructWithListDef{
		L: gen.ListOfUint8Def{0, 1, 2},
		B: true,
		S: "world",
		I: 42,
	}

	st := def.New()
	l := st.L()
	assert.Equal(uint64(3), l.Len())

	dupList := gen.NewStructWithDupList().SetL(st.L())

	assert.EqualValues(st.L(), dupList.L())
}
예제 #2
0
func TestStructWithList(t *testing.T) {
	assert := assert.New(t)

	def := gen.StructWithListDef{
		L: gen.ListOfUint8Def{0, 1, 2},
		B: true,
		S: "world",
		I: 42,
	}

	st := def.New()
	l := st.L()
	assert.Equal(uint64(3), l.Len())

	def2 := st.Def()
	assert.Equal(def, def2)

	def2.L[2] = 22
	st2 := def2.New()
	assert.Equal(uint8(22), st2.L().Get(2))
}