Fantasy 8Bit system (F8), is a fantasy 8bit console and a set of libraries for creating fantasy 8bit consoles.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 line
706B

  1. const BIT = require('../src/utils/bitman.js');
  2. const expect = require('chai').expect;
  3. describe("Testing utils/bitman ...", function(){
  4. it(".isOn() 'true' test", function(){
  5. expect(BIT.isOn(parseInt("0010", 2), 1)).be.true;
  6. });
  7. it(".isOn() 'false' test", function(){
  8. expect(BIT.isOn(parseInt('0111', 2), 3)).be.false;
  9. });
  10. it(".set()", function(){
  11. let num = 1;
  12. num = BIT.set(num, 1);
  13. expect(num).to.equal(3);
  14. });
  15. it(".clear()", function(){
  16. let num = 15;
  17. num = BIT.clear(num, 2);
  18. expect(num).to.equal(11);
  19. });
  20. it(".toggle()", function(){
  21. let num = 9;
  22. num = BIT.toggle(num, 3);
  23. num = BIT.toggle(num, 2);
  24. expect(num).to.equal(5);
  25. });
  26. });