コード例 #1
0
ファイル: bitmath_test.py プロジェクト: Avesta-Software/pling
    def test_ones_compliment_wrap(self):
        """Test adding 2 numbers that should wrap around to 1"""
        n1 = int("1111", 2)
        n2 = int("0001", 2)

        result = ones_complement_add(n1, n2, bits=4)

        assert result == int("0001", 2)
コード例 #2
0
ファイル: bitmath_test.py プロジェクト: Avesta-Software/pling
 def test_ones_compliment_easy(self):
     """Test adding 2 numbers where no carrying is needed"""
     assert ones_complement_add(7, 3, bits=16) == 10