Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ValekoZ committed Jun 2, 2024
1 parent 1194c4c commit 7681e0f
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/commands/arch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""
Arch commands test module
"""

from tests.base import RemoteGefUnitTestGeneric
from tests.utils import (
ARCH,
ERROR_INACTIVE_SESSION_MESSAGE,
debug_target,
findlines,
is_32b,
is_64b,
)


class ArchCommand(RemoteGefUnitTestGeneric):
"""Generic class for command testing, that defines all helpers"""

def setUp(self) -> None:
return super().setUp()

def test_cmd_arch_get(self):
gdb = self._gdb

res = gdb.execute("arch get", to_string=True)
self.assertIn(" Architecture(Generic, None, LITTLE_ENDIAN)", res)
self.assertIn(" This default architecture", res)

def test_cmd_arch_set(self):
gdb = self._gdb

res = gdb.execute("arch get", to_string=True)
self.assertIn(" Architecture(Generic, None, LITTLE_ENDIAN)", res)
self.assertIn(" This default architecture", res)

gdb.execute("arch set X86")

res = gdb.execute("arch get", to_string=True)
self.assertIn(" Architecture(Generic, None, LITTLE_ENDIAN)", res)
self.assertIn(" The architecture has been set manually", res)

def test_cmd_arch_list(self):
gdb = self._gdb

res = gdb.execute("arch list", to_string=True)
self.assertIn("- GenericArchitecture", res)
self.assertIn("- X86", res)
self.assertIn("- X86_64", res)

0 comments on commit 7681e0f

Please sign in to comment.