Beispiel #1
0
        public void EightBitAdderSetsOverflowHigh()
        {
            //Given
            const int inputA = 128;
            const int inputB = 128;

            var adder = new Adder8Bit();

            //When
            adder.InputA.Set(inputA);
            adder.InputB.Set(inputB);

            //Then
            adder.Overflow.State.Should().BeTrue();
        }
Beispiel #2
0
        public void EightBitAdderSumsCorrectly()
        {
            //Given
            const int inputA      = 23;
            const int inputB      = 56;
            const int expectedSum = inputA + inputB;

            var adder = new Adder8Bit();

            //When
            adder.InputA.Set(inputA);
            adder.InputB.Set(inputB);

            //Then
            var actualSum = adder.Sum.Read();

            actualSum.Should().Be(expectedSum);
            adder.Overflow.State.Should().BeFalse();
        }