# queryfn tests

FEATURE: queryfn-max-number
background:
  type Flight struct {id int unique, wid number optional }  end
thenType: struct

---
title: max
given:
  insert Flight {id: 55, wid: 4 }
  insert Flight {id: 56, wid: 3 }
when:
  let x = Flight[true].wid.max()
then:
value:a:number:4.0

---
title: max empty
given:
  insert Flight {id: 55, wid: 4 }
  insert Flight {id: 56, wid: 3 }
when:
  let x = Flight[id=100].wid.max()
then:
null

---
title: null
#we ignore null values
given:
  insert Flight {id: 55 }
  insert Flight {id: 56, wid: 3 }
when:
  let x = Flight[true].wid.max()
then:
value:a:number:3.0

---
title: bad field name
given:
  insert Flight {id: 55, wid: 4 }
  insert Flight {id: 56, wid: 3 }
when:
  let x = Flight[true].zzz.max()
then:
ERROR: unknown-field
