fix(pkg): fix using ~
as the lower bound for RangeMinMax
This commit is contained in:
parent
ee05d6f004
commit
1f9be057b6
2 changed files with 11 additions and 0 deletions
|
@ -35,6 +35,9 @@ func RangeMinMax(min, max string) *Range {
|
|||
panic("invalid performance data range minimum value")
|
||||
}
|
||||
pdRange := &Range{}
|
||||
if min == "~" {
|
||||
min = ""
|
||||
}
|
||||
pdRange.start = min
|
||||
pdRange.end = max
|
||||
return pdRange
|
||||
|
|
|
@ -43,6 +43,14 @@ func TestRangeMinMax(t *testing.T) {
|
|||
assert.False(t, pdr.inside, "Inside flag should not be set")
|
||||
}
|
||||
|
||||
func TestRangeMinMaxOpen(t *testing.T) {
|
||||
min, max := "~", "456"
|
||||
pdr := RangeMinMax(min, max)
|
||||
assert.Equal(t, "", pdr.start, "Min value not clear in PerfDataRange")
|
||||
assert.Equal(t, max, pdr.end, "Max value not copied to PerfDataRange")
|
||||
assert.False(t, pdr.inside, "Inside flag should not be set")
|
||||
}
|
||||
|
||||
func TestRangeInside(t *testing.T) {
|
||||
pdr := &Range{}
|
||||
pdr = pdr.Inside()
|
||||
|
|
Loading…
Reference in a new issue