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
|
program testrate
implicit none
include 'SAE_PAR'
include 'AST_PAR'
include 'AST_ERR'
integer status, ch, sf, sf2
character buff*50
status = sai__ok
call err_begin( status )
call ast_begin( status )
call ast_tunec( "hrdel", AST__TUNULLC, buff, status )
if( buff .ne. '%-%^50+%s70+h%+' .and. status .eq. sai__ok ) then
call stopit( 0, status )
endif
call ast_tunec( "hrdel", "junk", buff, status )
call ast_tunec( "hrdel", AST__TUNULLC, buff, status )
if( buff .ne. 'junk' .and. status .eq. sai__ok ) then
call stopit( -1, status )
endif
sf = ast_skyframe( ' ', status )
ch = ast_channel( AST_NULL, AST_NULL, 'SinkFile=./fred.txt',
: status )
if( ast_write( ch, sf, status ) .ne. 1 ) then
call stopit( 1, status )
end if
call ast_set( ch, 'SourceFile=./fred.txt', status )
if( status .eq. SAI__OK ) then
sf2 = ast_read( ch, status )
if( status .eq. AST__RDERR ) then
call err_annul( status )
else
call stopit( 7, status )
end if
end if
call ast_clear( ch, 'SinkFile', status )
call ast_set( ch, 'SourceFile=./fred.txt', status )
sf2 = ast_read( ch, status )
if( sf2 .eq. AST__NULL ) call stopit( 2, status )
if( .not. ast_equal( sf, sf2, status ) ) then
call stopit( 3, status )
end if
call ast_set( ch, 'SinkFile=./fred2.txt', status )
if( ast_write( ch, sf, status ) .ne. 1 ) then
call stopit( 4, status )
end if
call ast_clear( ch, 'SinkFile', status )
call ast_set( ch, 'SourceFile=./fred2.txt', status )
sf2 = ast_read( ch, status )
if( sf2 .eq. AST__NULL ) call stopit( 5, status )
if( .not. ast_equal( sf, sf2, status ) ) then
call stopit( 6, status )
end if
call ast_end( status )
call err_end( status )
if( status .eq. sai__ok ) then
write(*,*) 'All Channel tests passed'
else
write(*,*) 'Channel tests failed'
end if
end
subroutine stopit( i, status )
implicit none
include 'SAE_PAR'
integer i, status
if( status .eq. sai__ok ) then
write( *,* ) 'Error ',i
status = sai__error
end if
end
|