#!/usr/bin/env python3
#
import datetime
import os
import signal
import sys
import unittest


if __name__ == '__main__':
    sys.path.append( os.path.abspath( os.path.join( os.path.dirname(__file__), '..', '..' )))

import palm.cmd.build


class BuildTests(unittest.TestCase):

    def test_cut_string_none(self):
        self.assertEqual(
            palm.cmd.build.cut_string( None, 10 ),
            []
            )
        self.assertEqual(
            palm.cmd.build.cut_string( '0123456789', None ),
            []
            )
        self.assertEqual(
            palm.cmd.build.cut_string( '0123456789', -10 ),
            []
            )

    def test_cut_string_empty(self):
        self.assertEqual(
            palm.cmd.build.cut_string( '', 10 ),
            []
            )

    def test_cut_string_smaller(self):
        self.assertEqual(
            palm.cmd.build.cut_string( '01234', 10 ),
            ['01234']
            )

    def test_cut_string_complete(self):
        self.assertEqual(
            palm.cmd.build.cut_string( '0123456789', 10 ),
            ['0123456789']
            )

    def test_cut_string_greater(self):
        self.assertEqual(
            palm.cmd.build.cut_string( '0123456789012345678901234', 10 ),
            ['0123456789', '0123456789', '01234']
            )


if __name__ == '__main__':
    unittest.main()
