summaryrefslogtreecommitdiff
path: root/tests/common/itoa.py
blob: a004cbdbd7d6734cc5479f2c9cbbd1b051e9e478 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

from chrysacase import ChrysalideTestCase
from pychrysalide.common import itoa


class TestItoa(ChrysalideTestCase):
    """TestCase for calls to the itoa() implementation."""

    def testItoaCallss(self):
        """Convert some integer values into strings."""

        val = itoa(123, 10)
        self.assertEqual(val, '123')

        val = itoa(-123, 10)
        self.assertEqual(val, '-123')

        val = itoa(0, 10)
        self.assertEqual(val, '0')

        val = itoa(0, 2)
        self.assertEqual(val, '0')

        val = itoa(127, 2)
        self.assertEqual(val, '1111111')

        val = itoa(101, 2)
        self.assertEqual(val, '1100101')