@ -105,6 +105,14 @@ public class NanoTest extends TestCase {
assertEquals ( 456 , newMsg . d ) ;
assertEquals ( 456 , newMsg . d ) ;
assertEquals ( 2 , msg . nestedMsg . bb ) ;
assertEquals ( 2 , msg . nestedMsg . bb ) ;
assertEquals ( SimpleMessageNano . BAR , msg . defaultNestedEnum ) ;
assertEquals ( SimpleMessageNano . BAR , msg . defaultNestedEnum ) ;
msg . nestedMsg = null ;
assertEquals ( msgSerializedSize , msg . getCachedSize ( ) ) ;
assertTrue ( msgSerializedSize ! = msg . getSerializedSize ( ) ) ;
msg . clear ( ) ;
assertEquals ( 0 , msg . getCachedSize ( ) ) ;
assertEquals ( 0 , msg . getSerializedSize ( ) ) ;
}
}
public void testRecursiveMessageNano ( ) throws Exception {
public void testRecursiveMessageNano ( ) throws Exception {
@ -3532,6 +3540,13 @@ public class NanoTest extends TestCase {
assertTrue ( Arrays . equals ( new boolean [ ] { false , true , false , true } , nonPacked . bools ) ) ;
assertTrue ( Arrays . equals ( new boolean [ ] { false , true , false , true } , nonPacked . bools ) ) ;
}
}
public void testMessageNoFields ( ) {
SingleMessageNano msg = new SingleMessageNano ( ) ;
assertEquals ( 0 , msg . getSerializedSize ( ) ) ;
assertEquals ( 0 , msg . getCachedSize ( ) ) ;
assertEquals ( 0 , MessageNano . toByteArray ( msg ) . length ) ;
}
private void assertRepeatedPackablesEqual (
private void assertRepeatedPackablesEqual (
NanoRepeatedPackables . NonPacked nonPacked , NanoRepeatedPackables . Packed packed ) {
NanoRepeatedPackables . NonPacked nonPacked , NanoRepeatedPackables . Packed packed ) {
// Not using MessageNano.equals() -- that belongs to a separate test.
// Not using MessageNano.equals() -- that belongs to a separate test.