MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestCrc32cHashString

Function TestCrc32cHashString

base/util_test.go:1676–1697  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1674}
1675
1676func TestCrc32cHashString(t *testing.T) {
1677 tests := []struct {
1678 input string
1679 hash string
1680 }{
1681 {
1682 input: "",
1683 hash: "0x00000000",
1684 },
1685 {
1686 input: "foo",
1687 hash: "0xcfc4ae1d",
1688 },
1689 }
1690 for _, test := range tests {
1691 t.Run(fmt.Sprintf("input %s -> hash %s", test.hash, test.input), func(t *testing.T) {
1692 assert.Equal(t, test.hash, Crc32cHashString([]byte(test.input)))
1693 // crc32 hashes are always leading 0x + length 8
1694 assert.Equal(t, len(test.hash), 10)
1695 })
1696 }
1697}
1698
1699func TestReplaceLast(t *testing.T) {
1700 cases := []struct {

Callers

nothing calls this directly

Calls 3

Crc32cHashStringFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected