import unittest
from util import eval_code

class test_opcodes_unary(unittest.TestCase):
    def test_unary_opcodes(self):
        self.failUnless(eval_code("a=23;a=+a;a","23\n",title='test_opcodes_unary: 1'))
        self.failUnless(eval_code("a=23;a=-a;a","-23\n",title='test_opcodes_unary: 2'))
        self.failUnless(eval_code("a=23;a=not a;a","False\n",title='test_opcodes_unary: 3'))
        self.failUnless(eval_code("a=0;a=not a;a","True\n",title='test_opcodes_unary: 4'))
        self.failUnless(eval_code("a=23;a=`a`;a","'23'\n",title='test_opcodes_unary: 5'))
        self.failUnless(eval_code("a=23;a=~a;a","-24\n",title='test_opcodes_unary: 6'))
        #self.failUnless(eval_code("a=[1,2,3];a=iter(a);a","4\n"))


if __name__ == "__main__":
    unittest.main()

