Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests for function SUM and operator ^ #1409

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add a unit test for operator power (^) with negative base
  • Loading branch information
sequba committed Apr 25, 2024
commit dcc9be87507fdafe54079fac6af6b4b8995553af
14 changes: 14 additions & 0 deletions test/interpreter/operator-power.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,18 @@ describe('Operator POWER', () => {
expect(engine.getCellValue(adr('C1'))).toEqualError(detailedError(ErrorType.NUM, ErrorMessage.NaN))
expect(engine.getCellValue(adr('C2'))).toEqualError(detailedError(ErrorType.NUM, ErrorMessage.NaN))
})

it('negative base', () => {
const engine = HyperFormula.buildFromArray([
['', 2, -2],
[3, '=B1^A2', '=C1^A2'],
[3.5, '=B1^A3', '=C1^A3'],
])

expect(engine.getCellValue(adr('B2'))).toBe(8)
expect(engine.getCellValue(adr('B3'))).toBeCloseTo(11.3137)
expect(engine.getCellValue(adr('C2'))).toBe(-8)
expect(engine.getCellValue(adr('C3'))).toEqualError(detailedError(ErrorType.NUM, ErrorMessage.NaN))

})
})
Loading