Skip to content

Commit

Permalink
Add tests with negative numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Chiquet committed Jun 8, 2023
1 parent ed9ebfd commit 9f9105b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ describe('Testing Unit', function () {
it('checks + precedence before number insise parenthesis ', function () {
assert.equal(mexp.eval('(-2)'), '-2')
})
it('dividing by negative number ', function () {
assert.equal(mexp.eval('2/-2'), '-1')
})
it('multiplying by negative number ', function () {
assert.equal(mexp.eval('2*-2'), '-4')
})
it('checks multiple allowable operator', function () {
assert.equal(mexp.eval('2+++-++-+-+3'), '-1')
assert.equal(mexp.eval('2*+3'), '6')
Expand Down

0 comments on commit 9f9105b

Please sign in to comment.