예제 #1
0
        public void DynamicAdderSetsOverflowHigh()
        {
            //Given
            const int inputA = 128;
            const int inputB = 128;

            var adder = new DynamicAdder(8);

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

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

            var adder = new DynamicAdder(8);

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

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

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