import logging
import pickle
import nose
import gc
import tempfile
import os

import claripy
import angr
from angr import SimState


binaries_base = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries')


def test_state():
    s = SimState(arch='AMD64')
    s.registers.store('sp', 0x7ffffffffff0000)
    nose.tools.assert_equal(s.solver.eval(s.registers.load('sp')), 0x7ffffffffff0000)

    s.stack_push(s.solver.BVV(b"ABCDEFGH"))
    nose.tools.assert_equal(s.solver.eval(s.registers.load('sp')), 0x7fffffffffefff8)
    s.stack_push(s.solver.BVV(b"IJKLMNOP"))
    nose.tools.assert_equal(s.solver.eval(s.registers.load('sp')), 0x7fffffffffefff0)

    a = s.stack_pop()