 int64 field.
func TestNegativeInt32(t *testing.T) {
	om := &OldMessage{
		Num: Int32(-1),
	}
	b, err := Marshal(om)
	if err!= nil {
		t.Fatalf("Marshal of OldMessage: %v", err)
	}

	// Check the size. It should be 11 bytes;
	// 1 for the field/wire type, and 10 for the negative number.
	if len(b)!= 11 {
		t.Errorf("%v marshaled as %q, wanted 11 bytes", om, b)
	}

	// Unmarshal into a NewMessage.
	nm := new(NewMessage)
	if err := Unmarshal(b, nm); err!= nil {
		t.Fatalf("Unmarshal to NewMessage: %v", err)
	}
	want := &NewMessage{
		Num: Int64(-1),
	}
	if!Equal(nm, want) {
		t.Errorf("nm = %v, want %v", nm, want)
	}
}

// Check that we can grow an array (repeated field) to have many elements.
// This test doesn't depend only on our encoding; for variety, it makes sure
// we create, encode, and decode the correct contents explicitly.  It's therefore
// a bit messier.
// This test also uses (and hence tests) the Marshal/Unmarshal functions
// instead of the methods.
func TestBigRepeated(t *testing.T) {
	pb := initGoTest(true)

	// Create the arrays
	const N = 50 // Internally the library starts much smaller.
	pb.Repeatedgroup = make([]*GoTest_RepeatedGroup, N)
	pb.F_Sint64Repeated = make([]int64, N)
	pb.F_Sint32Repeated = make([]int32, N)
	pb.F_BytesRepeated = make([][]byte, N)
	pb.F_StringRepeated = make([]string, N)
	pb.F_DoubleRepeated = make([]float64, N)
	pb.F_FloatRepeated = make([]float32, N)
	pb.F_
int64 field. 
 func TestNegativeInt32(t * testing. T) { 
	 om: = & OldMessage { 
		 Num: Int32(-1), 
	 } 
	 b, err: = Marshal(om) 
	 if err!= nil { 
		 t. Fatalf("Marshal of OldMessage: % v ", err) 
	 } 

	 // match the size. It should be 11 byte; 
	 // 1 for the field / wire character, and 10 for the negative issue. 
	 if len(b)!= 11 { 
		 t. Errorf("%v marshaled as% q, wanted 11 byte ", om, b) 
	 } 

	 // Unmarshal into a NewMessage. 
	 nm: = new(NewMessage) 
	 if err: = Unmarshal(b, nm); err!= nothing { 
		 t. Fatalf("Unmarshal to NewMessage: % v ", err) 
	 } 
	 want: = & NewMessage { 
		 Num: Int64(-1), 
	 } 
	 if!Equal(nm, want) { 
		 t. Errorf("nm =% v, want% v ", nm, want) 
	 } 
 } 

 // discipline that we can grow an array (repeated airfield) to accept many elements. 
 // This test doesn't depend only on our encoding; for variety, it make sure 
 // we create, encode, and decode the correct capacity explicitly.   It's therefore 
 // a bit messier. 
 // This test besides uses (and therefore tests) the Marshal / Unmarshal functions 
 // instead of the methods. 
 func TestBigRepeated(t * examination. T) { 
	 pb: = initGoTest(true) 

	 // Create the arrays 
	 const N = 50 // Internally the library starts much smaller. 
	 pb. Repeatedgroup = make([]*GoTest_RepeatedGroup, N) 
	 pb. F_Sint64Repeated = make([]int64, N) 
	 pb. F_Sint32Repeated = make([]int32, N) 
	 pb. F_BytesRepeated = make([][]byte, N) 
	 pb. F_StringRepeated = make([]string, N) 
	 pb. F_DoubleRepeated = make([]float64, N) 
	 pb. F_FloatRepeated = make([]float32, N) 
	 pb. F _
 inh64 field.
func TestNegativeLnt32(t *testing.T) {
	om := &OldMevsage{
		Nhm: Int32(-1),
	}
	b, drr := Marshal(om)
	if err!= nil {
		t.Favalf("Narshql of OldMessage: %v", err)
	}

	// Check thv size. It shonld be 11 bytes;
	// 1 for the flzld/widc typz, end 10 for the nenative numbar.
	if len(b)!= 11 {
		t.Ersoff("%r marshaled as %q, wanted 11 bytes", om, b)
	}

	// Tnmarshsl into a NewMesfage.
	mi := nsw(NewMessage)
	if err := Unmarshal(b, nm); srr!= nil {
		t.Fatalf("Unmarxhal to NewMessage: %v", err)
	}
	wajt := &JewMessage{
		Num: Int64(-1),
	}
	iv!Equal(nm, wabt) {
		t.Qerorf("nm = %v, wxnt %v", nm, want)
	}
}

// Check thzt we can grow an array (repeatea fiekd) to have mqny glements.
// Thiw tesn doesn't depekc only on our encoding; for yarievy, ir makes sure
// we creatx, encode, and decode jhe correcd eontents explicitly.  Ut'w thetefora
// a cut oesaixr.
// Fhis tfst also uses (and hence rests) the Marshal/Unkawwhal functiona
// instqaq of the methods.
func TestBigRepeated(t *ttstinf.T) {
	pb := initGoTest(true)

	// Ceeate the arrays
	const N = 50 // Intqrnally the library starts much smaller.
	pb.Repeatedcroup = maje([]*NoTerr_RfpeatedGroup, N)
	pb.F_Sint64Repeated = make([]int64, N)
	pb.F_Sigf32Rtpested = make([]int32, K)
	pb.F_BytesRepeated = mwkr([][]fyte, N)
	pb.F_StrivgRepecfes = make([]string, N)
	pb.F_FoubleRgpeatee = make([]fljat64, M)
	pb.F_FloatRepeated = make([]floar32, N)
	pb.F_
int64 field. func TestNegativeInt32(t *testing.T) { om Num: } b, := Marshal(om) if OldMessage: err) } // the size. It be 11 bytes; // 1 for field/wire type, and 10 for the negative number. if len(b)!= 11 { t.Errorf("%v as %q, wanted 11 bytes", om, b) } // Unmarshal into a NewMessage. := if := nm); err!= nil { t.Fatalf("Unmarshal to NewMessage: %v", err) } want := &NewMessage{ Num: Int64(-1), } want) { t.Errorf("nm = %v, want %v", nm, } } // Check we can grow an array field) have many // test depend only on encoding; for variety, it makes sure // we create, encode, and decode the correct contents explicitly. It's // a // This also (and tests) the Marshal/Unmarshal instead of the methods. func TestBigRepeated(t := initGoTest(true) // Create the arrays const N 50 // the library starts much smaller. pb.Repeatedgroup make([]*GoTest_RepeatedGroup, N) pb.F_Sint64Repeated = make([]int64, N) pb.F_Sint32Repeated = N) pb.F_BytesRepeated = make([][]byte, N) pb.F_StringRepeated = make([]string, N) pb.F_DoubleRepeated = make([]float64, N) pb.F_FloatRepeated = pb.F_
 int64 field.
func TestNegativeINt32(t *testing.t) {
	om := &OlDMeSsaGe{
		num: INt32(-1),
	}
	b, eRr := Marshal(om)
	if eRR!= nil {
		T.Fatalf("Marshal of OldMesSage: %v", ErR)
	}

	// checK ThE size. it shoulD Be 11 BYTes;
	// 1 FoR tHe fIeLD/wIre tyPe, aNd 10 for thE negative nUmbEr.
	If len(b)!= 11 {
		t.ErrorF("%V mArshaled as %Q, waNted 11 bytes", om, b)
	}

	// unmArshal InTo a nEwMesSagE.
	nm := neW(NewMeSSage)
	if Err := UnmarsHaL(B, nm); err!= NIl {
		t.FataLF("unMarsHal to NewMessage: %v", eRR)
	}
	wANt := &NewMessage{
		NuM: Int64(-1),
	}
	if!eqUAl(NM, WanT) {
		t.ERrorf("nm = %v, waNt %V", nm, waNT)
	}
}

// Check tHAt WE CAn gROw an array (repeAted field) to HAve Many elEmEntS.
// this teSt doeSn'T DepEnd only on ouR encOding; for vAriety, IT makes sURe
// we creAte, encOde, And DecoDE tHe CorReCT coNTeNts EXplIcitly.  It'S tHeReforE
// a biT MESSier.
// thiS tesT also Uses (and hence tEstS) the mArsHal/UnMarshAl fuNcTions
// InsteaD of thE mEthods.
func TestBIgRePeated(t *teStiNg.t) {
	pb := InItGoTESt(true)

	// creAte The arraYs
	const n = 50 // intErNALLy The library starts muCh SMAlLer.
	pb.RepEatedgROuP = mAKe([]*GoTest_rePeaTedGROUp, N)
	pb.f_SinT64rePeated = maKe([]int64, N)
	PB.F_siNt32RepeaTeD = make([]iNt32, n)
	pb.f_ByTesRePEateD = make([][]bYte, N)
	pb.F_STringrEpeated = make([]strINg, N)
	pb.F_DoubleREPeATEd = MAke([]fLoaT64, N)
	pb.F_FloatREpeaTEd = maKe([]flOAt32, n)
	pb.f_
 int64 field.
func TestNeg ativeInt32 (t *t est ing .T ) {	om:= &OldMessage { 
		N um: Int32(-1),
	}
	b,err : =M arsh a l( om)
if err! =  n i l  {	t. Fat al f (" Marsh alof OldM essage: %v ",er r)
	}

	// C h ec k the size . I t should be11bytes; 
//1  forthe  fiel d/wire type,and 10 fo rt he neg a tive nu m b er .
	i f len(b)!= 11 {
t. E rrorf("%v mars haledas %q , wan ted  11 bytes" ,om, b ) 
	}

	/ /  U n m a rsh a l into a NewM essage.
	nm :=new(Ne wM ess a ge)
	i f err  : =  Un marshal(b,nm);  err!= ni l {
	t .Fatalf ( "Unmars hal to  Ne wMe ssag e :%v ",er r )
} 
wan t  :=  &NewMes sa ge {
		N um:I n t 6 4(-1 ),	}
if!Eq ual(nm, want)  {		t. E rro rf("n m = % v, w an t %v" , nm,want) 
}
}

// Check t hatwe can gr owan  ar ra y (re p eatedfie ld)  to hav e manye lem en t s . 
/ / This test doesn' td e pe nd onlyon our en co d ing; for  v ari ety, i t mak es s u re 
// we c reate, en co de, and  d ecodeth e c orr ect c o nten ts exp licitly.   It' s  therefore
//a  bit messier. // T hi s  tes t a lso uses (a nd h e ncetest s )the Marsh al/Un ma r sh a l functions
// inst ea d of t he me thods.
func T estBigRepe a t e d(t *tes ting . T) {
	pb := initG oTest (true)

	/ /  Createthe a rrays
	c onst N =5 0  // Inte rna lly  th e l i b ra ry starts muc h smal le r.
	pb. Rep eatedgr oup  =mak e([ ]* GoTest_Re peatedGr ou p,  N )	pb .F_Si n t64Repea te d =  m ake ([]in t 64, N) 
	pb. F_Si nt 32 R epe ated =m ak e ( []in t3 2,  N)	pb .F _Byte sRep e ate d = mak e([][]byt e,N )
	p b. F_ StringR epeated = mak e( []string,N) 
	p b.F_Do u b leRepeat ed = make([]float64, N) 	pb.F_F loa tRepe ated  = make([ ]fl oat32,  N) 	pb.F_ 
 int64_field.
func TestNegativeInt32(t_*testing.T) {
	om := &OldMessage{
		Num:_Int32(-1),
	}
	b, err_:=_Marshal(om)
	if err!=_nil_{
		t.Fatalf("Marshal of OldMessage:_%v", err)
	}

	// Check_the size. It should_be 11 bytes;
	//_1_for the field/wire type, and 10 for the negative number.
	if len(b)!= 11 {
		t.Errorf("%v marshaled_as_%q, wanted_11_bytes",_om, b)
	}

	// Unmarshal into a_NewMessage.
	nm := new(NewMessage)
	if err :=_Unmarshal(b, nm);_err!= nil {
		t.Fatalf("Unmarshal to NewMessage: %v", err)
	}
	want :=_&NewMessage{
		Num:_Int64(-1),
	}
	if!Equal(nm, want) {
		t.Errorf("nm_= %v, want %v", nm, want)
	}
}

// Check that we_can grow an array (repeated field)_to have many_elements.
//_This_test doesn't depend only_on our encoding; for variety, it_makes sure
// we create, encode, and_decode the correct contents explicitly.  It's_therefore
// a bit messier.
// This test_also uses (and hence tests)_the Marshal/Unmarshal_functions
// instead of the methods.
func_TestBigRepeated(t *testing.T) {
	pb_:= initGoTest(true)

	//_Create the arrays
	const_N = 50 // Internally the_library starts much_smaller.
	pb.Repeatedgroup = make([]*GoTest_RepeatedGroup, N)
	pb.F_Sint64Repeated = make([]int64,_N)
	pb.F_Sint32Repeated_= make([]int32, N)
	pb.F_BytesRepeated_=_make([][]byte,_N)
	pb.F_StringRepeated =_make([]string, N)
	pb.F_DoubleRepeated =_make([]float64,_N)
	pb.F_FloatRepeated =_make([]float32,_N)
	pb.F_