Esempio n. 1
0
        public void TestStochasticBranchBlock()
        {
            Model          model  = new Model();
            StochTwoChoice ss2cbb = new StochTwoChoice(model, "s2c", Guid.NewGuid(), .2);

            ss2cbb.Outputs[0].PortDataPresented += new PortDataEvent(Out0_PortDataPresented);
            ss2cbb.Outputs[1].PortDataPresented += new PortDataEvent(Out1_PortDataPresented);
            Randoms.RandomServer rs = new Randoms.RandomServer(12345, 100);
            model.RandomServer = rs;
            for (m_itemNumber = 0; m_itemNumber < m_expected.Length; m_itemNumber++)
            {
                ss2cbb.Input.Put(new object());
                _Debug.Write(lastResult + ",");
                _Debug.Assert(lastResult == m_expected[m_itemNumber], "Unexpected choice.");
            }
        }
Esempio n. 2
0
        public void TestDelegatedBranchBlock()
        {
            Model          model = new Model();
            DelegTwoChoice d2cbb = new DelegTwoChoice(model, "s2c", Guid.NewGuid());

            d2cbb.BooleanDeciderDelegate        = new BooleanDecider(ChooseYesOrNo);
            d2cbb.Outputs[0].PortDataPresented += new PortDataEvent(Out0_PortDataPresented);
            d2cbb.Outputs[1].PortDataPresented += new PortDataEvent(Out1_PortDataPresented);
            Randoms.RandomServer rs = new Randoms.RandomServer(12345, 100);
            model.RandomServer = rs;
            for (m_itemNumber = 0; m_itemNumber < m_expected.Length; m_itemNumber++)
            {
                d2cbb.Input.Put(new object());
                _Debug.Write(lastResult + ",");
                _Debug.Assert(lastResult == m_expected[m_itemNumber], "Unexpected choice.");
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Services needs in the first dependency-sequenced round of initialization.
 /// </summary>
 /// <param name="model">The model in which the initialization is taking place.</param>
 /// <param name="p">The array of objects that take part in this round of initialization.</param>
 public void _Initialize(IModel model, object[] p)
 {
     m_randomSeed   = (ulong)p[0];
     m_randomServer = new Highpoint.Sage.Randoms.RandomServer(m_randomSeed, 0);
 }