summaryrefslogtreecommitdiff
path: root/tests/unit/superfox/test_superfox_unpack_unsupported.f90
blob: 5f52c0608e7bf6fd318c97b93164ee1a9a4d150b (plain)
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
module superfox_unsupported_fixture
  use iso_c_binding, only: c_ptr,c_f_pointer,c_int
  use decoder_engine_types, only: superfox_observation
  implicit none
contains
  subroutine observe(context,record)
    type(c_ptr), intent(in) :: context
    type(superfox_observation), intent(in) :: record
    integer(c_int), pointer :: n
    call c_f_pointer(context,n)
    n=n+1
    write(*,*) 'unexpected child kind for unsupported frame:',record%kind
  end subroutine observe
end module superfox_unsupported_fixture

program test_superfox_unpack_unsupported

  use iso_c_binding, only: c_loc,c_int
  use superfox_unsupported_fixture, only: observe
  use packjt77, only: pack77_state
  use sfox_unpack_module, only: sfox_unpack_for_state
  implicit none

  integer*1 xin(0:49), xdec(0:49)
  logical*1 more_cqs, send_msg
  character*120 line
  character*26 free_text
  character*10 ckey
  character*13 foxcall
  character*329 msgbits
  integer notp, pack_error
  integer(c_int), target :: count=0
  type(pack77_state) :: knowledge

  line='K1JT W1AW'
  free_text=' '
  ckey='0000123456'
  more_cqs=.false.
  send_msg=.false.

  call sfox_pack(line,ckey,more_cqs,send_msg,free_text,xin,pack_error)
  if(pack_error.ne.0) error stop 'sfox_pack failed'

  xdec=xin(49:0:-1)
  write(msgbits,1000) xdec(0:46)
1000 format(47b7.7)
  msgbits(327:329)='001'
  read(msgbits,1001) xdec(0:46)
1001 format(47b7)

  notp=0
  foxcall=''
  call sfox_unpack(123456,xdec,0,1500.0,0.0,foxcall,notp)
  call sfox_unpack_for_state(knowledge,observe,c_loc(count),123456,xdec,0,1500.0,0.0,foxcall,notp)
  if(count.ne.0) error stop 'unsupported frame emitted typed children'
  write(*,*) 'unsupported i3=1 ignored'
end program test_superfox_unpack_unsupported