! Tests the XBC version of NOOP
!
! author:  J. Czechowski IV / Neon Ngo / Conrad Clark
!
startmacro

  ! NXM-3816 TODO: nxm.xbc.host.noop throws a symbol lookup error
  !                when compiled with the GFC compilers
  invoke fortranCompiler nxm.sys.lib.Build.getFortranCompiler()
  if fortranCompiler eqs "gfc" then
    warn "^reg.main.name: Skipping because using GFC compilers"
  else
    call test_noop "feq/h/k/d/s" "nxm.sys.dat.test1000_eeei.prm" ! type 1000 file (little endian)
    call test_noop "feq/h/k/d/s" "nxm.sys.dat.test1000_ieee.prm" ! type 1000 file (big endian)
    call test_noop "feq/h/k/d/s" "nxm.sys.dat.apenny.prm"        ! type 2000 file (little endian)
    call test_noop "feq/h/k/d/s" "nxm.sys.dat.test3000_eeei.prm" ! type 3000 file (little endian)
    call test_noop "feq/h/k/d/s" "nxm.sys.dat.test3000_ieee.prm" ! type 3000 file (big endian)
    call test_noop "feq/h/k/d/s" "nxm.sys.dat.test6000.prm"      ! type 6000 file (little endian)
    call test_noop "feq/h/k/d/s" "nxm.sys.test.testplat1001_tc_tcprec_ok.cdif" ! type 1001 Platinum file (little endian)
    call test_noop "feq/h/k/d/s" "nxm.sys.test.testplat4plat2blue_cov.cdif"    ! type 1000 Platinum file (little endian)
  endif

! Problem with re-entrant code...
!  pipe init
!    nxm.xbc.host.noop apenny.prm _mypipe
!    noop _mypipe penny{aux=ram}
!  pipe run
!  assert/text="^reg.main.name: file to a pipe" penny{aux=ram} feq ram:penny
!
!  pipe init
!    noop apenny.prm _mypipe
!    nxm.xbc.host.noop _mypipe penny{aux=ram}
!  pipe run
!  assert/text="^reg.main.name: pipe to a file" penny{aux=ram} feq ram:penny

endmacro

procedure test_noop s:test s:srcfile
  fname/parse ^srcfile,,basename,
  set dstfile "ram:my^basename"
  nxm.xbc.host.noop ^srcfile ^dstfile
  assert/text="^reg.main.name: ^srcfile ^test ^dstfile" ^srcfile ^test ^dstfile
return
