# Path: mozz/test.py
# def run_test_module(name, file):
# 	outputfile = mozz.util.python_path_basename(file) + '.out'
# 
# 	m = sys.modules[name]
# 	ldr = unittest.loader.defaultTestLoader
# 	tests = ldr.loadTestsFromModule(m)
# 
# 	with open(outputfile, 'w') as f:
# 		duper = mozz.util.IOWriteDuplicator(
# 			sys.stderr, f
# 		)
# 		unittest.runner.TextTestRunner(
# 			verbosity = 2,
# 			stream = duper
# 		).run(tests)
# 
# def abs_path(base_file, rel_path):
# 	return os.path.join(
# 		os.path.dirname(os.path.abspath(base_file)),
# 		rel_path
# 	)


import unittest
import mozz
import mozz.sig
from mozz.test import run_test_module, abs_path
			pc = host.inferior().reg_pc()
			mozz.debug("entry point is 0x%x" % (pc))
			self.assertEqual(pc, 0x400410)
			self.assertEqual(state[0], offset() + 2)
			state[0] += 1

		@s.on_exit()
		def on_exit(host):
			mozz.debug("cb exit")
			self.assertEqual(state[0], offset() + 3)
			state[0] += 1

		@s.on_inferior_post()
		def on_inf_post(host):
			mozz.debug("cb inf post")
			self.assertEqual(state[0], offset() + 4)
			state[0] += 1

		@s.on_finish()
		def finish(host):
			mozz.debug("cb finish")
			self.assertEqual(s.iteration(), 2)
			self.assertEqual(state[0], offset() + 5)
			state[0] += 1

		mozz.run_session(s)
		mozz.debug("session over")
		self.assertEqual(s.iteration(), 2)
		self.assertEqual(state[0], offset() + 6)


# Path: mozz/test.py
# def run_test_module(name, file):
# 	outputfile = mozz.util.python_path_basename(file) + '.out'
# 
# 	m = sys.modules[name]
# 	ldr = unittest.loader.defaultTestLoader
# 	tests = ldr.loadTestsFromModule(m)
# 
# 	with open(outputfile, 'w') as f:
# 		duper = mozz.util.IOWriteDuplicator(
# 			sys.stderr, f
# 		)
# 		unittest.runner.TextTestRunner(
# 			verbosity = 2,
# 			stream = duper
# 		).run(tests)
# 
# def abs_path(base_file, rel_path):
# 	return os.path.join(
# 		os.path.dirname(os.path.abspath(base_file)),
# 		rel_path
# 	)


# Path: test/run_exit_test.py
import unittest
import mozz
import mozz.sig
from mozz.test import run_test_module, abs_path

			pc = host.inferior().reg_pc()
			mozz.debug("entry point is 0x%x" % (pc))
			self.assertEqual(pc, 0x400410)
			self.assertEqual(state[0], offset() + 2)
			state[0] += 1

		@s.on_exit()
		def on_exit(host):
			mozz.debug("cb exit")
			self.assertEqual(state[0], offset() + 3)
			state[0] += 1

		@s.on_inferior_post()
		def on_inf_post(host):
			mozz.debug("cb inf post")
			self.assertEqual(state[0], offset() + 4)
			state[0] += 1

		@s.on_finish()
		def finish(host):
			mozz.debug("cb finish")
			self.assertEqual(s.iteration(), 2)
			self.assertEqual(state[0], offset() + 5)
			state[0] += 1

		mozz.run_session(s)
		mozz.debug("session over")
		self.assertEqual(s.iteration(), 2)
		self.assertEqual(state[0], offset() + 6)


run_test_module(__name__, __file__)