コード例 #1
0
ファイル: test_bits.py プロジェクト: NSC-dpayne/PyAsh
 def test_bits_capacity(self):
     b = Bits(8)
     self.assertEqual(b.to_bitstr(), "0" * 63)
     b = Bits(1)
     self.assertEqual(b.to_bitstr(), "0" * 63)
     b = Bits(63)
     self.assertEqual(b.to_bitstr(), "0" * 63)
     b = Bits(64)
     self.assertEqual(b.to_bitstr(), "0" * 126)
コード例 #2
0
ファイル: test_bits.py プロジェクト: kellpossible/PyAsh
	def test_bits_capacity(self):
		b = Bits(8)
		self.assertEqual(b.to_bitstr(), "0"*63)
		b = Bits(1)
		self.assertEqual(b.to_bitstr(), "0"*63)
		b = Bits(63)
		self.assertEqual(b.to_bitstr(), "0"*63)
		b = Bits(64)
		self.assertEqual(b.to_bitstr(), "0"*126)
コード例 #3
0
ファイル: test_bits.py プロジェクト: NSC-dpayne/PyAsh
 def test_bits_clear(self):
     b = Bits(12)
     b.set(0)
     b.set(5)
     b.clear()
     self.assertEqual(b.to_bitstr(), "0" * 63)
     b.set(1)
     b.set(2)
     b.clear(2)
     self.assertEqual(b.to_bitstr(), "01" + "0" * 61)
コード例 #4
0
ファイル: test_bits.py プロジェクト: NSC-dpayne/PyAsh
 def test_bits_set(self):
     b = Bits(64)
     b.set(0)
     self.assertEqual(b.to_bitstr(), "1" + "0" * 125)
     b = Bits(1)
     b.set(62)
     self.assertEqual(b.to_bitstr(), "0" * 62 + "1")
     b = Bits(1)
     b.set(63)
     self.assertEqual(b.to_bitstr(), "0" * 63 + "1" + "0" * 62)
コード例 #5
0
ファイル: test_bits.py プロジェクト: kellpossible/PyAsh
	def test_bits_clear(self):
		b = Bits(12)
		b.set(0)
		b.set(5)
		b.clear()
		self.assertEqual(b.to_bitstr(), "0"*63)
		b.set(1)
		b.set(2)
		b.clear(2)
		self.assertEqual(b.to_bitstr(), "01" + "0"*61)
コード例 #6
0
ファイル: test_bits.py プロジェクト: kellpossible/PyAsh
	def test_bits_set(self):
		b = Bits(64)
		b.set(0)
		self.assertEqual(b.to_bitstr(), "1" + "0"*125)
		b = Bits(1)
		b.set(62)
		self.assertEqual(b.to_bitstr(), "0"*62 + "1")
		b = Bits(1)
		b.set(63)
		self.assertEqual(b.to_bitstr(), "0"*63 + "1" + "0"*62)
コード例 #7
0
ファイル: test_bits.py プロジェクト: NSC-dpayne/PyAsh
    def test_bits_flip(self):
        b = Bits(63)
        b.set(0)
        b.set(2)
        b.flip(2)
        self.assertEqual(b.to_bitstr(), "1" + "0" * 62)

        b = Bits(64)
        b.set(63)
        b.set(65)
        b.flip(63)
        self.assertEqual(b.to_bitstr(), "0" * 63 + "0" * 2 + "1" + "0" * 60)
コード例 #8
0
ファイル: test_bits.py プロジェクト: kellpossible/PyAsh
	def test_bits_flip(self):
		b = Bits(63)
		b.set(0)
		b.set(2)
		b.flip(2)
		self.assertEqual(b.to_bitstr(), "1" + "0"*62)

		b = Bits(64)
		b.set(63)
		b.set(65)
		b.flip(63)
		self.assertEqual(b.to_bitstr(), "0"*63 + "0"*2 + "1" + "0"*60)
コード例 #9
0
ファイル: test_bits.py プロジェクト: NSC-dpayne/PyAsh
 def test_bits_constructor(self):
     b = Bits(127, [0, 1])
     self.assertEqual(b.to_bitstr(), "0" * 63 + "1" + "0" * 62)
コード例 #10
0
ファイル: test_bits.py プロジェクト: NSC-dpayne/PyAsh
 def test_bits_capacity_grow(self):
     b = Bits(1)
     b.set(64)
     self.assertEqual(b.to_bitstr(), "0" * 63 + "01" + "0" * 61)
コード例 #11
0
ファイル: test_bits.py プロジェクト: kellpossible/PyAsh
	def test_bits_constructor(self):
		b = Bits(127, [0,1])
		self.assertEqual(b.to_bitstr(), "0"*63 + "1" + "0"*62)
コード例 #12
0
ファイル: test_bits.py プロジェクト: kellpossible/PyAsh
	def test_bits_capacity_grow(self):
		b = Bits(1)
		b.set(64)
		self.assertEqual(b.to_bitstr(), "0"*63 + "01" + "0"*61)