Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions tests/test_madmac.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,29 @@ def test_mac_generator_prepare_start_address_user(self):
def test_mac_generator_prepare_start_address_ValueError(self):
mc = MacGenerator(start="1100YY")
self.assertRaises(ValueError, mc._prepare_start_address)

def test_mac_generator_prepare_stop_address(self):
mc = MacGenerator()
mc._prepare_stop_address()
self.assertIs(int, type(mc.i_stop))

def test_mac_generator_prepare_stop_address_user(self):
mc = MacGenerator(start="000005", stop="000010")
mc._prepare_stop_address()
self.assertEqual(16, mc.i_stop)

def test_mac_generator_prepare_stop_address_ValueError(self):
mc = MacGenerator(stop="-10")
self.assertRaises(ValueError, mc._prepare_stop_address)

def test_mac_generator_prepare_stop_address_user_total(self):
mc = MacGenerator(total="")
self.assertRaises(ValueError, mc._prepare_stop_address)

def test_mac_generator_prepare_stop_address_UnsupportedOperation(self):
mc = MacGenerator(total="X")
self.assertRaises(UnsupportedOperation, mc._prepare_stop_address)

def test_mac_generator_prepare_stop_address_InvalidEndingAddress(self):
mc = MacGenerator(start="000005", stop="00001G")
self.assertRaises(ValueError, mc._prepare_stop_address)