示例#1
0
    def test_invoke(self):
        lines = compile_from_file('invoke')
        find_ops = [
            'load', 'invoke', 'get', 'invoke', 'load', 'invoke', 'get',
            'invoke'
        ]

        self.assertTrue(check_op_sequence(lines, find_ops))
示例#2
0
    def test_events(self):
        lines = compile_from_file('event')
        find_ops = [
            'mk_ref.udf', 'call.native', 'mk_ref.udf', 'call.native',
            'call.native'
        ]

        self.assertTrue(check_op_sequence(lines, find_ops))
示例#3
0
    def test_foreach(self):
        lines = compile_from_file('for_each')
        find_ops = [
            'call.native', 'call.native', 'call.native', 'unload',
            'call.native', 'call.native', 'call.native', 'unload'
        ]

        self.assertTrue(check_op_sequence(lines, find_ops))
示例#4
0
    def test_string_interpolation(self):
        lines = compile_from_file('str_inter')
        find_ops = [
            'concat', 'concat', 'concat', 'emit', 'concat', 'concat', 'concat',
            'emit', 'concat', 'emit'
        ]

        self.assertTrue(check_op_sequence(lines, find_ops))
示例#5
0
    def test_elseif(self):
        lines = compile_from_file('elseif')
        find_ops = ['jmple', 'jmplt', 'jmple', 'jmple']

        self.assertTrue(check_op_sequence(lines, find_ops))
示例#6
0
    def test_arrays(self):
        lines = compile_from_file('arrays')
        find_ops = ['emit']

        self.assertTrue(check_op_sequence(lines, find_ops))
示例#7
0
    def test_elems_assignment(self):
        lines = compile_from_file('struct_assignment')
        find_ops = ['set', 'get', 'get', 'get']

        self.assertTrue(check_op_sequence(lines, find_ops))
示例#8
0
    def test_inc_dec(self):
        lines = compile_from_file('inc_dec')
        find_ops = ['load', 'load', 'add', 'load', 'load', 'add']

        self.assertTrue(check_op_sequence(lines, find_ops))
示例#9
0
    def test_object(self):
        lines = compile_from_file('obj')
        find_ops = ['bind_refs', 'invoke']

        self.assertTrue(check_op_sequence(lines, find_ops))
示例#10
0
    def test_builder_pattern(self):
        lines = compile_from_file('obj_builder')
        find_ops = ['bind_refs', 'invoke', 'invoke', 'invoke', 'emit']

        self.assertTrue(check_op_sequence(lines, find_ops))
示例#11
0
    def test_import_native(self):
        lines = compile_from_file('import_native')
        find_ops = ['call.native', 'call.native', 'call.native']

        self.assertTrue(check_op_sequence(lines, find_ops))
示例#12
0
    def test_import_script(self):
        lines = compile_from_file('import_script')
        find_ops = ['get', 'set', 'call.udf', 'call.udf', 'call.udf']

        self.assertTrue(check_op_sequence(lines, find_ops))
示例#13
0
    def test_shared_vars(self):
        lines = compile_from_file('use_shared')
        find_ops = ['.shared', 'Name', 'load', 'emit', 'load', 'emit']

        self.assertTrue(check_op_sequence(lines, find_ops))