Added more tests

This commit is contained in:
Ricardo Fernández Serrata 2022-05-30 22:25:35 -04:00 committed by GitHub
parent 8af284195f
commit fce580f67f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,9 @@
import isPowerOfTwo from '../isPowerOfTwo';
describe('isPowerOfTwo', () => {
it('should detect if the number is power of two', () => {
it('should detect if the int is power of two', () => {
expect(isPowerOfTwo(-32)).toBe(false);
expect(isPowerOfTwo(-1)).toBe(false);
expect(isPowerOfTwo(1)).toBe(true);
expect(isPowerOfTwo(2)).toBe(true);
expect(isPowerOfTwo(3)).toBe(false);
@ -16,5 +18,6 @@ describe('isPowerOfTwo', () => {
expect(isPowerOfTwo(32)).toBe(true);
expect(isPowerOfTwo(127)).toBe(false);
expect(isPowerOfTwo(128)).toBe(true);
expect(isPowerOfTwo(2 ** 30)).toBe(true);
});
});