Exemplo n.º 1
0
 public void testGPSimConstruction()
 {
     gpSim uut = null;
     try
     {
         uut = new gpSim(_knownGoodHexFile, _handerForm.Object);
     }
     finally
     {
         if (uut != null)
             uut.Dispose();
     }
 }
Exemplo n.º 2
0
        public void testGPSimRunsToPortBreakpoint()
        {
            gpSim uut = null;
            try
            {
                uut = new gpSim(_knownGoodHexFile, _handerForm.Object);

                // Add a breakpoint on PORTB.
                breakpoint brk = new breakpoint(){callback = this.handler,location = "portb"};
                uut.addWriteBreakpoint(brk);

                // and then run the node.
                uut.run();

                 // Now wait for our handler to be called.
                int timeout = 1000;
                while(!handlerCalled)
                {
                    Thread.Sleep(1000);
                    timeout--;

                    if (timeout == 0)
                        throw new TimeoutException();
                }
                _handerForm.Verify(i => i.BeginInvoke(It.IsAny<gpSim.breakpointHandler>(), It.Is<object[]>(x => x == new object[] { uut, brk })), Times.Once());

                // OK, the handler was called. Ace. Ensure that it was set to the
                // correct value.
                Assert.AreEqual(0x01, portState & 0x01);
            }
            finally
            {
                if (uut != null)
                    uut.Dispose();
            }
        }
Exemplo n.º 3
0
        public void testGPSimLoadsToCorrectType()
        {
            gpSim uut = null;
            try
            {
                uut = new gpSim(_knownGoodHexFile, _handerForm.Object);

                Assert.AreEqual(_knownGoodPICType, uut.chipType);
            }
            finally
            {
                if (uut != null)
                    uut.Dispose();
            }
        }