예제 #1
0
    def test_opn_nest(self):
        bf = BrainFxxk()
        # for test, insert data
        bf.src = u'[->[->>+<<]>>[-<+<+>>]<<<]<'
        bf.ptr = 0

        # buf[ptr] = 0
        bf.buf[bf.ptr] = 0
        # out
        bf.cur = 0
        bf.opn()
        tools.eq_(25, bf.cur)
        # in1
        bf.cur = 3
        bf.opn()
        tools.eq_(10, bf.cur)
        # in2
        bf.cur = 13
        bf.opn()
        tools.eq_(21, bf.cur)

        # ptr = 1
        bf.buf[bf.ptr] = 1
        # out
        bf.cur = 0
        bf.opn()
        tools.eq_(0, bf.cur)
        # in1
        bf.cur = 3
        bf.opn()
        tools.eq_(3, bf.cur)
        # in2
        bf.cur = 13
        bf.opn()
        tools.eq_(13, bf.cur)
예제 #2
0
 def test_opn(self):
     bf = BrainFxxk()
     # for test, insert data
     bf.src = u'[>>>>++]>>'        
     bf.opn()
     tools.eq_(7, bf.cur)