static verifySegmentIndex(stream, references) {
    expect(stream).toBeTruthy();
    expect(stream.segmentIndex).toBeTruthy();

    if (references.length == 0) {
      expect(stream.segmentIndex.find(0)).toBe(null);
      return;
    }

    for (const expectedRef of references) {
      // Don't query negative times.  Query 0 instead.
      const startTime = Math.max(0, expectedRef.startTime);
      // Some segment start times are before the beginning of the period.
      // So default to 0 here if position is null.
      const position = stream.segmentIndex.find(startTime) || 0;
      const actualRef = stream.segmentIndex.get(position);
      // NOTE: A custom matcher for SegmentReferences is installed, so this
      // checks the URIs as well.
      expect(actualRef).toEqual(expectedRef);
      // However, if it does fail because of URIs, you won't see them in the
      // output without this, as well:
      expect(actualRef.getUris()).toEqual(expectedRef.getUris());
    }

    // Make sure that the references stop at the end.
    const lastExpectedReference = references[references.length - 1];
    const positionAfterEnd =
        stream.segmentIndex.find(lastExpectedReference.endTime);
    expect(positionAfterEnd).toBe(null);
  }
Verifies the segment references of a stream.

@param {?shaka.extern.Stream} stream
@param {!Array<shaka.media.SegmentReference>} references