1414import com .apicatalog .multicodec .Multicodec .Tag ;
1515import com .apicatalog .multicodec .MulticodecDecoder ;
1616import com .apicatalog .multicodec .codec .MultihashCodec ;
17+ import com .apicatalog .uvarint .UVarInt ;
1718
1819class MultihashTest {
1920
@@ -66,6 +67,8 @@ void testDecodeFromIndex(byte[] input, Multihash codec, byte[] expected) {
6667
6768 System .arraycopy (input , 0 , array , index , input .length );
6869 assertArrayEquals (expected , codec .decode (array , index ));
70+ assertEquals (expected .length , codec .digestLength (array , index ));
71+ assertEquals (codec .length () + UVarInt .byteLength (expected .length ), input .length - codec .digestLength (array , index ));
6972 }
7073
7174 @ ParameterizedTest (name = "{index}" )
@@ -80,6 +83,8 @@ void testDecodeRange(byte[] input, Multihash codec, byte[] expected) {
8083
8184 System .arraycopy (input , 0 , array , index , input .length );
8285 assertArrayEquals (expected , codec .decode (array , index , input .length ));
86+ assertEquals (expected .length , codec .digestLength (array , index ));
87+ assertEquals (codec .length () + UVarInt .byteLength (expected .length ), input .length - codec .digestLength (array , index ));
8388 }
8489
8590 @ ParameterizedTest (name = "{index}" )
0 commit comments