MCPcopy
hub / github.com/syncthing/syncthing / TestShortIDString

Function TestShortIDString

lib/protocol/deviceid_test.go:89–102  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

87}
88
89func TestShortIDString(t *testing.T) {
90 id, _ := DeviceIDFromString(formatted)
91
92 sid := id.Short().String()
93 // keep consistent with ShortIDStringLength in lib/protocol/deviceid.go
94 if len(sid) != 7 {
95 t.Errorf("Wrong length for short ID: got %d, want 7", len(sid))
96 }
97
98 want := formatted[:len(sid)]
99 if sid != want {
100 t.Errorf("Wrong short ID: got %q, want %q", sid, want)
101 }
102}
103
104func TestDeviceIDFromBytes(t *testing.T) {
105 id0, _ := DeviceIDFromString(formatted)

Callers

nothing calls this directly

Calls 3

DeviceIDFromStringFunction · 0.85
ShortMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected