238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
|
# File 'lib/bparity/formal/lts.rb', line 238
def call(lts:, sequence:, subject_name:)
expected = outputs(lts, sequence)
<<~RUBY
# frozen_string_literal: true
require "bparity"
load ENV.fetch("BPARITY_ADAPTER")
RSpec.describe "F3 distinguishing sequence for #{subject_name}" do
it "matches the learned legacy model for #{sequence.join(' -> ')}" do
binding = Bparity.adapter_definition.subjects.fetch(#{subject_name.inspect})
subject = binding.build({})
sequence = #{sequence.inspect}
actual = sequence.map do |name|
operation = binding.operations.fetch(name)
begin
value = operation.invoke(subject, [], {})
Bparity::Formal::LtsEncoding.output({ "kind" => "return", "value" =>
Bparity::Recording::Serializer.dump(operation.map_return(value)) })
rescue StandardError => error
Bparity::Formal::LtsEncoding.output({ "kind" => "raise", **operation.map_error(error) })
end
end
expect(actual).to eq(#{expected.inspect})
end
end
RUBY
end
|