Exemplo n.º 1
0
        public void TestEventInheritanceRun()
        {
            var tcs     = new TaskCompletionSource <bool>();
            var runtime = new ProductionRuntime();
            var a       = runtime.CreateMachine(typeof(A), null, new A.Configure(tcs), null);

            runtime.SendEvent(a, new A.E3());
            runtime.SendEvent(a, new E1());
            runtime.SendEvent(a, new E2());
            Assert.True(tcs.Task.Wait(2000), "Test timed out");
        }
Exemplo n.º 2
0
        public void RunWithLogger()
        {
            var configuration = PSharp.Configuration.Create().WithVerbosityEnabled(0);
            var runtime       = new ProductionRuntime(configuration);
            ConcurrentQueue <MachineId> machines = new ConcurrentQueue <MachineId>();

            Parallel.For(0, Clients, index =>
            {
                machines.Enqueue(runtime.CreateMachine(typeof(SimpleMachine), new SetContextMessage(runtime)));
            });

            foreach (var machine in machines)
            {
                runtime.SendEvent(machine, new Halt());
            }
        }