Sha256: cdf07371bea20ae5a8dd9e8ce156cb6c192fa6e0c997254d912062235e1e3514

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

describe Netica::ActiveNetwork do
  describe "#new" do
    before(:all) do
      Netica::Environment.engage
    end
    after(:all) do
      Netica::Environment.instance.processor.finalize
    end

    context "with ChestClinic.dne" do
      before(:all) do
        @active_network = Netica::ActiveNetwork.new("fake_token_identifier", "#{File.dirname(__FILE__)}/../../examples/ChestClinic.dne")
      end

      it "should be an active network" do
        @active_network.should be_an_instance_of(Netica::ActiveNetwork)
      end

      it "should have 8 nodes" do
        @active_network.network.nodes.length.should == 8
      end

      it "should export it state as a hash" do
        @active_network.network.state.should be_an_instance_of(Hash)
      end

      context "the tuberculosis node" do
        it "should be less than 0.02 initially" do
          @active_network.network.node("Tuberculosis").value("present").should be_less_than 0.011
        end

        it "should be over 0.90 with an abnormal xray" do
          @active_network.network.node("XRay").value = "abnormal"
          @active_network.network.node("Tuberculosis").value("present").should be_greater_than 0.092
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
netica-0.0.5-java spec/netica/active_network_spec.rb