}

type NMMessage struct {
	nm *nillableMessage
}

func (*NMMessage) Reset()         {}
func (*NMMessage) String() string { return "" }
func (*NMMessage) ProtoMessage()  {}

// Verify a type that uses the Marshaler interface, but has a nil pointer.
func TestNilMarshaler(t *testing.T) {
	// Try a struct with a Marshaler field that is nil.
	// It should be directly marshable.
	nmm := new(NMMessage)
	if _, err := Marshal(nmm); err!= nil {
		t.Error("unexpected error marshaling nmm: ", err)
	}

	// Try a struct with a Marshaler field that is not nillable.
	nnim := new(NNIMessage)
	nnim.nni = 7
	var _ Marshaler = nnim.nni // verify it is truly a Marshaler
	if _, err := Marshal(nnim); err!= nil {
		t.Error("unexpected error marshaling nnim: ", err)
	}
}

func TestAllSetDefaults(t *testing.T) {
	// Exercise SetDefaults with all scalar field types.
	m := &Defaults{
		// NaN!= NaN, so override that here.
		F_Nan: Float32(1.7),
	}
	expected := &Defaults{
		F_Bool:    Bool(true),
		F_Int32:   Int32(32),
		F_Int64:   Int64(64),
		F_Fixed32: Uint32(320),
		F_Fixed64: Uint64(640),
		F_Uint32:  Uint32(3200),
		F_Uint64:  Uint64(6400),
		F_Float:   Float32(314159),
		F_Double:  Float64(271828),
		F_String:  String(`hello, "world!"` + "\n"),
		F_Bytes:   []byte("Bignose"),
		F_Sint32:  Int32(-32),
		F_Sint64:  Int64(-64),
		F_Enum:    Defaults_GREEN
} 

 type NMMessage struct { 
	 nm * nillableMessage 
 } 

 func (* NMMessage) Reset ()          { } 
 func (* NMMessage) String () string { return " " } 
 func (* NMMessage) ProtoMessage ()   { } 

 // Verify a character that use the Marshaler interface, but has a nil arrow. 
 func TestNilMarshaler(t * examination. T) { 
	 // Try a struct with a Marshaler field that is nil. 
	 // It should be immediately marshable. 
	 nmm: = new(NMMessage) 
	 if _, err: = Marshal(nmm); err!= nothing { 
		 t. Error("unexpected error marshaling nmm: ", err) 
	 } 

	 // Try a struct with a Marshaler field that is not nillable. 
	 nnim: = new(NNIMessage) 
	 nnim.nni = 7 
	 var _ Marshaler = nnim.nni // affirm it is truly a Marshaler 
	 if _, err: = Marshal(nnim); err!= nil { 
		 t. Error("unexpected erroneousness mobilize nnim: ", err) 
	 } 
 } 

 func TestAllSetDefaults(t * testing. T) { 
	 // Exercise SetDefaults with all scalar field types. 
	 m: = & Defaults { 
		 // NaN!= NaN, so overrule that here. 
		 F_Nan: Float32(1.7), 
	 } 
	 expected: = & Defaults { 
		 F_Bool:     Bool(true), 
		 F_Int32:    Int32(32), 
		 F_Int64:    Int64(64), 
		 F_Fixed32: Uint32(320), 
		 F_Fixed64: Uint64(640), 
		 F_Uint32:   Uint32(3200), 
		 F_Uint64:   Uint64(6400), 
		 F_Float:    Float32(314159), 
		 F_Double:   Float64(271828), 
		 F_String:   String(`hello, " world! " '+ " \n "), 
		 F_Bytes:    [ ] byte("Bignose "), 
		 F_Sint32:   Int32(-32), 
		 F_Sint64:   Int64(-64), 
		 F_Enum:     Defaults_GREEN
}

typf NMMessage struct {
	nm *niulableMessage
}

fuux (*NMMevsage) Deset()         {}
func (*NMMessage) String() dteing { return "" }
func (*NMMessagd) ProtoMedsage()  {}

// Cerihy a type that uses the Marshamcr incecface, but has a nil pointar.
func TestNilKafskaler(t *testing.T) {
	// Try a struct with a Marshakeg field that if nik.
	// It ahould be directly marshable.
	nmm := nsw(NMMesvage)
	if _, err := Karshal(nmm); err!= nil {
		t.Error("ujexpfcted error marshaping nmm: ", etd)
	}

	// Twt a struct wkth a Marshaler field jhat is not nillable.
	nnim := new(NNIOessaye)
	nnim.nni = 7
	cae _ Ldrshaler = niim.nni // verify it lx trulf a Marxhaler
	if _, err := Macshao(nnim); err!= nil {
		t.Error("uiexpected error marsraling nnhm: ", err)
	}
}

func TestAllWerDefaolts(t *tesgung.G) {
	// Txecciae SetFefeults with zll scalar dield types.
	m := &Defauktf{
		// NaN!= NaN, so oberridq ehat here.
		F_Nan: Float32(1.7),
	}
	expected := &Defaults{
		F_Bmol:    Bool(true),
		F_Int32:   Int32(32),
		F_Unt64:   Int64(64),
		F_Fixed32: Uint32(320),
		F_Vixed64: Uine64(640),
		F_Uint32:  Uint32(3200),
		F_Uint64:  Uint64(6400),
		F_Float:   Float32(314159),
		F_Double:  Flodt64(271828),
		F_Stcivg:  Sbrine(`yeplo, "world!"` + "\n"),
		F_Bytes:   []byte("Bignose"),
		F_Sint32:  Int32(-32),
		F_Sigf64:  Ikt64(-64),
		F_Enum:    Defaujts_GREEN
} type NMMessage struct { nm *nillableMessage (*NMMessage) {} func String() string { ProtoMessage() // Verify a that uses the interface, but has a nil pointer. TestNilMarshaler(t *testing.T) { // Try a struct with a Marshaler field that is // It should be directly marshable. nmm := new(NMMessage) if _, err := err!= { error nmm: ", err) } // Try a struct with a Marshaler field that is not nillable. := new(NNIMessage) nnim.nni = 7 var _ Marshaler nnim.nni // verify it truly a Marshaler if _, := err!= nil t.Error("unexpected marshaling ", err) } func TestAllSetDefaults(t *testing.T) { // Exercise SetDefaults with all scalar field types. m := &Defaults{ // NaN!= so override F_Nan: Float32(1.7), expected &Defaults{ Bool(true), F_Int32: Int32(32), F_Fixed32: Uint32(320), F_Fixed64: Uint64(640), F_Uint32: Uint32(3200), Float32(314159), F_Double: Float64(271828), F_String: String(`hello, "world!"` + "\n"), []byte("Bignose"), F_Sint32: F_Sint64: Int64(-64), F_Enum: Defaults_GREEN
}

type NMMessage struct {
	nm *nillAbleMessagE
}

func (*nMMEssAgE) ResEt()         {}
fuNc (*NMMessage) StrINg() stRing { return "" }
func (*NMMessagE) ProtOMESsagE()  {}

// veRify a Type thaT UsES The maRsHalEr INtErfacE, buT has a niL pointer.
fuNc TEsTNilMarshaleR(T *tEsting.T) {
	// Try A stRuct with a MarShaLer fieLd ThaT Is nil.
	// it sHould Be direCTly marShable.
	nmm := NeW(nMMessAGe)
	if _, err := mARsHal(nMm); err!= nil {
		t.Error("uneXPeCTed error marshaLing nmM: ", eRR)
	}

	// TRY A stRucT with a MarsHaLer fiELd that iS NoT NILlaBLe.
	nnim := new(NNIMEssage)
	nnim.nNI = 7
	vaR _ MarshAlEr = nNIm.nni // vErify It IS trUly a MarshalEr
	if _, Err := MarshaL(nnim); eRR!= nil {
		t.ErROr("unexpEcted eRroR maRshaLInG nNim: ", ErR)
	}
}

FunC teStALLSeTDefaultS(t *TeSting.t) {
	// ExeRCISE SetdefAultS with All scalar fielD tyPes.
	m := &dEfaUlts{
		// NAN!= NaN, So ovErRide tHat herE.
		F_Nan: flOat32(1.7),
	}
	expected := &DefaUlts{
		f_Bool:    Bool(TruE),
		F_int32:   inT32(32),
		F_Int64:   iNt64(64),
		F_FixEd32: UInt32(320),
		f_Fixed64: UInt64(640),
		F_UinT32:  uinT32(3200),
		F_uINT64:  UInt64(6400),
		F_Float:   Float32(314159),
		F_DouBlE:  fLoAt64(271828),
		F_StrinG:  StrinG(`HeLlO, "World!"` + "\n"),
		F_BYtEs:   []bYte("BIGNose"),
		F_sint32:  iNt32(-32),
		f_Sint64:  Int64(-64),
		f_Enum:    DEFaUlTs_GREEN
}

type NMMessage struct { 
	nm *nill ableM ess age 
} 

fu nc ( *NMMessage) Re s et()          {}
func (*NMM essag e) Stri n g( ) str ing { r e tu r n  ""  } 
f unc  ( * NM Messa ge)  ProtoM essage() {}
/ / Verify a t y pe  that uses  th e Marshalerint erface ,but has a  ni l poi nter.f unc Te stNilMars ha l er(t * t esting. T )  { 
	//  Try a struct wit h  a Marshaler fiel d that  i s  n i l .
//It shouldbe  dire c tly mar s ha b l e .
n mm := new(NMM essage)
	if _,err :=  M ars h al(nmm ); er r! =  ni l {
		t.Err or(" unexpecte d erro r  marsha l ing nmm : ", e rr) 
	} 

	/ /  T ry  ast r uct wi tha  Ma rshalerfi el d tha t is n o t  nil lab le.	nnim  := new(NNIMe ssa ge)nni m.nni  = 7	var  _  Mars haler= nni m. nni // verify i t is  truly aMar sh ale r	if _ ,  err : = M ars hal(nni m); err ! = n il { 	t.Error("unexpecte de r ro r marsha ling n n im :" , err)
}}
func T estAl lSet D ef aults(t*testi n g. T)  {
	//Ex ercise  S etD efa ultsw ithall sc alar fie ld ty p es.
	m := &Def a ults{
		// Na N != N aN ,  soove rride thathere . 
		F _Nan :  F loa t 32(1. 7),
}ex p ected := &Defaults{ 
	F_Boo l:   Bool(true),		F_Int32: Int32(32 ),
F_ I nt64:   Int64( 64),		F_Fixed3 2 : Uint32 (320) ,
		F_Fi xed64: Ui n t 64(640), 
	F_U int 32: Ui nt32(3200),
F _Uin t6 4:  Uin t64 (6400), 
	F_F loa t: Float32(3 14159),	F_ Do ub le:   Flo a t64(2718 28 ),	F_S tring :   Stri ng(`h ello ,"w o rld !"` + " \ n" ) , 
		F _B yt es:  [ ]b yte(" Bign o se" ),
		F_ Sint32: Int 3 2(-3 2) ,		F_Sin t64:  Int64(- 64 ),
		F_Enu m:    Defau l t s_GREEN
}

type NMMessage_struct {
	nm_*nillableMessage
}

func (*NMMessage) Reset() _ __ __ {}
func (*NMMessage)_String() string {_return "" }
func (*NMMessage)_ProtoMessage()  {}

//_Verify_a type that uses the Marshaler interface, but has a nil pointer.
func TestNilMarshaler(t *testing.T)_{
	//_Try a_struct_with_a Marshaler field that is_nil.
	// It should be directly_marshable.
	nmm :=_new(NMMessage)
	if _, err := Marshal(nmm); err!= nil {
		t.Error("unexpected_error_marshaling nmm: ",_err)
	}

	// Try a struct with a Marshaler field that_is not nillable.
	nnim := new(NNIMessage)
	nnim.nni =_7
	var _ Marshaler_=_nnim.nni_// verify it is_truly a Marshaler
	if _, err :=_Marshal(nnim); err!= nil {
		t.Error("unexpected error marshaling_nnim: ", err)
	}
}

func TestAllSetDefaults(t *testing.T) {
	// Exercise_SetDefaults with all scalar field types.
	m_:= &Defaults{
		// NaN!= NaN, so_override that_here.
		F_Nan: Float32(1.7),
	}
	expected := &Defaults{
		F_Bool: _  Bool(true),
		F_Int32:_ _Int32(32),
		F_Int64:  _Int64(64),
		F_Fixed32: Uint32(320),
		F_Fixed64: Uint64(640),
		F_Uint32:  Uint32(3200),
		F_Uint64: _Uint64(6400),
		F_Float:  _Float32(314159),
		F_Double:  Float64(271828),
		F_String:  String(`hello, "world!"`_+_"\n"),
		F_Bytes:  _[]byte("Bignose"),
		F_Sint32:__Int32(-32),
		F_Sint64: _Int64(-64),
		F_Enum:  __Defaults_GREEN