Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1-liner bugfix for Interval Set #4481

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

1-liner bugfix for Interval Set #4481

wants to merge 1 commit into from

Commits on Dec 6, 2023

  1. Bugfix for Interval Set

    This is necessary or else the last else if will never be executed and the function returns wrong results for some cases. For example, these tests will not run without this change:
    
    TestRemoveRangeSameStart() {
    	i := NewIntervalSet()
    	i.addInterval(antlr.NewInterval(1, 10))
    	i.removeRange(antlr.NewInterval(1, 7))
    
    	suite.Len(i.intervals, 1)
    	suite.Equal(7, i.intervals[0].Start)
    	suite.Equal(10, i.intervals[0].Stop)
    }
    
    TestRemoveRangeOverStartBound() {
    	i := NewIntervalSet()
    	i.addInterval(antlr.NewInterval(5, 15))
    
    	i.removeRange(antlr.NewInterval(1, 10))
    	suite.Len(i.intervals, 1)
    	suite.Equal(10, i.intervals[0].Start)
    	suite.Equal(15, i.intervals[0].Stop)
    }
    
    
    Signed-off-by: Gustavo de Morais <gustavopguto@gmail.com>
    Guttz authored Dec 6, 2023
    Configuration menu
    Copy the full SHA
    5599637 View commit details
    Browse the repository at this point in the history