# Path: voidwalker/framework/platform/cpu.py
# class CpuFactory(object):
#     __metaclass__ = abc.ABCMeta
# 
#     def create_cpu(self, architecture):
#         assert architecture in _cpu_map
#         return _cpu_map.get(architecture,
#                             None)(self)
# 
#     @abc.abstractmethod
#     def create_register(self, cpu, register):
#         raise NotImplementedError
# 
# Path: voidwalker/framework/target/inferior.py
# class InferiorRepository(object):
#     def __init__(self):
#         self._inferiors = {}
# 
#     def add_inferior(self, inferior):
#         self._inferiors[inferior.id()] = inferior
# 
#     def has_inferior(self, inferior_id):
#         return inferior_id in self._inferiors
# 
#     def get_inferior(self, inferior_id):
#         assert self.has_inferior(inferior_id), ('inferior %r not found' %
#                                                 inferior_id)
#         return self._inferiors[inferior_id]
# 
# Path: voidwalker/backends/test/platform.py
# class TestPlatformFactory(PlatformFactory, object):
#     def __init__(self):
#         self._registers = None
#         self.reset()
# 
#     def reset(self):
#         self._registers = {}
# 
#     def create_context(self, config, inferior, thread):
#         class TestContext(Context):
#             def __init__(self):
#                 sp = inferior.cpu().stack_pointer()
#                 super(TestContext, self).__init__(sp)
# 
#                 for group, register_dict in inferior.cpu().registers():
#                     register_dict = dict((x.name(), create_static_register(x))
#                                          for x in register_dict.itervalues())
#                     self._registers[group] = register_dict
# 
#         return TestContext()
# 
# Path: voidwalker/backends/test/target.py
# class TestThreadFactory(ThreadFactory):
#     def create_thread(self, inferior, thread_id):
#         thread = TestThread(inferior, thread_id)
#         inferior.add_thread(thread)
#         return thread
# 
# Path: voidwalker/backends/test/target.py
# class TestInferiorFactory(InferiorFactory):
#     def __init__(self):
#         super(TestInferiorFactory, self).__init__(TestCpuFactory())
# 
#     def create_inferior(self, cpu, inferior_id):
#         return TestInferior(cpu, inferior_id)
# 
#     def create_thread(self, inferior, thread_id):
#         thread = TestThread(inferior.id(), thread_id)
#         inferior.add_thread(thread)
#         return thread
# 
# Path: voidwalker/backends/test/platform.py
# class TestCpuFactory(CpuFactory):
#     def __init__(self):
#         self._registers = None
# 
#     def create_cpu(self, architecture):
#         return TestCpu(self)
# 
#     def create_register(self, cpu, register):
#         class TestRegister(type(register), object):
#             def __init__(self, name):
#                 super(TestRegister, self).__init__(name)
#                 self._size = 8
#                 self._value = 0
# 
#             def size(self):
#                 return self._size
# 
#             def value(self):
#                 return self._value
# 
#         return TestRegister(register.name())
# 
# Path: voidwalker/backends/test/target.py
# class TestInferiorFactory(InferiorFactory):
#     def __init__(self):
#         super(TestInferiorFactory, self).__init__(TestCpuFactory())
# 
#     def create_inferior(self, cpu, inferior_id):
#         return TestInferior(cpu, inferior_id)
# 
#     def create_thread(self, inferior, thread_id):
#         thread = TestThread(inferior.id(), thread_id)
#         inferior.add_thread(thread)
#         return thread
# 
# Path: voidwalker/backends/test/target.py
# class TestThreadFactory(ThreadFactory):
#     def create_thread(self, inferior, thread_id):
#         thread = TestThread(inferior, thread_id)
#         inferior.add_thread(thread)
#         return thread


from unittest import TestCase
from voidwalker.framework.platform import CpuFactory
from voidwalker.framework.target import InferiorRepository
from voidwalker.backends.test import TestPlatformFactory
from voidwalker.backends.test import TestThreadFactory
from voidwalker.backends.test import TestInferiorFactory
from voidwalker.backends.test.platform import TestCpuFactory
from voidwalker.backends.test.target import TestInferiorFactory
from voidwalker.backends.test.target import TestThreadFactory
# Copyright (C) 2012 David Holm <dholmster@gmail.com>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.






class InferiorTest(TestCase):
    def setUp(self):
        cpu_factory = TestCpuFactory()
        self._cpu = cpu_factory.create_cpu(None)

    def test_inferior_repository(self):
        inferior_repository = InferiorRepository()
        self.assertFalse(inferior_repository.has_inferior(0))

    def test_inferior(self):

