( l: Sequence.Node, r: Sequence.Node, s: SimulationState )
| 1771 | } |
| 1772 | |
| 1773 | const isSequenceSimulated = ( |
| 1774 | l: Sequence.Node, |
| 1775 | r: Sequence.Node, |
| 1776 | s: SimulationState |
| 1777 | ): boolean => { |
| 1778 | const minLength = Math.max(l.preLen + l.postLen, r.preLen + r.postLen) |
| 1779 | const maxLength = Math.min( |
| 1780 | l.maxLength ?? Number.POSITIVE_INFINITY, |
| 1781 | r.maxLength ?? Number.POSITIVE_INFINITY, |
| 1782 | Math.max(l.leading.length, r.leading.length) + |
| 1783 | Math.max(l.postLen, r.postLen) + |
| 1784 | 1 |
| 1785 | ) |
| 1786 | for (let length = minLength; length <= maxLength; length++) { |
| 1787 | for (let i = 0; i < length; i++) { |
| 1788 | if (!isSimulated(elementAt(l, length, i), elementAt(r, length, i), s)) |
| 1789 | return false |
| 1790 | } |
| 1791 | } |
| 1792 | return true |
| 1793 | } |
| 1794 | |
| 1795 | const elementAt = (node: Sequence.Node, length: number, i: number): BaseNode => |
| 1796 | i < node.leading.length ? node.leading[i].node |
no test coverage detected