MCPcopy Create free account
hub / github.com/rclone/rclone / TestRandomSource

Function TestRandomSource

backend/crypt/cipher_test.go:1054–1067  ·  view source on GitHub ↗

Test test infrastructure first!

(t *testing.T)

Source from the content-addressed store, hash-verified

1052
1053// Test test infrastructure first!
1054func TestRandomSource(t *testing.T) {
1055 source := newRandomSource(1e8)
1056 sink := newRandomSource(1e8)
1057 n, err := io.Copy(sink, source)
1058 assert.NoError(t, err)
1059 assert.Equal(t, int64(1e8), n)
1060
1061 source = newRandomSource(1e8)
1062 buf := make([]byte, 16)
1063 _, _ = source.Read(buf)
1064 sink = newRandomSource(1e8)
1065 _, err = io.Copy(sink, source)
1066 assert.EqualError(t, err, "Error in stream at 1")
1067}
1068
1069type zeroes struct{}
1070

Callers

nothing calls this directly

Calls 4

newRandomSourceFunction · 0.85
CopyMethod · 0.65
ReadMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…