예제 #1
0
    def test_from_action(self):
        actions = [
            'test',
            'sale',
            'refund',
            'balance',
            'upload',
            'settlement',
        ]
        bitmaps = [
            '6016',
            '7f96',
            '7f96',
            '7e16',
            '7dde',
            '6036',
        ]

        for i, action in enumerate(actions):
            result = Bitmap.from_action(action)
            self.assertEqual(result, bitmaps[i])
예제 #2
0
    def test_hexlify(self):
        bits = [
            [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0],
            [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0],
            [0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0],
            [0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0],
            [0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0],
            [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0],
        ]

        results = [
            '6016',
            '7f96',
            '7f96',
            '7e16',
            '7dd6',
            '6036',
        ]

        for i, bitset in enumerate(bits):
            result = Bitmap.hexlify(bitset)
            self.assertEqual(result, results[i])
예제 #3
0
    def test_unhexlify(self):
        bitmaps = [
            '6016',
            '7f96',
            '7f96',
            '7e16',
            '7dd6',
            '6036',
        ]

        bits = [
            '0110000000010110',
            '0111111110010110',
            '0111111110010110',
            '0111111000010110',
            '0111110111010110',
            '0110000000110110',
        ]

        for i, bitmap in enumerate(bitmaps):
            result = Bitmap.unhexlify(bitmap)
            self.assertEqual(result, bits[i])
예제 #4
0
from src.bitmap import Bitmap

bitmap = Bitmap()

cmd = input('Entre command \n ')
# while not os.path.isfile(cmd):
#   cmd = input('command ? => ')

cmd_list = cmd.split()
cmd_name = cmd_list[0]
bitmap.set_options(cmd_name, cmd_list[1:])
예제 #5
0
 def test_settlement_rq(self):
     result = Bitmap.settlement_rq()
     self.assertEqual(result, '6036')
예제 #6
0
 def test_upload_rq(self):
     result = Bitmap.upload_rq()
     self.assertEqual(result, '7dde')
예제 #7
0
 def test_balance_rq(self):
     result = Bitmap.balance_rq()
     self.assertEqual(result, '7e16')
예제 #8
0
 def test_refund_rq(self):
     result = Bitmap.refund_rq()
     self.assertEqual(result, '7f96')
예제 #9
0
 def test_sale_rq(self):
     result = Bitmap.sale_rq()
     self.assertEqual(result, '7f96')
예제 #10
0
 def test_test_rq(self):
     result = Bitmap.test_rq()
     self.assertEqual(result, '6016')