Skip to content

Commit

Permalink
Add test for crc24()
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeto committed Jul 11, 2019
1 parent 5aaa2f9 commit 3ac66b7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions passphrase2pgp_test.go
Expand Up @@ -24,3 +24,22 @@ func TestMpi(t *testing.T) {
}
}
}

func TestCRC24(t *testing.T) {
table := []struct {
input string
want int32
}{
{"", 0xb704ce},
{"hello", 0x47f58a},
{"The quick brown fox jumper over the lazy dog.", 0x4d2822},
{string(make([]byte, 16)), 0x900590},
}

for _, row := range table {
got := crc24([]byte(row.input))
if got != row.want {
t.Errorf("crc24(%q), got %#x, want %#x", row.input, got, row.want)
}
}
}

0 comments on commit 3ac66b7

Please sign in to comment.