Skip to content
Draft
Changes from all commits
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
23 changes: 21 additions & 2 deletions test/interpreter/function-average.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,29 @@ describe('AVERAGE', () => {
['foo'],
[null],
['=TRUE()'],
['=AVERAGE(A1:A4)']
['=X100'],
['=AVERAGE(A1:A5)']
])

expect(engine.getCellValue(adr('A5'))).toEqual(42)
expect(engine.getCellValue(adr('A6'))).toEqual(42)
})

it('AVERAGE ignores all nonnumeric named expression arguments', () => {
const engine = HyperFormula.buildFromArray([
['=AVERAGE(A, B, F)'],
], {}, [
{ name: 'A', expression: '42' },
{ name: 'B', expression: '=42' },
{ name: 'C', expression: 'foo' },
{ name: 'D', expression: '="foo"' },
{ name: 'E', expression: null },
{ name: 'F', expression: '' },
{ name: 'G', expression: '=""' },
{ name: 'H', expression: '=TRUE()' },
{ name: 'I', expression: '=Sheet1!$X$100' },
])

expect(engine.getCellValue(adr('A1'))).toEqual(42)
})

it('error when no meaningful arguments', () => {
Expand Down