# Path: voidwalker/framework/platform/cpu.py
# class CpuFactory(object):
#     __metaclass__ = abc.ABCMeta
# 
#     def create_cpu(self, architecture):
#         assert architecture in _cpu_map
#         return _cpu_map.get(architecture,
#                             None)(self)
# 
#     @abc.abstractmethod
#     def create_register(self, cpu, register):
#         raise NotImplementedError
# 
# Path: voidwalker/framework/target/inferior.py
# class InferiorRepository(object):
#     def __init__(self):
#         self._inferiors = {}
# 
#     def add_inferior(self, inferior):
#         self._inferiors[inferior.id()] = inferior
# 
#     def has_inferior(self, inferior_id):
#         return inferior_id in self._inferiors
# 
#     def get_inferior(self, inferior_id):
#         assert self.has_inferior(inferior_id), ('inferior %r not found' %
#                                                 inferior_id)
#         return self._inferiors[inferior_id]
# 
# Path: voidwalker/backends/test/platform.py
# class TestPlatformFactory(PlatformFactory, object):
#     def __init__(self):
#         self._registers = None
#         self.reset()
# 
#     def reset(self):
#         self._registers = {}
# 
#     def create_context(self, config, inferior, thread):
#         class TestContext(Context):
#             def __init__(self):
#                 sp = inferior.cpu().stack_pointer()
#                 super(TestContext, self).__init__(sp)
# 
#                 for group, register_dict in inferior.cpu().registers():
#                     register_dict = dict((x.name(), create_static_register(x))
#                                          for x in register_dict.itervalues())
#                     self._registers[group] = register_dict
# 
#         return TestContext()
# 
# Path: voidwalker/backends/test/target.py
# class TestThreadFactory(ThreadFactory):
#     def create_thread(self, inferior, thread_id):
#         thread = TestThread(inferior, thread_id)
#         inferior.add_thread(thread)
#         return thread
# 
# Path: voidwalker/backends/test/target.py
# class TestInferiorFactory(InferiorFactory):
#     def __init__(self):
#         super(TestInferiorFactory, self).__init__(TestCpuFactory())
# 
#     def create_inferior(self, cpu, inferior_id):
#         return TestInferior(cpu, inferior_id)
# 
#     def create_thread(self, inferior, thread_id):
#         thread = TestThread(inferior.id(), thread_id)
#         inferior.add_thread(thread)
#         return thread
# 
# Path: voidwalker/backends/test/platform.py
# class TestCpuFactory(CpuFactory):
#     def __init__(self):
#         self._registers = None
# 
#     def create_cpu(self, architecture):
#         return TestCpu(self)
# 
#     def create_register(self, cpu, register):
#         class TestRegister(type(register), object):
#             def __init__(self, name):
#                 super(TestRegister, self).__init__(name)
#                 self._size = 8
#                 self._value = 0
# 
#             def size(self):
#                 return self._size
# 
#             def value(self):
#                 return self._value
# 
#         return TestRegister(register.name())
# 
# Path: voidwalker/backends/test/target.py
# class TestInferiorFactory(InferiorFactory):
#     def __init__(self):
#         super(TestInferiorFactory, self).__init__(TestCpuFactory())
# 
#     def create_inferior(self, cpu, inferior_id):
#         return TestInferior(cpu, inferior_id)
# 
#     def create_thread(self, inferior, thread_id):
#         thread = TestThread(inferior.id(), thread_id)
#         inferior.add_thread(thread)
#         return thread
# 
# Path: voidwalker/backends/test/target.py
# class TestThreadFactory(ThreadFactory):
#     def create_thread(self, inferior, thread_id):
#         thread = TestThread(inferior, thread_id)
#         inferior.add_thread(thread)
#         return thread


# Path: tests/target.py
from unittest import TestCase
from voidwalker.framework.platform import CpuFactory
from voidwalker.framework.target import InferiorRepository
from voidwalker.backends.test import TestPlatformFactory
from voidwalker.backends.test import TestThreadFactory
from voidwalker.backends.test import TestInferiorFactory
from voidwalker.backends.test.platform import TestCpuFactory
from voidwalker.backends.test.target import TestInferiorFactory
from voidwalker.backends.test.target import TestThreadFactory

# Copyright (C) 2012 David Holm <dholmster@gmail.com>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.






class InferiorTest(TestCase):
    def setUp(self):
        cpu_factory = TestCpuFactory()
        self._cpu = cpu_factory.create_cpu(None)

    def test_inferior_repository(self):
        inferior_repository = InferiorRepository()
        self.assertFalse(inferior_repository.has_inferior(0))

    def test_inferior(self):

        inferior_factory = TestInferiorFactory()