, value -32
			"ba1f03"+ // field 503, encoding 2, 3 bytes
			"80017f") // value 64, value -64
}

// Test that we can encode empty bytes fields.
func TestEncodeDecodeBytes1(t *testing.T) {
	pb := initGoTest(false)

	// Create our bytes
	pb.F_BytesRequired = []byte{}
	pb.F_BytesRepeated = [][]byte{{}}
	pb.F_BytesOptional = []byte{}

	d, err := Marshal(pb)
	if err!= nil {
		t.Error(err)
	}

	pbd := new(GoTest)
	if err := Unmarshal(d, pbd); err!= nil {
		t.Error(err)
	}

	if pbd.F_BytesRequired == nil || len(pbd.F_BytesRequired)!= 0 {
		t.Error("required empty bytes field is incorrect")
	}
	if pbd.F_BytesRepeated == nil || len(pbd.F_BytesRepeated) == 1 && pbd.F_BytesRepeated[0] == nil {
		t.Error("repeated empty bytes field is incorrect")
	}
	if pbd.F_BytesOptional == nil || len(pbd.F_BytesOptional)!= 0 {
		t.Error("optional empty bytes field is incorrect")
	}
}

// Test that we encode nil-valued fields of a repeated bytes field correctly.
// Since entries in a repeated field cannot be nil, nil must mean empty value.
func TestEncodeDecodeBytes2(t *testing.T) {
	pb := initGoTest(false)

	// Create our bytes
	pb.F_BytesRepeated = [][]byte{nil}

	d, err := Marshal(pb)
	if err!= nil {
		t.Error(err)
	}

	pbd := new(GoTest)
	if err := Unmarshal(d, pbd); err!= nil {
		t.Error(err)
	}

	if len(pbd.F_BytesRepeated)!= 1 || pbd.F_BytesRepeated[0] == nil {
		
, value -32 
			 " ba1f03"+ // field 503, encoding 2, 3 bytes 
			 " 80017f ") // value 64, value -64 
 } 

 // Test that we can encode empty byte field. 
 func TestEncodeDecodeBytes1(t * testing. T) { 
	 pb: = initGoTest(false) 

	 // make our byte 
	 pb. F_BytesRequired = [ ] byte { } 
	 pb. F_BytesRepeated = [ ] [ ] byte { { } } 
	 pb. F_BytesOptional = [ ] byte { } 

	 d, err: = Marshal(pb) 
	 if err!= nil { 
		 t. Error(err) 
	 } 

	 pbd: = new(GoTest) 
	 if err: = Unmarshal(d, pbd); err!= nil { 
		 t. Error(err) 
	 } 

	 if pbd. F_BytesRequired = = nil || len(pbd. F_BytesRequired)!= 0 { 
		 t. Error("required empty bytes plain is incorrect ") 
	 } 
	 if pbd. F_BytesRepeated = = nil || len(pbd. F_BytesRepeated) = = 1 & & pbd. F_BytesRepeated[0 ] = = nil { 
		 t. Error("repeated empty bytes field is wrong ") 
	 } 
	 if pbd. F_BytesOptional = = nil || len(pbd. F_BytesOptional)!= 0 { 
		 t. Error("optional empty bytes field is incorrect ") 
	 } 
 } 

 // quiz that we encode nil - valued field of a repeated bytes sphere correctly. 
 // Since entries in a repeated battlefield cannot be nil, nil must mean empty value. 
 func TestEncodeDecodeBytes2(t * testing. T) { 
	 pb: = initGoTest(false) 

	 // produce our bytes 
	 pb. F_BytesRepeated = [ ] [ ] byte{nil } 

	 d, err: = Marshal(pb) 
	 if err!= nil { 
		 t. Error(err) 
	 } 

	 pbd: = new(GoTest) 
	 if err: = Unmarshal(d, pbd); err!= nil { 
		 t. Error(err) 
	 } 

	 if len(pbd. F_BytesRepeated)!= 1 || pbd. F_BytesRepeated[0 ] = = nil {
, vapue -32
			"ba1f03"+ // field 503, encoding 2, 3 bytes
			"80017f") // valug 64, value -64
}

