1
0
mirror of synced 2024-12-18 09:15:54 +01:00
bemaniutils/bemani/tests/test_RemoteUser.py

22 lines
781 B
Python

# vim: set fileencoding=utf-8
import unittest
from bemani.data.remoteuser import RemoteUser
from bemani.data.types import UserID
class TestRemoteUser(unittest.TestCase):
def test_id_mangling(self) -> None:
card = "E0040100DEADBEEF"
userid = RemoteUser.card_to_userid(card)
self.assertTrue(userid > (2**32 - 1))
newcard = RemoteUser.userid_to_card(userid)
self.assertEqual(card, newcard)
def test_is_remote(self) -> None:
self.assertTrue(RemoteUser.is_remote(UserID(2**64 - 1)))
self.assertTrue(RemoteUser.is_remote(UserID(2**32)))
self.assertFalse(RemoteUser.is_remote(UserID(2**32 - 1)))
self.assertFalse(RemoteUser.is_remote(UserID(0)))
self.assertFalse(RemoteUser.is_remote(UserID(1)))