function add(a, b){ return --a - ~b; }
// write a add function that doesn't use the plus symbol- function add(a, b){
return a + b;}// Make sure to view the test cases to see how this test fails- return --a - ~b;
- }
const fs = require('fs'); const solution = fs.readFileSync('/home/codewarrior/solution.txt', 'utf8'); describe("Check Solution", function(){ it("should prevent the '+' symbol from being used anywhere in the code", function(){ Test.expect(solution.indexOf('+') == -1, "Your code isn't allowed to include the + symbol!"); }); it("should actually test the add function", function(){ Test.assertEquals(add(1, 1), 2); Test.assertEquals(add(5, 7), 12); Test.assertEquals(add(-8, 59), 51); Test.assertEquals(add(0, 0), 0); Test.assertEquals(add(-1, -1), -2); }); });
- const fs = require('fs');
- const solution = fs.readFileSync('/home/codewarrior/solution.txt', 'utf8');
- describe("Check Solution", function(){
- it("should prevent the '+' symbol from being used anywhere in the code", function(){
- Test.expect(solution.indexOf('+') == -1, "Your code isn't allowed to include the + symbol!");
- });
- it("should actually test the add function", function(){
- Test.assertEquals(add(1, 1), 2);
- Test.assertEquals(add(5, 7), 12);
- Test.assertEquals(add(-8, 59), 51);
- Test.assertEquals(add(0, 0), 0);
- Test.assertEquals(add(-1, -1), -2);
- });
- });