Skip to content

Commit

Permalink
Add support for flash files (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
kg583 authored Dec 28, 2023
1 parent dd3f021 commit 033fca2
Show file tree
Hide file tree
Showing 17 changed files with 712 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "tivars/tokenizer/tokens"]
path = tivars/tokenizer/tokens
[submodule "tivars/tokens"]
path = tivars/tokens
url = https://github.com/TI-Toolkit/tokens
Binary file not shown.
Binary file added tests/data/var/smartpad.8xk
Binary file not shown.
19 changes: 18 additions & 1 deletion tests/tivars.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from tivars.models import *
from tivars.types import *
from tivars import TIHeader, TIVar
from tivars import TIHeader, TIVar, TIFlashHeader


class ModelTests(unittest.TestCase):
Expand Down Expand Up @@ -568,3 +568,20 @@ def test_group(self):

self.assertEqual(TIGroup.group(ungrouped).ungroup(), ungrouped)
self.assertEqual(TIGroup(ungrouped).ungroup(), ungrouped)


class FlashTests(unittest.TestCase):
def test_app(self):
test_app = TIFlashHeader()

with open("tests/data/var/smartpad.8xk", 'rb') as file:
test_app.load_from_file(file)
file.seek(0)

self.assertEqual(test_app.bytes(), file.read())

self.assertEqual(type(test_app), TIApp)

def test_os(self):
test_os = TIFlashHeader.open("tests/data/var/TI-84_Plus_CE-Python-OS-5.8.0.0022.8eu")
self.assertEqual(type(test_os), TIOS)
3 changes: 2 additions & 1 deletion tivars/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"""


from .flash import *
from .tokenizer import *
from .types import *
from .models import *
from .var import *


__all__ = list(set(tokenizer.__all__) | set(types.__all__) | set(models.__all__) | set(var.__all__))
__all__ = list({*flash.__all__, *tokenizer.__all__, *types.__all__, *models.__all__, *var.__all__})
Loading

0 comments on commit 033fca2

Please sign in to comment.