Exemplo n.º 1
0
 def test_options_S_and_E(self):
     start = 32768
     end = 49152
     skool2sft.main(('-S', str(start), '-E', str(end), 'test.skool'))
     self.assertTrue(mock_sft_writer.write_called)
     self.assertEqual(mock_sft_writer.min_address, start)
     self.assertEqual(mock_sft_writer.max_address, end)
Exemplo n.º 2
0
 def test_options_S_and_E(self):
     start = 32768
     end = 49152
     skool2sft.main(('-S', str(start), '-E', str(end), 'test.skool'))
     self.assertTrue(mock_sft_writer.write_called)
     self.assertEqual(mock_sft_writer.min_address, start)
     self.assertEqual(mock_sft_writer.max_address, end)
Exemplo n.º 3
0
 def test_default_option_values(self):
     self.mock(skool2sft, 'SftWriter', MockSftWriter)
     skoolfile = 'test.skool'
     skool2sft.main((skoolfile,))
     infile, write_hex, preserve_base = mock_sft_writer.args
     self.assertEqual(infile, skoolfile)
     self.assertFalse(write_hex)
     self.assertFalse(preserve_base)
     self.assertTrue(mock_sft_writer.write_called)
Exemplo n.º 4
0
 def test_option_b(self):
     skoolfile = 'test.skool'
     for option in ('-b', '--preserve-base'):
         skool2sft.main((option, skoolfile))
         infile, write_hex, preserve_base = mock_sft_writer.args
         self.assertEqual(infile, skoolfile)
         self.assertEqual(write_hex, 0)
         self.assertTrue(preserve_base)
         self.assertTrue(mock_sft_writer.write_called)
Exemplo n.º 5
0
 def test_option_l(self):
     skoolfile = 'test.skool'
     for option in ('-l', '--hex-lower'):
         skool2sft.main((option, skoolfile))
         infile, write_hex, preserve_base = mock_sft_writer.args
         self.assertEqual(infile, skoolfile)
         self.assertEqual(write_hex, -1)
         self.assertFalse(preserve_base)
         self.assertTrue(mock_sft_writer.write_called)
Exemplo n.º 6
0
 def test_option_l(self):
     skoolfile = 'test.skool'
     for option in ('-l', '--hex-lower'):
         skool2sft.main((option, skoolfile))
         infile, write_hex, preserve_base = mock_sft_writer.args
         self.assertEqual(infile, skoolfile)
         self.assertEqual(write_hex, -1)
         self.assertFalse(preserve_base)
         self.assertTrue(mock_sft_writer.write_called)
Exemplo n.º 7
0
 def test_option_b(self):
     skoolfile = 'test.skool'
     for option in ('-b', '--preserve-base'):
         skool2sft.main((option, skoolfile))
         infile, write_hex, preserve_base = mock_sft_writer.args
         self.assertEqual(infile, skoolfile)
         self.assertEqual(write_hex, 0)
         self.assertTrue(preserve_base)
         self.assertTrue(mock_sft_writer.write_called)
Exemplo n.º 8
0
 def test_default_option_values(self):
     skoolfile = 'test.skool'
     skool2sft.main((skoolfile,))
     infile, write_hex, preserve_base = mock_sft_writer.args
     self.assertEqual(infile, skoolfile)
     self.assertEqual(write_hex, 0)
     self.assertFalse(preserve_base)
     self.assertTrue(mock_sft_writer.write_called)
     self.assertEqual(mock_sft_writer.min_address, 0)
     self.assertEqual(mock_sft_writer.max_address, 65536)
Exemplo n.º 9
0
 def test_default_option_values(self):
     skoolfile = 'test.skool'
     skool2sft.main((skoolfile, ))
     infile, write_hex, preserve_base = mock_sft_writer.args
     self.assertEqual(infile, skoolfile)
     self.assertEqual(write_hex, 0)
     self.assertFalse(preserve_base)
     self.assertTrue(mock_sft_writer.write_called)
     self.assertEqual(mock_sft_writer.min_address, 0)
     self.assertEqual(mock_sft_writer.max_address, 65536)
Exemplo n.º 10
0
 def test_option_h(self):
     self.mock(skool2sft, 'SftWriter', MockSftWriter)
     skoolfile = 'test.skool'
     for option in ('-h', '--hex'):
         skool2sft.main((option, skoolfile))
         infile, write_hex, preserve_base = mock_sft_writer.args
         self.assertEqual(infile, skoolfile)
         self.assertTrue(write_hex)
         self.assertFalse(preserve_base)
         self.assertTrue(mock_sft_writer.write_called)
