(t *testing.T)
| 1674 | } |
| 1675 | |
| 1676 | func 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 | |
| 1699 | func TestReplaceLast(t *testing.T) { |
| 1700 | cases := []struct { |
nothing calls this directly
no test coverage detected