import unittest

from nmigen._utils import _ignore_deprecated
from nmigen.compat import *


def _same_slices(a, b):
    return a.value is b.value and a.start == b.start and a.stop == b.stop


class SignalSizeCase(unittest.TestCase):
    def setUp(self):
        self.i = C(0xaa)
        self.j = C(-127)
        with _ignore_deprecated():
            self.s = Signal((13, True))

    def test_len(self):
        self.assertEqual(len(self.s), 13)
        self.assertEqual(len(self.i), 8)
        self.assertEqual(len(self.j), 8)

import unittest

from nmigen._utils import _ignore_deprecated
from nmigen.compat import *


def _same_slices(a, b):
    return a.value is b.value and a.start == b.start and a.stop == b.stop


class SignalSizeCase(unittest.TestCase):
    def setUp(self):
        self.i = C(0xaa)
        self.j = C(-127)
        with _ignore_deprecated():
            self.s = Signal((13, True))

    def test_len(self):
        self.assertEqual(len(self.s), 13)
        self.assertEqual(len(self.i), 8)
        self.assertEqual(len(self.j), 8)
