|
- const BIT = require('../src/utils/bitman.js');
- const expect = require('chai').expect;
-
- describe("Testing utils/bitman ...", function(){
- it(".isOn() 'true' test", function(){
- expect(BIT.isOn(parseInt("0010", 2), 1)).be.true;
- });
-
- it(".isOn() 'false' test", function(){
- expect(BIT.isOn(parseInt('0111', 2), 3)).be.false;
- });
-
- it(".set()", function(){
- let num = 1;
- num = BIT.set(num, 1);
- expect(num).to.equal(3);
- });
-
- it(".clear()", function(){
- let num = 15;
- num = BIT.clear(num, 2);
- expect(num).to.equal(11);
- });
-
- it(".toggle()", function(){
- let num = 9;
- num = BIT.toggle(num, 3);
- num = BIT.toggle(num, 2);
- expect(num).to.equal(5);
- });
- });
|