MCPcopy
hub / github.com/WireGuard/wireguard-go / TestChecksum

Function TestChecksum

tun/checksum_test.go:38–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

36}
37
38func TestChecksum(t *testing.T) {
39 for length := 0; length <= 9001; length++ {
40 buf := make([]byte, length)
41 rng := rand.New(rand.NewSource(1))
42 rng.Read(buf)
43 csum := checksum(buf, 0x1234)
44 csumRef := checksumRef(buf, 0x1234)
45 if csum != csumRef {
46 t.Error("Expected checksum", csumRef, "got", csum)
47 }
48 }
49}
50
51func TestPseudoHeaderChecksum(t *testing.T) {
52 for _, addrLen := range []int{4, 16} {

Callers

nothing calls this directly

Calls 4

checksumRefFunction · 0.85
checksumFunction · 0.70
ReadMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected