github.com/fzfile/BaiduPCS-Go@v0.0.0-20200606205115-4408961cf336/requester/downloader/range_test.go (about) 1 package downloader_test 2 3 import ( 4 "fmt" 5 "github.com/fzfile/BaiduPCS-Go/requester/downloader" 6 "testing" 7 ) 8 9 func TestRangeListGen(t *testing.T) { 10 gen1 := downloader.NewRangeListGenDefault(1024, 0, 0, 10) 11 gen2 := downloader.NewRangeListGenBlockSize(1024, 0, 53) 12 13 for mode, gen := range []*downloader.RangeListGen{gen1, gen2} { 14 fmt.Printf("[%d] ----\n", mode+1) 15 for i, r := gen.GenRange(); r != nil; i, r = gen.GenRange() { 16 fmt.Printf("%d: %s\n", i, r.ShowDetails()) 17 } 18 fmt.Println() 19 } 20 }