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

	def := gen.EnumStructDef{gen.Switch}
	var st types.Value
	st = def.New()
	st2 := st.(gen.EnumStruct)
	assert.True(st.Equals(st2))
}
예제 #2
0
func TestEnum(t *testing.T) {
	assert := assert.New(t)

	def := gen.EnumStructDef{gen.Right}
	st := def.New()

	def2 := st.Def()
	st2 := def.New()

	assert.Equal(def, def2)
	assert.True(st.Equals(st2))

	st3 := gen.NewEnumStruct()
	assert.Equal(gen.Right, st3.Hand())
	st3 = st3.SetHand(gen.Left)
	assert.Equal(gen.Left, st3.Hand())
}