You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

file_segment_test.go 646 B

123456789101112131415161718192021222324252627282930313233343536
  1. package cache
  2. import (
  3. "fmt"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func Test_FindSegmentIndex(t *testing.T) {
  8. cases := []struct {
  9. title string
  10. buffer SegmentBuffer
  11. postions []int64
  12. wants []int
  13. }{
  14. {
  15. buffer: SegmentBuffer{
  16. buzys: []*FileSegment{
  17. {Position: 0}, {Position: 10},
  18. },
  19. },
  20. postions: []int64{0, 2, 10, 11},
  21. wants: []int{0, 0, 1, 1},
  22. },
  23. }
  24. for i, c := range cases {
  25. for j, _ := range c.postions {
  26. Convey(fmt.Sprintf("%d.%d. %s", i, j, c.title), t, func() {
  27. got := c.buffer.FirstContains(c.postions[j])
  28. So(got, ShouldEqual, c.wants[j])
  29. })
  30. }
  31. }
  32. }

本项目旨在将云际存储公共基础设施化,使个人及企业可低门槛使用高效的云际存储服务(安装开箱即用云际存储客户端即可,无需关注其他组件的部署),同时支持用户灵活便捷定制云际存储的功能细节。