@@ -679,11 +679,20 @@ static bool test_stream_decoder(Layer layer, bool is_ogg, bool is_chained_ogg)
679679 FLAC::Decoder::Stream::State state = decoder->get_state ();
680680 printf (" returned state = %u (%s)... OK\n " , (uint32_t )((::FLAC__StreamDecoderState)state), state.as_cstring ());
681681
682+ printf (" testing get_link_lengths()... " );
683+ if (decoder->get_link_lengths (NULL ) != FLAC__STREAM_DECODER_GET_LINK_LENGTHS_NOT_INDEXED)
684+ return die_s_ (" returned incorrectly" , decoder);
685+
682686 printf (" progress to next chain link with finish_link()... " );
683687 if (!decoder->finish_link ())
684688 return die_s_ (" returned false" , decoder);
685689 printf (" OK\n " );
686690 }
691+ else {
692+ printf (" testing get_link_lengths()... " );
693+ if (decoder->get_link_lengths (NULL ) != FLAC__STREAM_DECODER_GET_LINK_LENGTHS_INVALID)
694+ return die_s_ (" returned incorrectly" , decoder);
695+ }
687696
688697 printf (" testing get_state()... " );
689698 FLAC::Decoder::Stream::State state = decoder->get_state ();
@@ -772,6 +781,24 @@ static bool test_stream_decoder(Layer layer, bool is_ogg, bool is_chained_ogg)
772781 return die_s_ (expect? " returned false" : " returned true" , decoder);
773782 printf (" OK\n " );
774783
784+ if (is_chained_ogg) {
785+ FLAC__uint64 *link_lengths;
786+ printf (" testing get_link_lengths()... " );
787+ if (decoder->get_link_lengths (NULL ) != 2 )
788+ return die_s_ (" returned incorrectly" , decoder);
789+
790+ printf (" testing get_link_lengths()... " );
791+ if (decoder->get_link_lengths (&link_lengths) != 2 )
792+ return die_s_ (" returned incorrectly" , decoder);
793+ free (link_lengths);
794+ }
795+ else {
796+ printf (" testing get_link_lengths()... " );
797+ if (decoder->get_link_lengths (NULL ) != FLAC__STREAM_DECODER_GET_LINK_LENGTHS_INVALID)
798+ return die_s_ (" returned incorrectly" , decoder);
799+ }
800+
801+
775802 printf (" testing get_channels()... " );
776803 {
777804 uint32_t channels = decoder->get_channels ();
0 commit comments