File: test_plot_ranges.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 (75 lines) | stat: -rw-r--r-- 1,861 bytes parent folder | download | duplicates (2)
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
;
; under GNU GPL v3
; Alain Coulais, 20 june 2017
; 350 years of Paris Observatory today !
;
; This incredible bug was reported by René Gastaud !
; Intermitendly happen since 0.9.5 ... (see on u14.04)
;
pro TEST_PLOT_YRANGES, cumul_errors, negative=negative, $
                       test=test, verbose=verbose, debug=debug
;
nb_errors=0
;
message='pb with !Y.crange for case : '
sign='**POSITIVE**'
;
x=FINDGEN(10)
;
extended_ranges=[-0.001,0.,0.001]
expected=[[-2.,10],[0,10],[0,10]]
;
if KEYWORD_SET(negative) then begin   
   x=-x
   expected=[[-10.,0],[-10,0],[-10,2]]
   sign='**NEGATIVE**'
endif
;
for ii=0, N_ELEMENTS(extended_ranges)-1 do begin
   ;;
   plot, x+extended_ranges[ii]
   ;;
   if KEYWORD_SET(verbose) then begin
      print, 'Min :', MIN( x+extended_ranges[ii])
      print, 'Max :', MAX( x+extended_ranges[ii])
      print, 'expected !y.crange : ', expected[*,ii]
      print, 'effective !y.crange : ', !y.crange
   endif
   ;;
   if ~ARRAY_EQUAL(expected[*,ii], !y.crange) then begin
      ERRORS_ADD, nb_errors, STRCOMPRESS(message+sign+' : '+string(ii))
   endif
endfor
;
txt='TEST_PLOT_YRANGES '
BANNER_FOR_TESTSUITE, txt+sign, nb_errors, pref=txt, /short, verb=verbose
;
ERRORS_CUMUL, cumul_errors, nb_errors
;
if KEYWORD_SET(test) then STOP
;
end
;
; -------------------------------------------
;
pro TEST_PLOT_RANGES, help=help, verbose=verbose, no_exit=no_exit, test=test
;
if KEYWORD_SET(help) then begin
   print, 'pro TEST_PLOT_RANGES, help=help, verbose=verbose, $'
   print, '                      no_exit=no_exit, test=test'
   return
endif
;
TEST_PLOT_YRANGES, nb_errors
TEST_PLOT_YRANGES, nb_errors, /negative
;
; ----------------- final message ----------
;
BANNER_FOR_TESTSUITE, 'TEST_PLOT_RANGES', nb_errors
;
if (nb_errors GT 0) AND ~KEYWORD_SET(no_exit) then EXIT, status=1
;
if KEYWORD_SET(test) then STOP
;
end