Skip to content

Commit

Permalink
test: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxVitoxxx committed Oct 13, 2024
1 parent ccabe86 commit 0b28abd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions 190.reverse_bits/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ import (
func TestReverseBits(t *testing.T) {
for _, tt := range []struct {
binaryStr string
want string
wantStr string
}{{
binaryStr: "00000010100101000001111010011100",
want: "00111001011110000010100101000000",
wantStr: "00111001011110000010100101000000",
}, {
binaryStr: "11111111111111111111111111111101",
wantStr: "10111111111111111111111111111111",
}} {
num, _ := strconv.ParseInt(tt.binaryStr, 2, 32)
want, _ := strconv.ParseInt(tt.want, 2, 32)
num, _ := strconv.ParseInt(tt.binaryStr, 2, 64)
want, _ := strconv.ParseInt(tt.wantStr, 2, 64)

num1 := num
got := reverseBits(uint32(num1))
Expand Down

0 comments on commit 0b28abd

Please sign in to comment.