Skip to content

Commit

Permalink
Add system pointer size test
Browse files Browse the repository at this point in the history
  • Loading branch information
Schamper committed Aug 29, 2023
1 parent 62e7d6f commit 6571a78
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_pointer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from unittest.mock import patch
from dissect import cstruct

from dissect.cstruct.types.pointer import PointerInstance
Expand Down Expand Up @@ -145,3 +146,16 @@ def test_pointer_arithmetic():

inst |= 8
assert inst._addr == 12


def test_pointer_sys_size():
with patch("sys.maxsize", 2**64):
c = cstruct.cstruct()
assert c.pointer is c.uint64

with patch("sys.maxsize", 2**32):
c = cstruct.cstruct()
assert c.pointer is c.uint32

c = cstruct.cstruct(pointer="uint16")
assert c.pointer is c.uint16

0 comments on commit 6571a78

Please sign in to comment.