File: test_obj_hasmethod.pro

package info (click to toggle)
gnudatalanguage 0.9.9-13
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 17,892 kB
  • sloc: cpp: 167,389; ansic: 9,358; sh: 566; python: 472; makefile: 252; f90: 28
file content (39 lines) | stat: -rw-r--r-- 1,048 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
;
;
; provide a test-case object besides LIST
;
PRO ObjTEST::Cleanup, prm1, prm2, prm3
  COMPILE_OPT IDL2 ,HIDDEN
  ; Call our superclass Cleanup method
  ; self->IDL_Object::Cleanup ; (there is no GDL_OBJECT::cleanup)

nprm = N_PARAMS()
print,' ObjTEST::Cleanup, #params=',nprm
;
END

PRO ObjTEST__define
  COMPILE_OPT IDL2 ,HIDDEN
  void = {ObjTEST, $
  inherits IDL_Object, $ ; superclass
  center: [0d, 0d], $ ; two-element array
  radius: 0d}  ; scalar value
END
;
pro test_obj_hasmethod
llist = list(fltarr(4),"hello",2.)
mlist = list(!gdl, "goodbye",findgen(3,4))
;if ~(obj_valid(llist) and obj_valid(mlist)) then exit, status=1

hasadd = obj_hasmethod(mlist,'ADD')
; MOVE is not yet a list method.
hasmove= obj_hasmethod(mlist,'MOVE')
;	print,' test_obj_hasmethod 1'
hasremove= obj_hasmethod(mlist,'REMOVE')
hastoarray=obj_hasmethod(mlist,'TOARRAY')
;	print,' test_obj_hasmethod 2'
hasall= hasadd + hasmove + hasremove + hastoarray
if(hasall ge 3) then print,'SUCCESS' else exit, status=1

return
end