(t *testing.T)
| 34 | } |
| 35 | |
| 36 | func TestActiveTask_RemainingTask(t *testing.T) { |
| 37 | at := &ActiveTask{ |
| 38 | Task: types.Task{Offset: 0, Length: 1000}, |
| 39 | } |
| 40 | at.CurrentOffset.Store(0) |
| 41 | at.StopAt.Store(1000) |
| 42 | |
| 43 | // Initially full task remaining |
| 44 | remaining := at.RemainingTask() |
| 45 | if remaining == nil { |
| 46 | t.Fatal("RemainingTask returned nil") |
| 47 | return |
| 48 | } |
| 49 | if remaining.Offset != 0 || remaining.Length != 1000 { |
| 50 | t.Errorf("RemainingTask = %+v, want Offset=0, Length=1000", remaining) |
| 51 | } |
| 52 | |
| 53 | // After some progress |
| 54 | at.CurrentOffset.Store(600) |
| 55 | remaining = at.RemainingTask() |
| 56 | if remaining.Offset != 600 || remaining.Length != 400 { |
| 57 | t.Errorf("RemainingTask = %+v, want Offset=600, Length=400", remaining) |
| 58 | } |
| 59 | |
| 60 | // Completed |
| 61 | at.CurrentOffset.Store(1000) |
| 62 | if at.RemainingTask() != nil { |
| 63 | t.Error("RemainingTask should return nil when complete") |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | func TestActiveTask_GetSpeed(t *testing.T) { |
| 68 | at := &ActiveTask{ |
nothing calls this directly
no test coverage detected