MCPcopy Index your code
hub / github.com/syncthing/syncthing / TestAddFolderCompletion

Function TestAddFolderCompletion

lib/model/model_test.go:3598–3612  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3596}
3597
3598func TestAddFolderCompletion(t *testing.T) {
3599 // Empty folders are always 100% complete.
3600 comp := newFolderCompletion(db.Counts{}, db.Counts{}, 0, remoteFolderValid)
3601 comp.add(newFolderCompletion(db.Counts{}, db.Counts{}, 0, remoteFolderPaused))
3602 if comp.CompletionPct != 100 {
3603 t.Error(comp.CompletionPct)
3604 }
3605
3606 // Completion is of the whole
3607 comp = newFolderCompletion(db.Counts{Bytes: 100}, db.Counts{}, 0, remoteFolderValid) // 100% complete
3608 comp.add(newFolderCompletion(db.Counts{Bytes: 400}, db.Counts{Bytes: 50}, 0, remoteFolderValid)) // 82.5% complete
3609 if comp.CompletionPct != 90 { // 100 * (1 - 50/500)
3610 t.Error(comp.CompletionPct)
3611 }
3612}
3613
3614func TestScanDeletedROChangedOnSR(t *testing.T) {
3615 m, conn, fcfg := setupModelWithConnection(t)

Callers

nothing calls this directly

Calls 3

newFolderCompletionFunction · 0.85
ErrorMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected