@@ -99,28 +99,42 @@ private static Object[] readFlagAndVarInt(InputStream in) throws IOException {
9999 }
100100
101101 @ Test
102- public void testWriteVarInt_smallValues () throws Exception {
102+ public void testWriteVarInt_noContinuation () throws Exception {
103103 String outputPath = null ;
104104 try (BinaryThreadRecorder rec = new BinaryThreadRecorder (tempDir )) {
105105 outputPath = rec .getFileName ();
106106 rec .writeVarInt (0L );
107107 rec .writeVarInt (1L );
108108 rec .writeVarInt (127L );
109- rec .writeVarInt (128L );
110- rec .writeVarInt (300L );
111- rec .writeVarInt (Long .MAX_VALUE );
112109 }
113110
114111 byte [] actual = Files .readAllBytes (tempDir .resolve (outputPath ));
115112
116113 byte [] e0 = leb128Expected (0L ); // 00
117114 byte [] e1 = leb128Expected (1L ); // 01
118115 byte [] e127 = leb128Expected (127L ); // 7F
116+
117+ byte [] expected = concat (e0 , e1 , e127 );
118+ assertBytesEquals (expected , actual );
119+ }
120+
121+ @ Test
122+ public void testWriteVarInt_withContinuation () throws Exception {
123+ String outputPath = null ;
124+ try (BinaryThreadRecorder rec = new BinaryThreadRecorder (tempDir )) {
125+ outputPath = rec .getFileName ();
126+ rec .writeVarInt (128L );
127+ rec .writeVarInt (300L );
128+ rec .writeVarInt (Long .MAX_VALUE );
129+ }
130+
131+ byte [] actual = Files .readAllBytes (tempDir .resolve (outputPath ));
132+
119133 byte [] e128 = leb128Expected (128L ); // 80 01
120134 byte [] e300 = leb128Expected (300L ); // AC 02
121135 byte [] eMax = leb128Expected (Long .MAX_VALUE );
122136
123- byte [] expected = concat (e0 , e1 , e127 , e128 , e300 , eMax );
137+ byte [] expected = concat (e128 , e300 , eMax );
124138 assertBytesEquals (expected , actual );
125139 }
126140
0 commit comments