Пример #1
0
def must_view_status_update():
  must_view = make_assert(
      lambda e: (e.fn.start.called, "Didn't view status update"))
  if_updated = make_if(
      lambda e: e.fn.status.called, make_next(must_view))
  spec = if_updated + make_next(lambda: spec)
  return spec
Пример #2
0
        def spec():
            asserts = make_assert(True,
                    lambda e: e.fn.m.inputs[1] > 0,
                    lambda e: e.fn.m.inputs[1] != 5,
                    make_next(lambda: asserts))

            return asserts
Пример #3
0
def spec():
  # create assert specification
  a = make_assert(
          lambda event: event.fn.func.inputs[0] > 0)
  # create next specification
  n = make_next(lambda: spec)
  # combine by tail composition
  return a + n
Пример #4
0
def spec_bar_called():
  # create assert specification
  a = make_assert(
          lambda event: event.fn.bar.called)
  # create next specification
  n = make_next(spec)
  # combine by tail composition
  return a + n
Пример #5
0
def spec():
  # create assert specification
  a = make_assert(
          lambda event: event.fn.foo.called)

  # create if-then specification, with guard expression
  # and an assert specification in the then clause
  if_guard = lambda event: event.fn.foo.inputs[0] == 0
  if_then = make_assert(
          lambda event: event.fn.foo.inputs[1] == 0)
  i = make_if(if_guard, if_then)

  # create next specification
  n = make_next(spec_bar_called)
  # combine the three by tail composition
  return a + i + n
Пример #6
0
 def spec():
     s = make_assert(lambda e: (len(e.history) == 1,"Too much history"),
             make_next(lambda: s))
     return s
Пример #7
0
 def spec():
     a = make_assert(False)
     return make_next(a)