# let query filter tests

FEATURE: filter-expr and/or/not
background:
  type Flight struct {id int unique, wid int optional, h int optional }  end
thenType: struct

---
title: and
given:
  insert Flight {id: 55, wid: 1, h: 10 }
when:
  let x = Flight[wid < 10 and h < 100]
then:
value:a:Flight {
 vid:55
 vwid:1
 vh:10
}

---
title: and none
given:
  insert Flight {id: 55, wid: 1, h: 10 }
when:
  let x = Flight[wid < 1 and h < 100]
then:
null

---
title: and not2
given:
  insert Flight {id: 55, wid: 1, h: 10 }
when:
  let x = Flight[wid < 10 and h < -100]
then:
null

---
title: or
given:
  insert Flight {id: 55, wid: 1, h: 10 }
when:
  let x = Flight[wid < 10 or h < 100]
then:
value:a:Flight {
 vid:55
 vwid:1
 vh:10
}

---
title: or not
given:
  insert Flight {id: 55, wid: 1, h: 10 }
when:
  let x = Flight[wid < -1 or h < 0]
then:
null

---
title: not
given:
  insert Flight {id: 55, wid: 1, h: 10 }
when:
#  let x = Flight[!((wid < 10) or (h < 100))]
  let x = Flight[!(wid < 10) or (h < 100)]
then:
value:a:Flight {
 vid:55
 vwid:1
 vh:10
}

---
title: not2
given:
  insert Flight {id: 55, wid: 1, h: 10 }
when:
  let x = Flight[!(wid < 0)]
then:
value:a:Flight {
 vid:55
 vwid:1
 vh:10
}

---
SKIP: do more nested ands and ors
given:
  insert Flight {id: 55, wid: 1, h: 10 }
when:
  let x = Flight[!(wid < 0)]
then:
value:a:Flight {
 vid:55
 vwid:1
 vh:10
}
