Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 80cea08

Browse files
merge: Add testcases of BinaryCountSetBits function (TheAlgorithms#922)
1 parent 7f479b8 commit 80cea08

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { BinaryCountSetBits } from '../BinaryCountSetBits'
2+
3+
test('check BinaryCountSetBits of 25 is 3', () => {
4+
const res = BinaryCountSetBits(25)
5+
expect(res).toBe(3)
6+
})
7+
test('check BinaryCountSetBits of 36 is 2', () => {
8+
const res = BinaryCountSetBits(36)
9+
expect(res).toBe(2)
10+
})
11+
test('check BinaryCountSetBits of 16 is 1', () => {
12+
const res = BinaryCountSetBits(16)
13+
expect(res).toBe(1)
14+
})
15+
test('check BinaryCountSetBits of 58 is 4', () => {
16+
const res = BinaryCountSetBits(58)
17+
expect(res).toBe(4)
18+
})
19+
test('check BinaryCountSetBits of 4294967295 is 32', () => {
20+
const res = BinaryCountSetBits(4294967295)
21+
expect(res).toBe(32)
22+
})
23+
test('check BinaryCountSetBits of 0 is 0', () => {
24+
const res = BinaryCountSetBits(0)
25+
expect(res).toBe(0)
26+
})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /