Module: Syskit::Test::ExecutionExpectations
- Included in:
- Syskit::Test
- Defined in:
- lib/syskit/test/execution_expectations.rb
Overview
Definition of expectations for Roby's expect_execution harness
Defined Under Namespace
Classes: HaveNoNewSample
Class Method Summary collapse
-
.resolve_orocos_reader(reader) ⇒ Object
private
Helper used to resolve reader objects.
Instance Method Summary collapse
-
#have_no_new_sample(reader, at_least_during: 0, backtrace: caller(1)) ⇒ nil
Expect that no new samples arrive on the reader for a certain time period.
-
#have_one_new_sample(reader, backtrace: caller(1)) ⇒ Object
Expect that one sample arrives on the reader, and return the sample.
Class Method Details
.resolve_orocos_reader(reader) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Helper used to resolve reader objects
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/syskit/test/execution_expectations.rb', line 8 def self.resolve_orocos_reader(reader) if reader.respond_to?(:to_orocos_port) reader = Orocos.allow_blocking_calls do reader.to_orocos_port end end if !reader.respond_to?(:read_new) if reader.respond_to?(:reader) reader = Orocos.allow_blocking_calls do reader.reader end end end reader end |
Instance Method Details
#have_no_new_sample(reader, at_least_during: 0, backtrace: caller(1)) ⇒ nil
Expect that no new samples arrive on the reader for a certain time period
52 53 54 55 |
# File 'lib/syskit/test/execution_expectations.rb', line 52 def have_no_new_sample(reader, at_least_during: 0, backtrace: caller(1)) add_expectation(HaveNoNewSample.new( reader, at_least_during, backtrace)) end |
#have_one_new_sample(reader, backtrace: caller(1)) ⇒ Object
Expect that one sample arrives on the reader, and return the sample
60 61 62 63 64 |
# File 'lib/syskit/test/execution_expectations.rb', line 60 def have_one_new_sample(reader, backtrace: caller(1)) orocos_reader = ExecutionExpectations.resolve_orocos_reader(reader) achieve(description: "#{reader} should have received a new sample", backtrace: backtrace) { orocos_reader.read_new } end |