netwatch.py/netaddr-0.7.10/netaddr/tests/2.x/strategy/eui48.txt

94 lines
1.5 KiB
Plaintext

=IEEE EUI-48 Strategy Module=
Copyright (c) 2008-2012, David P. D. Moss. All rights reserved.
{{{
>>> from netaddr.strategy.eui48 import *
}}}
==Basic Smoke Tests==
{{{
>>> b = '00000000-00001111-00011111-00010010-11100111-00110011'
>>> i = 64945841971
>>> t = (0x0, 0x0f, 0x1f, 0x12, 0xe7, 0x33)
>>> s = '00-0F-1F-12-E7-33'
>>> p = '\x00\x0f\x1f\x12\xe73'
>>> bits_to_int(b) == 64945841971
True
>>> int_to_bits(i) == b
True
>>> int_to_str(i)
'00-0F-1F-12-E7-33'
>>> int_to_words(i)
(0, 15, 31, 18, 231, 51)
>>> int_to_packed(i)
'\x00\x0f\x1f\x12\xe73'
>>> str_to_int(s) == 64945841971
True
>>> words_to_int(t) == 64945841971
True
>>> words_to_int(list(t)) == 64945841971
True
>>> packed_to_int(p) == 64945841971
True
}}}
==Smoke Tests With Alternate Dialects==
{{{
>>> b = '00000000:00001111:00011111:00010010:11100111:00110011'
>>> i = 64945841971
>>> t = (0x0, 0x0f, 0x1f, 0x12, 0xe7, 0x33)
>>> s = '0:f:1f:12:e7:33'
>>> p = '\x00\x0f\x1f\x12\xe73'
>>> bits_to_int(b, mac_unix) == 64945841971
True
>>> int_to_bits(i, mac_unix) == b
True
>>> int_to_str(i, mac_unix)
'0:f:1f:12:e7:33'
>>> int_to_str(i, mac_cisco)
'000f.1f12.e733'
>>> int_to_str(i, mac_unix)
'0:f:1f:12:e7:33'
>>> int_to_words(i, mac_unix)
(0, 15, 31, 18, 231, 51)
>>> int_to_packed(i)
'\x00\x0f\x1f\x12\xe73'
>>> str_to_int(s) == 64945841971
True
>>> words_to_int(t, mac_unix) == 64945841971
True
>>> words_to_int(list(t), mac_unix) == 64945841971
True
>>> packed_to_int(p) == 64945841971
True
}}}