#coding: utf-8

import unittest

import re
import sys

import os.path as p
sys.path.insert(0, p.join(p.dirname(p.abspath(__file__)), '..', 'src'))

import ope_manip as om

body_if_branch = """
       0: iload_1       
       1: ifle          12
       4: getstatic     #2                  // Field java/lang/System.out:Ljava/io/PrintStream;
       7: ldc           #3                  // String x > 0
       9: invokevirtual #4                  // Method java/io/PrintStream.println:(Ljava/lang/String;)V
      12: return        
"""[1:-1].split('\n')

body_for_loop = """
       0: iconst_0      
       1: istore_1      
       2: iload_1       
       3: bipush        10
       5: if_icmpge     34
       8: getstatic     #2                  // Field java/lang/System.out:Ljava/io/PrintStream;
      11: ldc           #5                  // String i = %d
      13: iconst_1      
      14: anewarray     #6                  // class java/lang/Object
      17: dup           
      18: iconst_0      
      19: iload_1       
      20: invokestatic  #7                  // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
      23: aastore       
      24: invokevirtual #8                  // Method java/io/PrintStream.printf:(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/PrintStream;
      27: pop           
      28: iinc          1, 1
      31: goto          2
      34: return        
"""[1:-1].split('\n')

body_table_switch = """
       0: iload_1       
       1: tableswitch   { // 1 to 2
                     1: 24
                     2: 35
               default: 46
          }
      24: getstatic     #16                 // Field java/lang/System.out:Ljava/io/PrintStream;
      27: ldc           #22                 // String v = 1