You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
452 B
Go
31 lines
452 B
Go
2 months ago
|
package mget
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"reflect"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestRangePlus(t *testing.T) {
|
||
|
var r = Redo{
|
||
|
ContentLength: 100,
|
||
|
rangeUpdated: true,
|
||
|
Range: []Range{
|
||
|
{10, 12},
|
||
|
{13, 20},
|
||
|
{17, 19},
|
||
|
{30, 80},
|
||
|
{90, 97},
|
||
|
},
|
||
|
}
|
||
|
err := r.reform()
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
}
|
||
|
if !reflect.DeepEqual(r.Range, []Range{{10, 20}, {30, 80}, {90, 97}}) {
|
||
|
t.Error("reform error")
|
||
|
}
|
||
|
fmt.Println(r.Range)
|
||
|
fmt.Println(r.ReverseRange())
|
||
|
}
|