File: test_struct_assign.pro

package info (click to toggle)
gnudatalanguage 1.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,832 kB
  • sloc: cpp: 198,435; ansic: 47,740; sh: 691; python: 474; makefile: 149; xml: 69; f90: 28
file content (31 lines) | stat: -rw-r--r-- 1,215 bytes parent folder | download
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
pro test_struct_assign
  err=0
  a={toto, deux:[0,4], trois:[0.66,68.33,222.16], quatre:'zzzzz'}
  b=CREATE_STRUCT(NAME='HasStructInside', ['un','deux','trois'], [1,5], 2b, a)
  d=b
  c=CREATE_STRUCT(NAME='Other',['un','deux'],3,4)
  struct_assign,c,d
  ; has been changed:
  if total(d.un) ne 3 then err++
  ; d must be zeroed in d.trois:
  if total(d.trois.deux) ne 0 then err++
  if strlen(d.trois.quatre) ne 0 then err++
  ; with noerase, things are different. 
  struct_assign,c,b,/nozero
  if total(b.trois.deux) ne 4 then err++ ; show also that it is "relaxed"
  ; 
  c=CREATE_STRUCT(NAME='HasStruct', ['un','deux','trois'], [1,5], 2b, findgen(32))
	print, "following error is EXPECTED:"
  struct_assign,c,b,/nozero,/verb
  ; issue #2083
   a=replicate({x:{y:1}},3)
   if size(a.x,/n_dim) ne 1 then  err++ 
  ; issue #2105 (both ways)
   x0 = {value:'zzzzz'} & xb={value:['test']} & test=xb & test[0]=x0 & if size(test.value,/n_dim) ne 1 then  err++
   x0 = {value:'zzzzz'} & xb={value:['test']} & test=x0 & test[0]=xb & if size(test.value,/n_dim) ne 0 then  err++
;  print,err
    if err ne 0 then begin
      message, 'test FAILED with '+strtrim(err,2)+' errors', /conti
      exit, status=1
    endif
end