import nose
import angr
import subprocess

import logging
l = logging.getLogger('angr.tests.test_signed_div')

import os
test_location = str(os.path.dirname(os.path.realpath(__file__)))


def run_strtol(threads):
    test_bin = os.path.join(test_location, "../../binaries-private/tests/i386/test_signed_div")
    b = angr.Project(test_bin)

    pg = b.factory.path_group()
    pg.explore()
    out_angr = pg.deadended[0].state.posix.dumps(1)
    proc = subprocess.Popen(test_bin, stdout=subprocess.PIPE)
    stdout_real, _ = proc.communicate()

    nose.tools.assert_equal(out_angr, stdout_real)

def test_strtol():
    yield run_strtol, None
    yield run_strtol, 8

if __name__ == "__main__":
    run_strtol(4)

add a full test for signed_div stuff