Skip to content

Commit

Permalink
initial import of basic tests for ROT() (issue 1909)
Browse files Browse the repository at this point in the history
  • Loading branch information
acoulais committed Nov 28, 2024
1 parent b304859 commit 81d99b9
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions testsuite/LIST
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ test_qromo.pro
test_readf_with_crlf.pro
test_reads.pro
test_rebin.pro
test_rot.pro
test_routine_dir.pro
test_routine_filepath.pro
test_routine_name.pro
Expand Down
80 changes: 80 additions & 0 deletions testsuite/test_rot.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
;
; Alain C., ADASS, 13 Nov 2024
;
; Assuming ROTATE() works fine !
;
; Bug
;
; ------------------------------
;
pro TEST_ROT_ROTATE, angle, cumul_errors, offset=offset, help=help
;
if (N_PARAMS() LT 1) then begin
MESSAGE, /cont, 'Missing ANGLE as input'
return
end
errors=0
;
direction=-1
if (angle EQ 0) then direction=0
if (angle EQ 90) then direction=3
if (angle EQ 180) then direction=2
if (angle EQ 270) then direction=1
if (direction LT 0) then begin
MESSAGE, /cont, 'inadequate ANGLE, please check'
return
endif
;
if ~KEYWORD_SET(offset) then offset=0
;
GIVE_LIST_NUMERIC, list_numeric_types, list_numeric_names
;
for jj=0, N_ELEMENTS(list_numeric_types)-1 do begin
for ii=3,7 do begin
input=INDGEN(ii,ii+offset, type=list_numeric_types[jj])
res=ROT(input,angle)-ROTATE(input,direction)
if (TOTAL(ABS(res)) GT 1e-7) then begin
txt=' & type '+ list_numeric_names[jj]
ERRORS_ADD, errors, 'sym with size '+STRING(ii)+txt
endif
endfor
endfor
;
; --------------
;
BANNER_FOR_TESTSUITE, "TEST_ROT_ROTATE", errors, /short, verb=verbose
ERRORS_CUMUL, cumul_errors, errors
if KEYWORD_SET(test) then STOP
;
end
;
; ------------------------------
;
pro test_rot
;
cumul_errors=0
;
angle=90.
print, 'Testing for angle =', angle
TEST_ROT_ROTATE, angle, cumul_errors
;
angle=180.
print, 'Testing for angle =', angle
TEST_ROT_ROTATE, angle, cumul_errors
TEST_ROT_ROTATE, angle, cumul_errors, offset=1
TEST_ROT_ROTATE, angle, cumul_errors, offset=2
TEST_ROT_ROTATE, angle, cumul_errors, offset=3
;
angle=270.
print, 'Testing for angle =', angle
TEST_ROT_ROTATE, angle, cumul_errors
;
; ----------------- final message ----------
;
BANNER_FOR_TESTSUITE, 'TEST_ROT', cumul_errors
;
if (cumul_errors GT 0) AND ~KEYWORD_SET(no_exit) then EXIT, status=1
;
if KEYWORD_SET(test) then STOP
;
end

0 comments on commit 81d99b9

Please sign in to comment.