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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
|
;
; Alain Coulais
;
; Distributed version 2013/10/24
; Under GNU GPL V2 or later
;
; Purpose: testing various format issues, mostly collected in the bug
; report thread at http://sourceforge.net
;
; no exhaustive list
;
; http://sourceforge.net/p/gnudatalanguage/bugs/110/
;
; --------------------------------------------------------
;
pro TEST_BUG_3244840, verbose=verbose, errors=errors, test=test
;
MESSAGE, /continue, 'running TEST_BUG_3244840'
;
if N_ELEMENTS(errors) EQ 0 then errors=0
;
; creating a temporary file
;
OPENW, u, 'test_bug_3244840.tmp', /get_lun, /delete
PRINTF, u, ''
PRINTF, u, 0., format="(f6.2)"
POINT_LUN, u, 0
;
line = ''
READF, u, line
READF, u, line
FREE_LUN, u
;
if (line NE ' 0.00') then begin
errors++
MESSAGE, /continue, 'Failure in TEST_BUG_3244840'
if KEYWORD_SET(verbose) then begin
print, 'Expected: >> 0.00<<'
print, 'result: >>'+line+'<<'
endif
endif else begin
MESSAGE, /continue, 'passing with success TEST_BUG_3244840'
endelse
;
if KEYWORD_SET(test) then STOP
;
end
;
; --------------------------------------------------------
pro WARNING_OLD_IDL_VERSION
;
line='****=============================================****'
if (LONG(STRMID(!VERSION.RELEASE,0,1)) LT 7) then begin
print, line
print, 'You are using an old IDL version, format changed between'
print, 'major versions 6 and 7, we test following >=7 results'
print, line
endif
end
; --------------------------------------------------------
;
pro TEST_BUG_110, verbose=verbose, errors=errors, test=test
;
MESSAGE, /continue, 'running TEST_BUG_110'
;
if N_ELEMENTS(errors) EQ 0 then errors=0
;
internal_err=0
;
a=1
;
OPENW, u, 'test_bug_110.tmp', /get_lun, /delete
;
PRINTF, u, FORMAT='(I08)', 300
PRINTF, u, FORMAT='(I8.8)', 300
PRINTF, u, STRING(9, FORMAT='(i03)') ;; format inside STRING()
PRINTF, u, a, FORMAT="('<',i0,'>')"
;
POINT_LUN, u, 0
line1=''
READF, u, line1
line2=''
READF, u, line2
line3=''
READF, u, line3
line4=''
READF, u, line4
;
if (line1 NE '00000300') then begin
internal_err++
MESSAGE, /continue, 'Failure 1 in TEST_BUG_110'
DEFSYSV, '!gdl', exists=is_it_gdl
if (~is_it_gdl) then WARNING_OLD_IDL_VERSION
if KEYWORD_SET(verbose) then begin
print, 'Expected: >>00003000<<'
print, 'result: >>'+line1+'<<'
endif
endif
;
if (line2 NE '00000300') then begin
internal_err++
MESSAGE, /continue, 'Failure 2 in TEST_BUG_110'
if KEYWORD_SET(verbose) then begin
print, 'Expected: >>00003000<<'
print, 'result: '+line2
endif
endif
;
if (line3 NE '009') then begin
internal_err++
MESSAGE, /continue, 'Failure 3 in TEST_BUG_110'
DEFSYSV, '!gdl', exists=is_it_gdl
if (~is_it_gdl) then WARNING_OLD_IDL_VERSION
if KEYWORD_SET(verbose) then begin
print, 'Expected: >>009<<'
print, 'result: >>'+line3+'<<'
endif
endif
;
if (line4 NE '<1>') then begin
internal_err++
MESSAGE, /continue, 'Failure 4 in TEST_BUG_110'
if KEYWORD_SET(verbose) then begin
print, 'Expected: <1>'
print, 'result: '+line4
endif
endif
;
if (internal_err EQ 0) then begin
MESSAGE, /continue, 'passing with success TEST_BUG_110'
endif
;
errors=errors+internal_err
;
if KEYWORD_SET(test) then STOP
;
end
;
; --------------------------------------------------------
;
pro TEST_FORMAT, verbose=verbose, help=help, no_exit=no_exit, test=test
;
if KEYWORD_SET(help) then begin
txt='verbose=verbose, help=help, no_exit=no_exit, test=test'
print, 'pro TEST_FORMAT, '+txt
return
endif
;
errors=0
;
TEST_BUG_3244840, verbose=verbose, errors=errors
;
TEST_BUG_110, verbose=verbose, errors=errors
;
if ~KEYWORD_SET(no_exit) then begin
if (errors GT 0) then EXIT, status=1
endif
if KEYWORD_SET(test) then STOP
;
end
|