summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/common/itoa.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/common/itoa.py b/tests/common/itoa.py
new file mode 100644
index 0000000..a004cbd
--- /dev/null
+++ b/tests/common/itoa.py
@@ -0,0 +1,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')