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
|
program test_packjt_legacy72
use packjt, only: packmsg, unpackmsg
implicit none
integer :: ntests
ntests=0
call expect_control_suffix_falls_back(ntests)
call expect_type2_suffix_round_trip(ntests)
call expect_rr73_is_encoded_as_grid(ntests)
write(*,1000) ntests
1000 format('Legacy 72-bit codec tests passed: ',i0)
contains
subroutine expect_control_suffix_falls_back(ntests)
integer, intent(inout) :: ntests
character(len=22) :: decoded,message
integer :: itype,symbols(12)
message=' '
message(1:1)='/'
message(2:2)=achar(1)
call packmsg(message,symbols,itype)
call unpackmsg(symbols,decoded)
if(itype.ne.6) then
write(*,1010) itype
1010 format('Control suffix returned type ',i0,' instead of free text')
error stop 1
endif
if(any(symbols.lt.0) .or. any(symbols.gt.63)) then
write(*,1020)
1020 format('Control suffix produced an out-of-range symbol')
error stop 1
endif
if(trim(decoded).ne.'/') then
write(*,1030) trim(decoded)
1030 format('Control suffix decoded as "',a,'" instead of "/"')
error stop 1
endif
ntests=ntests+1
end subroutine expect_control_suffix_falls_back
subroutine expect_type2_suffix_round_trip(ntests)
integer, intent(inout) :: ntests
character(len=*), parameter :: expected='CQ KA1ABC/VE6 -22'
character(len=22) :: decoded,message
integer :: itype,symbols(12)
message=expected
call packmsg(message,symbols,itype)
call unpackmsg(symbols,decoded)
if(itype.ne.5) then
write(*,1040) itype
1040 format('Type 2 suffix returned type ',i0,' instead of 5')
error stop 1
endif
if(any(symbols.lt.0) .or. any(symbols.gt.63)) then
write(*,1050)
1050 format('Type 2 suffix produced an out-of-range symbol')
error stop 1
endif
if(trim(decoded).ne.expected) then
write(*,1060) trim(decoded),expected
1060 format('Type 2 suffix decoded as "',a,'" instead of "',a,'"')
error stop 1
endif
ntests=ntests+1
end subroutine expect_type2_suffix_round_trip
subroutine expect_rr73_is_encoded_as_grid(ntests)
integer, intent(inout) :: ntests
character(len=*), parameter :: expected='K1ABC W9XYZ RR73'
character(len=22) :: decoded,message
integer :: itype,symbols(12)
message=expected
call packmsg(message,symbols,itype)
call unpackmsg(symbols,decoded)
if(itype.ne.1) then
write(*,1070) itype
1070 format('RR73 returned type ',i0,' instead of a standard message')
error stop 1
endif
if(any(symbols.lt.0) .or. any(symbols.gt.63)) then
write(*,1080)
1080 format('RR73 produced an out-of-range symbol')
error stop 1
endif
if(trim(decoded).ne.expected) then
write(*,1090) trim(decoded),expected
1090 format('RR73 decoded as "',a,'" instead of "',a,'"')
error stop 1
endif
ntests=ntests+1
end subroutine expect_rr73_is_encoded_as_grid
end program test_packjt_legacy72
|