UNPKG

dist-javascript-algorithms-and-data-structures

Version:

Algorithms and data-structures implemented on JavaScript

17 lines (14 loc) 662 B
"use strict"; var _switchSign = _interopRequireDefault(require("../switchSign")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } describe('switchSign', () => { it('should switch the sign of the number using twos complement approach', () => { expect((0, _switchSign.default)(0)).toBe(0); expect((0, _switchSign.default)(1)).toBe(-1); expect((0, _switchSign.default)(-1)).toBe(1); expect((0, _switchSign.default)(32)).toBe(-32); expect((0, _switchSign.default)(-32)).toBe(32); expect((0, _switchSign.default)(23)).toBe(-23); expect((0, _switchSign.default)(-23)).toBe(23); }); });