! This tests the primlab5 command.
!
startmacro
  ! Test Blue File --> CSV
  primlab5 nxm.sys.dat.testxy3000.prm temp_testxy.csv{COLUMNNAMES="ABSC|ORD"}

  file open oldFile nxm.sys.dat.testxy3000.prm
  file open newFile temp_testxy.csv{COLUMNNAMES="ABSC|ORD"}
  
  invoke oldRow0 oldFile.getDataTable(0)
  invoke newRow0 newFile.getDataTable(0)
  invoke oldRow5 oldFile.getDataTable(5)
  invoke newRow5 newFile.getDataTable(5)

  assert/text="Blue -> CSV : File size matches"   oldFile.size EQ newFile.size
  assert/text="Blue -> CSV : row 0, ABSC matches" oldRow0.absc EQ newRow0.absc
  assert/text="Blue -> CSV : row 0, ORD  matches" oldRow0.ord  EQ newRow0.ord
  assert/text="Blue -> CSV : row 5, ABSC matches" oldRow5.absc EQ newRow5.absc
  assert/text="Blue -> CSV : row 5, ORD  matches" oldRow5.ord  EQ newRow5.ord

  file close oldFile
  file close newFile

  erase temp_testxy.csv
  
  
  ! Test Blue File --> Blue File
  primlab5 nxm.sys.dat.cities.prm temp_cities.prm{TYPE=3000,FORM=NH,SR=(NAME/2A,POS/VD,ZERO/SL)}

  file open oldFile nxm.sys.dat.cities.prm
  file open newFile temp_cities.prm
  
  invoke oldRow0 oldFile.getDataTable(0)
  invoke newRow0 newFile.getDataTable(0)
  invoke oldRow5 oldFile.getDataTable(5)
  invoke newRow5 newFile.getDataTable(5)

  assert/text="Blue -> Blue: File size matches"   oldFile.size EQ  newFile.size
  assert/text="Blue -> Blue: row 0, NAME matches" oldRow0.name EQS newRow0.name
  assert/text="Blue -> Blue: row 0, POS  matches" oldRow0.pos  EQ  newRow0.pos
  assert/text="Blue -> Blue: row 0, ZERO is 0"    0            EQ  newRow0.zero
  assert/text="Blue -> Blue: row 5, NAME matches" oldRow5.name EQS newRow5.name
  assert/text="Blue -> Blue: row 5, POS  matches" oldRow5.pos  EQ  newRow5.pos
  assert/text="Blue -> Blue: row 5, ZERO is 0"    0            EQ  newRow5.zero

  file close oldFile
  file close newFile

  erase temp_cities.prm
  
  
  
  ! Test CSV File --> Blue File
  primlab5 nxm.sys.dat.airports.csv{COLUMNNAMES="NAME|CODE|LAT|LON",HEADERROWS=1} &
           temp_cities.prm{TYPE=3000,FORM=NH,SR=(NAME/4A,CODE/1A,LAT/SD,LON/SD)}

  file open oldFile nxm.sys.dat.airports.csv{COLUMNNAMES="NAME|CODE|LAT|LON",HEADERROWS=1}
  file open newFile temp_cities.prm
  
  invoke oldRow0 oldFile.getDataTable(0)
  invoke newRow0 newFile.getDataTable(0)
  invoke oldRow5 oldFile.getDataTable(5)
  invoke newRow5 newFile.getDataTable(5)

  assert/text="CSV  -> Blue: File size matches"   oldFile.size EQ  newFile.size
  assert/text="CSV  -> Blue: row 0, NAME matches" oldRow0.name EQS newRow0.name
  assert/text="CSV  -> Blue: row 0, CODE matches" oldRow0.code EQS newRow0.code
  assert/text="CSV  -> Blue: row 0, LAT  matches" oldRow0.lat  EQT newRow0.lat
  assert/text="CSV  -> Blue: row 0, LON  matches" oldRow0.lon  EQT newRow0.lon
  assert/text="CSV  -> Blue: row 5, NAME matches" oldRow5.name EQS newRow5.name
  assert/text="CSV  -> Blue: row 5, CODE matches" oldRow5.code EQS newRow5.code
  assert/text="CSV  -> Blue: row 5, LAT  matches" oldRow5.lat  EQT newRow5.lat
  assert/text="CSV  -> Blue: row 5, LON  matches" oldRow5.lon  EQT newRow5.lon

  file close oldFile
  file close newFile

  erase temp_cities.prm


endmacro
