Skip to content

Commit

Permalink
(#23) test (xfail) for implicit changes bug
Browse files Browse the repository at this point in the history
  • Loading branch information
snake-biscuits committed May 8, 2023
1 parent 9fc3041 commit b60e1fa
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/test_lumps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import collections
import io

from bsp_tool import lumps
from bsp_tool.branches import base

import pytest

Expand All @@ -25,3 +29,27 @@ def test_lazy(self):
assert lumps._remap_slice(slice(0, 50, None), 50) == slice(0, 50, 1)
assert lumps._remap_slice(slice(0, 50, 1), 50) == slice(0, 50, 1)
assert lumps._remap_slice(slice(0, 69, 1), 50) == slice(0, 50, 1)


class TestDecompress:
# TODO: test decompression on a repacked ValveBsp
...


LumpHeader_basic = collections.namedtuple("basic", ["offset", "length"])


class LumpClass_basic(base.MappedArray):
_mapping = [*"xyz"]
_format = "3H"


class TestBspLump:
@pytest.mark.xfail(reason="not yet implemented")
def test_implicit_change(self):
header = LumpHeader_basic(offset=0, length=6)
stream = io.BytesIO(b"\x01\x00\x02\x00\x03\x00")
lump = lumps.BspLump.from_header(stream, header, LumpClass_basic)
assert lump[0].x == 1
lump[0].x += 1
assert lump[0].x == 2

0 comments on commit b60e1fa

Please sign in to comment.