# -*- coding: utf-8 -*-
"""
UnitTest for Millipede
"""

import unittest
import millipede


class TestMillipedeSize(unittest.TestCase):
    "Test size parameter on millipede function"

    def test_negative(self):
        "Test with negative integer value"
        self.assertEqual(
            millipede.millipede(-1),
            "    ╚⊙ ⊙╝\n"
        )

    def test_positive(self):
        "Test with positive integer value"
        self.assertEqual(
            millipede.millipede(1),
            """    ╚⊙ ⊙╝\n"""
            """  ╚═(███)═╝\n"""
        )

    def test_zero(self):
        "Test with 0"
        self.assertEqual(
            millipede.millipede(0),
            "    ╚⊙ ⊙╝\n"
        )

    def test_padding(self):
        "Test padding on sufficient size"
        self.assertEqual(
            millipede.millipede(10),
            """    ╚⊙ ⊙╝\n"""
            """  ╚═(███)═╝\n"""
            """ ╚═(███)═╝\n"""
            """╚═(███)═╝\n"""
            """ ╚═(███)═╝\n"""
            """  ╚═(███)═╝\n"""
            """   ╚═(███)═╝\n"""
            """    ╚═(███)═╝\n"""
            """    ╚═(███)═╝\n"""
            """   ╚═(███)═╝\n"""
            """  ╚═(███)═╝\n"""
        )


class TestMillipedePosition(unittest.TestCase):
    "Test position parameter on millipede function"

    def test_initial(self):
        "Test initial position"
        self.assertEqual(
            millipede.millipede(0),
            "    ╚⊙ ⊙╝\n"
        )

    def test_zero(self):
        "Test position zero"
        self.assertEqual(
            millipede.millipede(0, position=0),
            "    ╚⊙ ⊙╝\n"
        )

    def test_negative(self):
        "Test negative position"
        self.assertEqual(
            millipede.millipede(0, position=-42),
            "   ╚⊙ ⊙╝\n"
        )

    def test_positive(self):
        "Test positive position"
        self.assertEqual(
            millipede.millipede(0, position=42),
            "      ╚⊙ ⊙╝\n"
        )

    def test_body(self):
        "Test that the body is doing fine as well"
        self.assertEqual(
            millipede.millipede(10, position=42),
            """      ╚⊙ ⊙╝\n"""
            """    ╚═(███)═╝\n"""
            """    ╚═(███)═╝\n"""
            """   ╚═(███)═╝\n"""
            """  ╚═(███)═╝\n"""
            """ ╚═(███)═╝\n"""
            """╚═(███)═╝\n"""
            """ ╚═(███)═╝\n"""
            """  ╚═(███)═╝\n"""
            """   ╚═(███)═╝\n"""
            """    ╚═(███)═╝\n"""
        )


class TestMillipedeComment(unittest.TestCase):
    "Test comment parameter on millipede function"

    def test_empty(self):
        "Test with empty comment"
        self.assertEqual(
            millipede.millipede(0, comment=""),
            "    ╚⊙ ⊙╝\n"
        )

    def test_coucou(self):
        "Test with comment `coucou'"
        self.assertEqual(
            millipede.millipede(0, comment="coucou"),
            "coucou\n\n    ╚⊙ ⊙╝\n"
        )


class TestMillipedeReverse(unittest.TestCase):
    "Test reverse parameter on millipede function"

    def test_reverse(self):
        "Test with reverse enabled"
        self.assertEqual(
            millipede.millipede(1, reverse=True),
            """  ╔═(███)═╗\n"""
            """    ╔⊙ ⊙╗\n"""
        )

    def test_reverse_comment(self):
        "Test a comment with reverse enabled"
        self.assertEqual(
            millipede.millipede(1, comment="coucou", reverse=True),
            """  ╔═(███)═╗\n"""
            """    ╔⊙ ⊙╗\n\n"""
            """coucou\n"""
        )

@@ -3529,24 +3529,588 @@
 %22%22coucou%5Cn%22%22%22%0A        )%0A
+%0A%0Aclass TestMillipedeOpposite(unittest.TestCase):%0A    %22Test opposite parameter on millipede function%22%0A%0A    def test_opposite(self):%0A        %22Test with opposite enabled%22%0A        self.assertEqual(%0A            millipede.millipede(1, opposite=True),%0A            %22%22%22     %E2%95%9A%E2%8A%99 %E2%8A%99%E2%95%9D%5Cn%22%22%22%0A            %22%22%22   %E2%95%9A%E2%95%90(%E2%96%88%E2%96%88%E2%96%88)%E2%95%90%E2%95%9D%5Cn%22%22%22%0A        )%0A%0A    def test_opposite(self):%0A        %22Test with opposite and reverse enabled%22%0A        self.assertEqual(%0A            millipede.millipede(1, opposite=True, reverse=True),%0A            %22%22%22   %E2%95%94%E2%95%90(%E2%96%88%E2%96%88%E2%96%88)%E2%95%90%E2%95%97%5Cn%22%22%22%0A            %22%22%22     %E2%95%94%E2%8A%99 %E2%8A%99%E2%95%97%5Cn%22%22%22%0A        )%0A

Add tests for the opposite option