test/agent_test.rb in y_petri-2.1.9 vs test/agent_test.rb in y_petri-2.1.10
- old
+ new
@@ -1,7 +1,7 @@
#! /usr/bin/ruby
-# -*- coding: utf-8 -*-
+# encoding: utf-8
gem 'minitest', '=4.7.4'
require 'minitest/autorun'
require_relative '../lib/y_petri' # tested component itself
# require 'y_petri'
@@ -9,11 +9,11 @@
describe YPetri::Agent do
before do
@m = YPetri::Agent.new
end
-
+
it "has net basic points" do
# --- net point related assets ---
@m.net_point_reset
@m.net_point_reset @m.world.net( :Top )
@m.net.must_equal @m.world.Net::Top
@@ -66,11 +66,11 @@
.map( &:keys ).must_equal [[:Base]] * 3
@m.pn.must_equal []
@m.tn.must_equal []
@m.nn.must_equal [ :Top ] # ie. :Top net spanning whole workspace
end
-
+
describe "slightly more complicated case" do
before do
@p = @m.Place ɴ: "P", default_marking: 1
@q = @m.Place ɴ: "Q", default_marking: 1
@decay_t = @m.Transition ɴ: "Tp", s: { P: -1 }, rate: 0.1
@@ -79,11 +79,11 @@
@m.initial_marking @q => 2
@m.set_step 0.01
@m.set_sampling 1
@m.set_time 0..30
end
-
+
it "works" do
@m.run!
@m.simulation.send( :places ).map( &:source )
.must_equal [ @p, @q ]
@m.simulation.send( :transitions ).map( &:source )
@@ -95,8 +95,17 @@
.stoichiometry_matrix.column_size.must_equal 2
@m.simulation.send( :S_transitions )
.stoichiometry_matrix.row_size.must_equal 2
@m.simulation.flux_vector.row_size.must_equal 2
# @m.plot_recording
+ rec = @m.simulation.recording
+ rec.marking.plot
+ rec.flux.plot
+ rec.gradient.plot
+ rec.delta( Δt: 1 ).plot
+ @m.plot_marking
+ @m.plot_flux
+ @m.plot_gradient
+ @m.plot_delta( Δt: 1 )
end
end
end