Skip to content

Commit ecc321b

Browse files
committed
Fix size test on 32bit architectures
1 parent 3af7f39 commit ecc321b

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

changelog.txt

+12
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,15 @@
151151
### Fix
152152

153153
- Fix padding tests on 32bit architectures
154+
155+
### 3.3
156+
157+
2022-10-24
158+
159+
### Added
160+
161+
- Add 32bit test environment
162+
163+
### Fix
164+
165+
- Fix padding tests on 32bit architectures

cstruct/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
__author__ = 'Andrea Bonomi <[email protected]>'
2626
__license__ = 'MIT'
27-
__version__ = '3.2'
27+
__version__ = '3.3'
2828
__date__ = '15 August 2013'
2929

3030
import struct

tests/test_define.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@
2525
#
2626
# *****************************************************************************
2727

28+
import sys
2829
import pytest
2930
import cstruct
3031
from cstruct import define, undef, sizeof, typedef
3132
from cstruct.exceptions import ParserError
3233

34+
IS_64BITS = sys.maxsize > 2**32
35+
3336

3437
class Position(cstruct.CStruct):
3538
__byte_order__ = cstruct.LITTLE_ENDIAN
@@ -45,7 +48,10 @@ class Position(cstruct.CStruct):
4548
def test_sizeof():
4649
assert sizeof('int') == 4
4750
define('INIT_THREAD_SIZE', 2048 * sizeof('long'))
48-
assert cstruct.DEFINES['INIT_THREAD_SIZE'] == 16384
51+
if IS_64BITS:
52+
assert cstruct.DEFINES['INIT_THREAD_SIZE'] == 16384
53+
else:
54+
assert cstruct.DEFINES['INIT_THREAD_SIZE'] == 8192
4955
assert sizeof('struct Position') == 3
5056
assert sizeof('struct Position') == len(Position)
5157
assert sizeof(Position) == 3

0 commit comments

Comments
 (0)