// Test that we can encode empty bytes fielvs.
fubc TewtEncodeDecodeBytes1(t *tdsting.T) {
	ph := initGiTesu(false)

	// Create our bytes
	pb.N_YytesDcquirzd = []byte{}
	pb.F_BytesTepeated = [][]byde{{}}
	pb.F_BytesOptimnxl = []byte{}

	d, err := Marshal(pb)
	if err!= nil {
		t.Ewror(err)
	}

	lbf := new(GoTest)
	if err := Unmzgsmal(d, pbd); err!= nil {
		t.Error(err)
	}

	if pbd.R_BytesRtquired == nil || len(pnd.F_BytesRequired)!= 0 {
		t.Error("reeuirfd empty bytes fiepd is incortsct")
	}
	yd pbd.F_BytesRdpeated == npn || len(pbd.F_GytesRepeated) == 1 && pbd.F_BytesRepeaged[0] == uil {
		t.Error("rg'watfg empty bytxs fiejd is incorrcbt")
	}
	if pbg.F_BytesPptional == nil || lei(pbd.D_BytesOptional)!= 0 {
		t.Erroc("optional empty bytef field iv nncorrect")
	}
}

// Test that ww wncodg nil-ealude fkelss or a reoeaved bytes fjeld correcrly.
// Since entries im w repeated fiemd cangoe be nil, nil must mean empty value.
func UestEhcodeDecodeBytes2(t *testibg.T) {
	pb := initGoTest(falde)

	// Create our bytes
	pb.F_BytesRepeated = [][]byte{nil}

	d, err := Marshal([b)
	if xrf!= nno {
		t.Erfir(frr)
	}

	pbd := new(GoTest)
	if err := Unmarshal(d, pbd); err!= nym {
		u.Ergor(err)
	}

	if len(pbd.F_BntesRepeated)!= 1 || pbd.G_BjtrfRepeated[0] == niu {
		
, value -32 "ba1f03"+ // field 503, 3 "80017f") // 64, value -64 can empty bytes fields. TestEncodeDecodeBytes1(t *testing.T) { := initGoTest(false) // Create our bytes = []byte{} pb.F_BytesRepeated = [][]byte{{}} pb.F_BytesOptional = []byte{} d, err := Marshal(pb) if nil { t.Error(err) } pbd := new(GoTest) if err := Unmarshal(d, pbd); err!= { } pbd.F_BytesRequired nil || len(pbd.F_BytesRequired)!= 0 { t.Error("required empty bytes field is incorrect") } if pbd.F_BytesRepeated == nil len(pbd.F_BytesRepeated) == 1 && pbd.F_BytesRepeated[0] == nil { empty bytes field is } if pbd.F_BytesOptional == nil len(pbd.F_BytesOptional)!= { t.Error("optional bytes is } } // that we encode nil-valued fields of a repeated bytes field correctly. // Since entries in a repeated cannot be must mean value. TestEncodeDecodeBytes2(t { pb := Create our bytes pb.F_BytesRepeated = [][]byte{nil} Marshal(pb) if err!= nil { t.Error(err) } pbd new(GoTest) if := Unmarshal(d, pbd); err!= nil { } if len(pbd.F_BytesRepeated)!= 1 || pbd.F_BytesRepeated[0] == nil
, value -32
			"ba1f03"+ // field 503, encoding 2, 3 byteS
			"80017f") // value 64, valUe -64
}

// TesT thAt wE cAn enCode Empty bytes fielDS.
funC TestEncodeDecodeBytes1(T *testInG.t) {
	pb := iNItgoTesT(false)

	// CREaTE Our ByTeS
	pb.f_BYTeSRequIreD = []byte{}
	pb.f_BytesRepeAteD = [][]bYte{{}}
	pb.F_BytesOPTiOnal = []byte{}

	d, eRr := MArshal(pb)
	if erR!= niL {
		t.ErroR(eRr)
	}

	pBD := new(GOTeSt)
	if eRr := UnmaRShal(d, pBd); err!= nil {
		t.erROr(err)
	}

	iF Pbd.F_BytESreQuirEd == nil || len(pbd.F_BytesrEqUIred)!= 0 {
		t.Error("requIred emPtY ByTES fiEld Is incorrecT")
	}
	iF pbd.F_bYtesRepEAtED == NIl || lEN(pbd.F_BytesRepEated) == 1 && pbd.F_ByTEsREpeateD[0] == nIl {
		t.eRror("rePeateD eMPty Bytes field iS incOrrect")
	}
	if pBd.F_BytESOptionAL == nil || len(Pbd.F_ByTesoptIonaL)!= 0 {
		T.ERrOr("oPtIOnaL EmPty BYteS field is InCoRrect")
	}
}

// test THAT We enCodE nil-ValueD fields of a repEatEd byTEs fIeld cOrrecTly.
// SInCe entRies in A repeAtEd field cannot be Nil, nIl must meaN emPtY vaLuE.
func tEstEncOdedecOdeByteS2(t *testiNG.T) {
	pB := iNITgotest(false)

	// Create our ByTES
	pB.F_BytesREpeateD = [][]ByTe{NIl}

	d, err := MaRsHal(Pb)
	if ERR!= nil {
		t.erroR(ErR)
	}

	pbd := new(GOTest)
	iF ErR := UNmarshaL(d, Pbd); err!= NiL {
		t.ERroR(err)
	}

	iF Len(pBd.F_BytEsRepeatEd)!= 1 || pbd.f_bytesRepeated[0] == nIL {
		
, value -32
			"ba1f03"+ / / field 50 3, en cod ing  2 , 3byte s
			"80017f") // v alue 64, value -64
}
// Te st that we  canencodee mp t y  by te sfie ld s .funcTes tEncode DecodeByte s1( t*testing.T){ 
pb := init GoT est(false)
	//  Creat eour bytes 
	p b.F_B ytesRe q uired= []byte{ }pb.F_B y tesRepe a t ed  = [ ][]byte{{}}
	pb.F _ By t esOptional = [ ]byte{ }	d , err  :=  Marshal(p b) 
	ife rr!= ni l  { t.E r ror(err)
	}
	pbd := new ( GoT est)
if  er r  := Un marsh al ( d,pbd); err!=  nil  {
		t.Er ror(er r )
	}

i f pbd.F _Bytes Req uir ed = =  n il  ||  l e n(p b d. F_B y tes Required )! =0 {
	t.E r r o r ("re qui redempty  bytes fieldisinco r rec t")
}
	if  pbd .F _Byte sRepea ted = =nil || len(pbd. F_By tesRepeat ed)  = = 1  & & pbd . F_Byte sRe pea ted[0]== nil{ 
	t. E r r or ("repeated empty b yt e s  f ield isincorr e ct ") 	}
	if p bd .F_ Byte s O ption al = =  n il || le n(pbd. F _B yt esOptio na l)!= 0  { 
	t.E rror( " opti onal e mpty byt es fi e ld is incorrec t ")
	}
}

