NAME=objc hello-objc not encrypted
FILE=bins/mach0/hello-objc
CMDS=<<EOF
ic
icf Person
icm Person
EOF
EXPECT=<<EOF
address     min         max         name   super    
----------------------------------------------------
0x100001180 0x100000da0 0x100000e20 Person NSObject
address     index class  flags name                   type                
--------------------------------------------------------------------------
0x00000000  0     Person       isa                    struct objc_class *
0x100001178 1     Person       Person::(ivar)name     *
0x00000000  2     Person       Person::(property)name 
address     index class  flags name     
----------------------------------------
0x100000da0 0     Person       sayHello
0x100000df0 1     Person       name
0x100000e20 2     Person       setName:
EOF
RUN

NAME=objc generics-objc
FILE=bins/mach0/generics-objc
CMDS=<<EOF
ic
icf MyCustomClass
icm MyCustomClass
EOF
EXPECT=<<EOF
address     min         max         name          super    
-----------------------------------------------------------
0x100001120 0x100000e70 0x100000e70 MyCustomClass NSObject
address index class flags name type 
------------------------------------
address     index class         flags name                    
--------------------------------------------------------------
0x100000e70 0     MyCustomClass       doSomethingWithGeneric:
EOF
RUN

NAME=objc method flags (ic ViewController)
FILE=bins/mach0/TestMethods
CMDS=<<EOF
icf ViewController
icm ViewController
EOF
EXPECT=<<EOF
address index class flags name type 
------------------------------------
address     index class          flags name                    
---------------------------------------------------------------
0x10000676c 0     ViewController       viewDidLoad
0x1000067d0 1     ViewController       didReceiveMemoryWarning
0x1000067bc 2     ViewController c     thisIsAClassMethod
0x100006820 3     ViewController c     andAnotherOne
EOF
RUN

NAME=objc method flags (icj)
FILE=bins/mach0/TestMethods
CMDS=icj~{[0].methods[2].flags[0]}
EXPECT=<<EOF
class
EOF
RUN

NAME=objc method flags (ic*)
FILE=bins/mach0/TestMethods
CMDS=ic*~thisIsAClassMethod
EXPECT=<<EOF
"f method.class.ViewController.thisIsAClassMethod @ 0x1000067bc"
EOF
RUN

NAME=objc categories (mangled)
FILE=bins/mach0/Alamofire-stripped
CMDS=<<EOF
icf 'Alamofire.SessionDelegate(Alamofire)'
icm 'Alamofire.SessionDelegate(Alamofire)'
EOF
EXPECT=<<EOF
address index class flags name type 
------------------------------------
address    index class                                flags name                                              
--------------------------------------------------------------------------------------------------------------
0x00048e14 0     Alamofire.SessionDelegate(Alamofire)       URLSession:didBecomeInvalidWithError:
0x0004990c 1     Alamofire.SessionDelegate(Alamofire)       URLSession:didReceiveChallenge:completionHandler:
0x000499c8 2     Alamofire.SessionDelegate(Alamofire)       URLSessionDidFinishEventsForBackgroundURLSession:
EOF
RUN

NAME=infinite aalo
FILE=bins/mach0/r2_hang_test
CMDS=aalo
EXPECT=
RUN

NAME=objc categories (swift)
FILE=bins/mach0/TestSwiftObjc
CMDS=ic
EXPECT=<<EOF
address     min         max         name                                  super    
-----------------------------------------------------------------------------------
0x100003078 0x100001ad0 0x100001ad0 TestSwiftObjc.ThisIsASwiftClass(TEST) 
0x1000031e8 0x100001d80 0x100001d80 TestSwiftObjc.ThisIsASwiftClass       NSObject
EOF
RUN

NAME=aalo hello-objc selrefs
FILE=bins/mach0/hello-objc
CMDS=<<EOF
e analysis.jmp.cref=true
aalo
axl~?
axl~selref
EOF
EXPECT=<<EOF
92
              section.0.__TEXT.__text+20 0x100000db4 ->      DATA -> 0x100001150 section.14.__DATA.__objc_selrefs
                                 main+15 0x100000e5f ->      DATA -> 0x100001158 section.14.__DATA.__objc_selrefs+8
                                 main+45 0x100000e7d ->      DATA -> 0x100001160 section.14.__DATA.__objc_selrefs+16
                                 main+64 0x100000e90 ->      DATA -> 0x100001168 section.14.__DATA.__objc_selrefs+24
                                 main+86 0x100000ea6 ->      DATA -> 0x100001158 section.14.__DATA.__objc_selrefs+8
                                main+116 0x100000ec4 ->      DATA -> 0x100001160 section.14.__DATA.__objc_selrefs+16
                                main+135 0x100000ed7 ->      DATA -> 0x100001168 section.14.__DATA.__objc_selrefs+24
EOF
RUN

NAME=aalo hello-objc methods references
FILE=bins/mach0/hello-objc
CMDS=aalo;axl~method
EXPECT=<<EOF
              section.0.__TEXT.__text+20 0x100000db4 ->      CODE -> 0x100000df0 method.Person.name
                                 main+45 0x100000e7d ->      CODE -> 0x100000e20 method.Person.setName:
                                main+116 0x100000ec4 ->      CODE -> 0x100000e20 method.Person.setName:
EOF
RUN