Exemplo n.º 11
0
#!/usr/bin/env python3

# Copyright 2011-2013, 2017 Richard Dymond ([email protected])
#
# This file is part of SkoolKit.
#
# SkoolKit is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# SkoolKit is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# SkoolKit. If not, see <http://www.gnu.org/licenses/>.

import sys

from skoolkit import skool2sft, error, SkoolKitError

try:
    skool2sft.main(sys.argv[1:])
except SkoolKitError as e:
    error(e.args[0])
Exemplo n.º 12
0
 def test_option_S(self):
     for option, start in (('-S', 40000), ('--start', 50000)):
         skool2sft.main((option, str(start), 'test.skool'))
         self.assertTrue(mock_sft_writer.write_called)
         self.assertEqual(mock_sft_writer.min_address, start)
         self.assertEqual(mock_sft_writer.max_address, 65536)
Exemplo n.º 13
0
 def test_option_E(self):
     for option, end in (('-E', 30000), ('--end', 40000)):
         skool2sft.main((option, str(end), 'test.skool'))
         self.assertTrue(mock_sft_writer.write_called)
         self.assertEqual(mock_sft_writer.min_address, 0)
         self.assertEqual(mock_sft_writer.max_address, end)
Exemplo n.º 14
0
 def test_option_E_with_hex_address(self):
     for option, end in (('-E', '0x7a0f'), ('--end', '0xA00D')):
         skool2sft.main((option, str(end), 'test.skool'))
         self.assertTrue(mock_sft_writer.write_called)
         self.assertEqual(mock_sft_writer.min_address, 0)
         self.assertEqual(mock_sft_writer.max_address, int(end[2:], 16))
Exemplo n.º 15
0
 def test_option_E(self):
     for option, end in (('-E', 30000), ('--end', 40000)):
         skool2sft.main((option, str(end), 'test.skool'))
         self.assertTrue(mock_sft_writer.write_called)
         self.assertEqual(mock_sft_writer.min_address, 0)
         self.assertEqual(mock_sft_writer.max_address, end)
Exemplo n.º 16
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright 2011-2013 Richard Dymond ([email protected])
#
# This file is part of SkoolKit.
#
# SkoolKit is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# SkoolKit is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# SkoolKit. If not, see <http://www.gnu.org/licenses/>.

import sys

from skoolkit import skool2sft, error, SkoolKitError

try:
    skool2sft.main(sys.argv[1:])
except SkoolKitError as e:
    error(e.args[0])
Exemplo n.º 17
0
 def test_option_E_with_hex_address(self):
     for option, end in (('-E', '0x7a0f'), ('--end', '0xA00D')):
         skool2sft.main((option, str(end), 'test.skool'))
         self.assertTrue(mock_sft_writer.write_called)
         self.assertEqual(mock_sft_writer.min_address, 0)
         self.assertEqual(mock_sft_writer.max_address, int(end[2:], 16))
Exemplo n.º 18
0
 def test_option_S_with_hex_address(self):
     for option, start in (('-S', '0x7b10'), ('--start', '0xBF01')):
         skool2sft.main((option, str(start), 'test.skool'))
         self.assertTrue(mock_sft_writer.write_called)
         self.assertEqual(mock_sft_writer.min_address, int(start[2:], 16))
         self.assertEqual(mock_sft_writer.max_address, 65536)
Exemplo n.º 19
0
 def test_option_S(self):
     for option, start in (('-S', 40000), ('--start', 50000)):
         skool2sft.main((option, str(start), 'test.skool'))
         self.assertTrue(mock_sft_writer.write_called)
         self.assertEqual(mock_sft_writer.min_address, start)
         self.assertEqual(mock_sft_writer.max_address, 65536)
Exemplo n.º 20
0
 def test_option_S_with_hex_address(self):
     for option, start in (('-S', '0x7b10'), ('--start', '0xBF01')):
         skool2sft.main((option, str(start), 'test.skool'))
         self.assertTrue(mock_sft_writer.write_called)
         self.assertEqual(mock_sft_writer.min_address, int(start[2:], 16))
         self.assertEqual(mock_sft_writer.max_address, 65536)