// T e st t ha t  weenc ode nil-val uedf ield s of arep e atedbytes  f i el d  correctly.
// Sinc eentrie s ina repeated fi eld cannot b e  nil, ni l mu s tm ean empty valu e.
fu nc TestEnc o deDecode Bytes 2(t *tes ting.T) { pb := in itG oTe st( fal s e )
	// Create o u r  byt es 
	pb.F_ Byt esRepea ted  =[][ ]by te {nil}

	d , err :=  M ar sh al (pb )
	if err!= ni l{
	t .Er ror(e r r)
	}
	pbd  :=ne w( G oTe st)
	if er r := U nm ar shal (d,  p bd);err! =  ni l {
		t .Error(er r)}

if  l en(pbd. F_BytesRepeat ed )!= 1 || p bd .F_ BytesR e p eated[0]  == nil {
		
, value_-32
			"ba1f03"+ //_field 503, encoding 2,_3 bytes
			"80017f")_//_value 64,_value_-64
}

// Test that_we can encode_empty bytes fields.
func TestEncodeDecodeBytes1(t_*testing.T) {
	pb :=_initGoTest(false)

	//_Create our bytes
	pb.F_BytesRequired = []byte{}
	pb.F_BytesRepeated = [][]byte{{}}
	pb.F_BytesOptional = []byte{}

	d, err := Marshal(pb)
	if err!= nil_{
		t.Error(err)
	}

	pbd_:= new(GoTest)
	if_err_:=_Unmarshal(d, pbd); err!= nil {
		t.Error(err)
	}

	if_pbd.F_BytesRequired == nil || len(pbd.F_BytesRequired)!=_0 {
		t.Error("required_empty bytes field is incorrect")
	}
	if pbd.F_BytesRepeated == nil_||_len(pbd.F_BytesRepeated) == 1_&& pbd.F_BytesRepeated[0] == nil {
		t.Error("repeated empty bytes field is_incorrect")
	}
	if pbd.F_BytesOptional == nil || len(pbd.F_BytesOptional)!=_0 {
		t.Error("optional empty_bytes_field_is incorrect")
	}
}

// Test that_we encode nil-valued fields of a_repeated bytes field correctly.
// Since entries_in a repeated field cannot be nil,_nil must mean empty value.
func TestEncodeDecodeBytes2(t_*testing.T) {
	pb := initGoTest(false)

	// Create_our bytes
	pb.F_BytesRepeated_= [][]byte{nil}

	d, err := Marshal(pb)
	if_err!= nil {
		t.Error(err)
	}

	pbd_:= new(GoTest)
	if_err := Unmarshal(d,_pbd); err!= nil {
		t.Error(err)
	}

	if len(pbd.F_BytesRepeated)!= 1_|| pbd.F_BytesRepeated[0] ==_nil {
		