diff --git a/Bit-Manipulation/test/BinaryCountSetBits.test.js b/Bit-Manipulation/test/BinaryCountSetBits.test.js new file mode 100644 index 000000000..31740b66b --- /dev/null +++ b/Bit-Manipulation/test/BinaryCountSetBits.test.js @@ -0,0 +1,26 @@ +import { BinaryCountSetBits } from '../BinaryCountSetBits' + +test('check BinaryCountSetBits of 25 is 3', () => { + const res = BinaryCountSetBits(25) + expect(res).toBe(3) +}) +test('check BinaryCountSetBits of 36 is 2', () => { + const res = BinaryCountSetBits(36) + expect(res).toBe(2) +}) +test('check BinaryCountSetBits of 16 is 1', () => { + const res = BinaryCountSetBits(16) + expect(res).toBe(1) +}) +test('check BinaryCountSetBits of 58 is 4', () => { + const res = BinaryCountSetBits(58) + expect(res).toBe(4) +}) +test('check BinaryCountSetBits of 4294967295 is 32', () => { + const res = BinaryCountSetBits(4294967295) + expect(res).toBe(32) +}) +test('check BinaryCountSetBits of 0 is 0', () => { + const res = BinaryCountSetBits(0) + expect(res).toBe(0) +})