MCPcopy
hub / github.com/SurgeDM/Surge / TestActiveTask_RemainingTask

Function TestActiveTask_RemainingTask

internal/engine/concurrent/task_test.go:36–65  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

34}
35
36func 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
67func TestActiveTask_GetSpeed(t *testing.T) {
68 at := &ActiveTask{

Callers

nothing calls this directly

Calls 2

RemainingTaskMethod · 0.95
ErrorMethod · 0.80

Tested by

no test coverage detected