Sha256: 505068c36305245cec58829a03c7fe1bd6c800c25beeb4cd6f99589017dda990

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require 'pione/test-helper'

TestHelper.scope do |this|
  this::PNML1 = Location[File.dirname(__FILE__)] + "data" + "pnml" + "Sequence.pnml"

  describe Pione::Util::PNMLCompiler do
    it "should compile from PNML to PIONE" do
      pione = Util::PNMLCompiler.new(this::PNML1, "Test", "E", "T").compile

      env = Lang::Environment.new.setup_new_package("Test")
      TestHelper::Lang.package_context!(env, pione)

      env.rule_get(Lang::RuleExpr.new("Main")).tap do |rule|
        cond = rule.rule_condition_context.eval(env)
        cond.inputs.should == [TestHelper::Lang.expr("'i1'")]
        cond.outputs.should == [TestHelper::Lang.expr("'o1'")]
      end

      env.rule_get(Lang::RuleExpr.new("A")).tap do |rule|
        cond = rule.rule_condition_context.eval(env)
        cond.inputs.should == [TestHelper::Lang.expr("'i1'")]
        cond.outputs.should == [TestHelper::Lang.expr("'p1'.touch")]
      end

      env.rule_get(Lang::RuleExpr.new("B")).tap do |rule|
        cond = rule.rule_condition_context.eval(env)
        cond.inputs.should == [TestHelper::Lang.expr("'p1'")]
        cond.outputs.should == [TestHelper::Lang.expr("'o1'.touch")]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pione-0.3.2 test/util/spec_pnml-compiler.rb