fbp-spec
Version:
Data-driven FBP component/graph testing tool
103 lines (98 loc) • 1.82 kB
YAML
name: "Different predicates"
topic: "core/Repeat"
fixture:
type: 'fbp'
data: |
# @runtime python-example
INPORT=it.IN:IN
OUTPORT=f.OUT:OUT
it(core/Repeat) OUT -> IN f(core/Repeat)
cases:
# equal
-
name: 'equals with correct expect'
assertion: 'should pass'
inputs:
in: true
expect:
out:
equals: true
-
name: 'equals with wrong expect'
assertion: 'should fail'
inputs:
in: true
expect:
out:
equals: false
# above
-
name: 'above with wrong expect'
assertion: 'should fail'
inputs:
in: 1000
expect:
out:
above: 1001
# haveKeys
-
name: 'haveKeys with correct expect'
assertion: 'should pass'
inputs:
in: { foo: 'bar' }
expect:
out:
haveKeys: ['foo']
# type
-
name: 'type with correct expectation'
assertion: 'should pass'
inputs:
in: { foo: 'bar' }
expect:
out:
type: 'object'
# includeKeys
-
name: 'includeKeys with correct expect'
assertion: 'should pass'
inputs:
in: { foo: 'bar', foo2: 'baz' }
expect:
out:
includeKeys: ['foo']
-
name: 'includeKeys with wrong expect'
assertion: 'should fail'
inputs:
in: { foo: 'bar', foo2: 'baz' }
expect:
out:
includeKeys: ['foo', 'foo3']
# contains
-
name: 'contains on string with correct expect'
assertion: 'should pass'
inputs:
in: "my string with a substring 22"
expect:
out:
contains: 'substring'
-
name: 'contains on string with wrong expect'
assertion: 'should fail'
inputs:
in: "my string with a substring 22"
expect:
out:
contains: 'substring 3'
# multiple expectations
-
name: 'multiple expectations on one value, one wrong'
assertion: 'should fail'
inputs:
in: { foo: bar }
expect:
out:
- type: 'object'
- haveKeys: ['nonexist']