! This test is designed to test FCALC Operators that have more than one input for mixed input types
! (added for bug 2852)
!
! 1) FCALC is designed to work with at least one input being a file, but the rest (as of 3.5.1) can
!    be constants.  So the first thing this test is designed to do is test all the file/constant
!     permutations for input parameters.  (Note: Past NeXtMidas versions were designed such that the
!    first argument HAD to be a file and that only one input could be a constant, even when there
!    were three inputs. These restrictions are lifted in 3.5.1)

! 2) Especially focus on Operations with 3 inputs (CLIP,VMUX, & SEL), as 3.5.1 has a code change
!    in Generate that now allows 2 of the 3 inputs to be constants and the result to be a file with
!    a length equal to the one file input
!
! 3) Test DIV /TYPE=L with files of different lengths as inputs.
!
! 4) NOT testing with the all constants for input case.  The code prints out an ERROR for that case,
!    which is appropriate.
!
! OPERATORS that have 2 or more inputs :
!   TESTED: ADD, SUB, MUL, DIV, ADDC, SUBC, MULC, DIVC, POW, MIN, MAX, CLIP, MUX, VMUX, MODULO, SEL,
!            DOT, ATAN2
!   TODO:   BOR, BXOR, BAND, LT, GT, LE, GE, EQ
!
! Operators that are not tested for mixed inputs because they only have less than 2 inputs: NOOP,
! FILL, SCALE, SUM, DEMUX, VDEMUX, REAL, IMAG, CMPLX, CONJ, ROUND, CEIL, FLOOR, FIX, MAG, MAG2,
! PHASE, WRAP, POLAR, RECT, LN, LNB, LOG, EXP, SQUARE, SQRT, SIN, COS, TAN, ASIN, ACOS, ATAN, BREV,
! POWER2GE, FFT, RANDOM, RANDOMOMP, DBF, FACTORIAL

!------------------------------------------------------------------------------------------------------------------------------------------------------------------------
!************************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------------
!
! Complex
!
!             |  ~+/ADDC  | ~-/SUBC  | ~*/MULC  | ~//DIVC  | MUX |
!  -----------+-----------+----------+----------+----------+-----+
!  const,file |     x     |     x    |    x     |     x    |  x  |
!  file,const |     x     |     x    |    x     |     x    |  x  |
!  /TYPE=D    |     x     |     x    |    x     |     x    |     |
!  /TYPE=F    |     x     |     x    |    x     |     x    |     |
!  /TYPE=L    |     x     |     x    |    x     |     x    |     |
!  Tested     |     x     |     x    |    x     |     x    |  x  |
!
! Notes:
!
!-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
!*************************************************************************************************************************************************************************
!-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
! VECTOR:
!
!     -       | -/ADD | -/SUB | DOT | VMUX               |
!  -----------+-------+-------+-----+--------------------+
!  const,file |    x  |   x   |  x  |tested for ccf, cfc,|
!  file,const |    x  |   x   |  x  |fcc, ffc,fcf,& cff  |
!  /TYPE=D    |    x  |   x   |  x  |                    |
!  /TYPE=F    |    x  |   x   |  x  |                    |
!  /TYPE=L    |    x  |   x   |  x  |                    |
!  Tested     |    x  |   x   |  x  |                x   |
! Notes:
!
!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
!***************************************************************************************************************************************************************************
!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
!
! SCALAR:
!
!             |  +/ADD  | -/SUB  | */MUL  | //DIV  | **/POW | ATAN2 | CLIP               |
!  -----------+---------+--------+--------+--------+--------+ ------+--------------------+
!  const,file |    x    |   x    |   x    |   x    |   x    |   x   |tested for ccf, cfc,|
!  file,const |    x    |   x    |   x    |   x    |   x    |   x   |fcc, ffc,fcf,& cff  |
!  /TYPE=D    |    x    |   x    |   x    |   x    |   x    |       |   x                |
!  /TYPE=F    |    x    |   x    |   x    |   x    |   x    |       |   x                |
!  /TYPE=L    |    x    |   x    |   x    |   x    |   x    |       |   x                |
!  TESTED     |    x    |   x    |   x    |   x    |   x    |   x   |   x                |
!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
!***************************************************************************************************************************************************************************
!---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
!
!             | MAX | MIN | MOD/T | MOD/E | MOF/F| <> | ?:                 | BOR | BAND | BXOR | BNOT |
!  -----------+-----+-----+-------+-------+------+----+--------------------+-----+------+------+------+
!  const,file |     |     |   x   |       |      |    |tested for ccf, cfc,|     |      |      |      |
!  file,const |     |     |   x   |       |      |    |fcc, ffc,fcf,& cff  |     |      |      |      |
!  TESTED     |  x  |  x  |   x   |       |      |    |                    |     |      |      |      |
!
!
!
! Notes:
!   - No need to test /HEX and /BIN with /TYPE= since those override with /TYPE=L
!   - Sometimes there is a eqt where the equation is casted as a /TYPE=F it is because of rounding errors
!-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
!*****************************************************************************************************************************************************************************
! @version: $Id: test_fcalc_mix_input_types.mm,v 1.14 2014/12/16 15:41:53 ntn Exp $
!-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
startmacro
  ! skip to desired test case
  switch "TESTCASE"      S:testcase      DEF=""      SDEF=""    ! Skip all test macros
  call Start
  if testcase neqs "" then
    call ^testcase
  else
    call simpleoperators
    call Miscellaneous
    call Trigonometry
    call Complex
    call Vector
    call Extreme_Cases
  endif
  call cleanUp
endmacro

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure Start

  result file_data_1S           {f1=3.0}
  result file_data_3S           {f1=3.0,f2=-2,f3=0}
  result file_data_3S_flip_sign {f1=-3.0,f2=2,f3=0}
  result file_data_3S_mag_gt1   {f1=3.0,f2=-2,f3=1.1}
  result file_data_3S_wfrac     {f1=3.4,f2=-2.1,f3=0}
  result file_data_3S_pos       {f1=3.0,f2=2,f3=0}
  result file_data_3S_neg       {f1=-3.0,f2=-2,f3=0}
  result file_data_3S_frac      {f1=0.1,f2=-.2,f3=0.5}
  result file_data_3S_x2        {f1=0.5,f2=1.0,f3=2}

  result file_data_10S_big_val  {f1=120,f2=-60,f3=24,f4=-480,f5=30,f6=36,f7=-66,f8=18,f9=12,f10=60}
  result file_data_10S_mag_gtl  {f1=1.5,f2=-1.1,f3=3,f4=4,f5=5,f6=6,f7=7,f8=8,f9=9,f10=2}

  result file_data_3C           {f1=(1.9,2.3),f2=(-5.21,9.21),f3=(6.51,-1.025)}

  result file_data_6C_big_val   {f1=(120,60),f2=(-60,120),f3=(24,-48),f4=(-48,-24),f5=(30,36),f6=(36,-66)}

  result file_data_3V           {f1=(1.9,2.3,4.2),f2=(-5.21,9.21,3.9),f3=(6.51,-1.025,3.4)}

  call create_file filename=ram:testfile_1s  type=1000 format=SD data=file_data_1S

  call create_file filename=ram:testfile_3s             type=1000 format=SD data=file_data_3S
  call create_file filename=ram:testfile_3s_flip_sign   type=1000 format=SD data=file_data_3S_flip_sign
  call create_file filename=ram:testfile_3s_mag_gt1     type=1000 format=SD data=file_data_3S_mag_gt1
  call create_file filename=ram:testfile_3s_wfrac       type=1000 format=SD data=file_data_3S_wfrac
  call create_file filename=ram:testfile_3s_pos         type=1000 format=SD data=file_data_3S_pos
  call create_file filename=ram:testfile_3s_neg         type=1000 format=SD data=file_data_3S_neg
  call create_file filename=ram:testfile_3s_frac        type=1000 format=SD data=file_data_3S_frac

  call create_file filename=ram:testfile_3s_t2          type=2000 format=SD data=file_data_3S
  call create_file filename=ram:testfile_3s_t2_mag_gt1  type=2000 format=SD data=file_data_3S_mag_gt1

  call create_file filename=ram:testfile_10s_big_val    type=1000 format=SD data=file_data_10S_big_val
  call create_file filename=ram:testfile_10s_mag_gt1    type=1000 format=SD data=file_data_10S_mag_gtl

  call create_file filename=ram:testfile_10s_t2_big_val type=2000 format=SD data=file_data_10S_big_val
  call create_file filename=ram:testfile_10s_t2_mag_gt1 type=2000 format=SD data=file_data_10S_mag_gtl

  call create_file filename=ram:testfile_3c             type=2000 format=CD data=file_data_3C

  call create_file filename=ram:testfile_6c_big_val     type=2000 format=CD data=file_data_6C_big_val

  call create_file filename=ram:testfile_3v             type=2000 format=VD data=file_data_3V

  waveform test_fcalc_mix_bigvlargenottl.tmp FORM=SD ELEM=1536 SHAPE=CONSTANT AMP=21.0
  waveform test_fcalc_mix_largenottl.tmp     FORM=SD ELEM=1536 SHAPE=CONSTANT AMP=3.0
  waveform test_fcalc_mix_large_tl.tmp       FORM=SD ELEM=2048 SHAPE=CONSTANT AMP=1.5

  waveform test_fcalc_mix_larget2nottl.tmp  FORM=SD ELEM=1536 SHAPE=CONSTANT AMP=3.0
  headermod test_fcalc_mix_larget2nottl.tmp type=2000
  waveform test_fcalc_mix_larget2tl.tmp     FORM=SD ELEM=2048 SHAPE=CONSTANT AMP=1.5
  headermod test_fcalc_mix_larget2tl.tmp    type=2000

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure create_file s:filename i:type s:format t:data
  file open/n out ^filename{TYPE=^type,FORM=^format}

  foreach item intable/v data
    invoke ,, out.insertData(-1,{F1=item})
  endfor

  file close out
return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure simpleoperators
  call ADDITION       inputA=2.2 inputB=ram:testfile_3s expected={t1=5.2,t2=0.2,t3=2.2,t1i=5,t2i=0,t3i=2} "inputs: const,file"
  call ADDITION       inputA=ram:testfile_3s inputB=2.2 expected={t1=5.2,t2=0.2,t3=2.2,t1i=5,t2i=0,t3i=2} "inputs: file,const"
  call SUBTRACTION    inputA=2.2 inputB=ram:testfile_3s expected={t1=-0.8,t2=4.2,t3=2.2,t1i=-1,t2i=4,t3i=2} "inputs: const,file"
  call SUBTRACTION    inputA=ram:testfile_3s_flip_sign inputB=-2.2 expected={t1=-0.8,t2=4.2,t3=2.2,t1i=-1,t2i=4,t3i=2} "inputs: file,const"
  call MULTIPLICATION inputA=2.2 inputB=ram:testfile_3s expected={t1=6.6,t2=-4.4,t3=0.0,t1i=6,t2i=-4,t3i=0} "inputs: const,file"
  call MULTIPLICATION inputA=ram:testfile_3s inputB=2.2 expected={t1=6.6,t2=-4.4,t3=0.0,t1i=6,t2i=-4,t3i=0} "inputs: file,const"
  call DIVISION       inputA=2.2 inputB=ram:testfile_3s_mag_gt1 expected={t1=0.73333333333,t2=-1.1,t3=2.0,t1i=0,t2i=-1,t3i=2} "inputs: const,file"
  call DIVISION       inputA=ram:testfile_3s inputB=2.2 expected={t1=1.3636363636,t2=-.909090909,t3=0.0,t1i=1,t2i=-1,t3i=0} "inputs: file,const"
  call POWER          inputA=2.2 inputB=ram:testfile_3s expected={t1=10.648,t2=0.2066115,t3=1.0,t1i=8,t2i=0,t3i=1} "inputs: const,file"
  call POWER          inputA=ram:testfile_3s_wfrac inputB=2.0 expected={t1=11.56,t2=4.41,t3=0.0,t1i=9,t2i=4,t3i=0} "inputs: file,const"
return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure Miscellaneous
  !    ABSOLUTE - single input, so mix input test not needed
  call CLIP inputA=ram:testfile_3s inputB=2.5 inputC=-1.5 expected={t1=2.5,t2=-1.5,t3=0.0} "inputs: file(VALUE), const(MAX), const(MIN)"
  call CLIP inputA=2.5 inputB=ram:testfile_3s_pos inputC=-2.5 expected={t1=2.5,t2=2.0,t3=0.0} "inputs: const(VALUE), file(MAX), const(MIN)"
  call CLIP inputA=1.5 inputB=3.5 inputC=ram:testfile_3s_pos expected={t1=3.0,t2=2.0,t3=1.5} "inputs: const(VALUE), const(MAX), file(MIN)"
  call CLIP inputA=ram:testfile_3s_wfrac inputB=ram:testfile_3s_pos inputC=-2.5 expected={t1=3.0,t2=-2.1,t3=0.0} "inputs: file(VALUE), file(MAX), const(MIN)"
  call CLIP inputA=ram:testfile_3s_pos inputB=2.5 inputC=ram:testfile_3s_neg expected={t1=2.5,t2=2.0,t3=0.0} "inputs: file(VALUE), const(MAX), file(MIN)"
  call CLIP inputA=2.5 inputB=ram:testfile_3s_pos inputC=ram:testfile_3s_neg expected={t1=2.5,t2=2.0,t3=0.0} "inputs: const(VALUE), file(MAX), file(MIN)"
  !    DBF      - single input, so mix input test not needed
  !    EXPONENT - single input, so mix input test not needed
  !    FIX      - single input, so mix input test not needed
  !    FLOOR    - single input, so mix input test not needed
  !    LOG      - single input, so mix input test not needed
  !    LN       - single input, so mix input test not needed
  call MAX inputA=2.2 inputB=ram:testfile_3s expected={t1=3.0,t2=2.2,t3=2.2} "inputs: const,file"
  call MAX inputA=ram:testfile_3s inputB=2.2 expected={t1=3.0,t2=2.2,t3=2.2} "inputs: file, const"
  call MIN inputA=2.2 inputB=ram:testfile_3s expected={t1=2.2,t2=-2.0,t3=0.0} "inputs: const,file"
  call MIN inputA=ram:testfile_3s inputB=2.2 expected={t1=2.2,t2=-2.0,t3=0.0} "inputs: file, const"
  call MODULO inputA=2.2 inputB=ram:testfile_3s_mag_gt1 expected={t1=2.2,t2=0.2,t3=0.0} "inputs: const,file"
  call MODULO inputA=ram:testfile_3s inputB=2.2 expected={t1=0.8,t2=-2.0,t3=0.0} "inputs: file, const"
  !    POWER2GE  - single input, so mix input test not needed
  !    RANDOM    - single input, so mix input test not needed
  call SELECT inputA=ram:testfile_3s inputB=2.5 inputC=1 expected={t1=3.0,t2=-2.0,t3=0.0} "inputs: file(a),const(b),const(c=1:(c>0)?a:b)"
  call SELECT inputA=ram:testfile_3s inputB=2.5 inputC=-1 expected={t1=2.5,t2=2.5,t3=2.5} "inputs: file(a),const(b),cons(c=-1:(c>0)?a:b)"
  call SELECT inputA=2.5 inputB=ram:testfile_3s inputC=1 expected={t1=2.5,t2=2.5,t3=2.5} "inputs: const(a),file(b),const(c=1:(c>0)?a:b)"
  call SELECT inputA=2.5 inputB=ram:testfile_3s inputC=-1 expected={t1=3.0,t2=-2.0,t3=0.0} "inputs: const(a),file(b),cons(c=-1:(c>0)?a:b)"
  call SELECT inputA=1.5 inputB=3.5 inputC=ram:testfile_3s_frac expected={t1=1.5,t2=3.5,t3=1.5} "inputs: const(a),const(b),file(MIN)"
  call SELECT inputA=ram:testfile_3s inputB=ram:testfile_3s_frac inputC=1 expected={t1=3.0,t2=-2.0,t3=0.0} "inputs: file(a),file(b),const(c=1:(c>0)?a:b)"
  call SELECT inputA=ram:testfile_3s inputB=ram:testfile_3s_frac inputC=-1 expected={t1=0.1,t2=-0.2,t3=0.5} "inputs: file(a),file(b),const(c=-1:(c>0)?a:b)"
  call SELECT inputA=ram:testfile_3s inputB=2.5 inputC=ram:testfile_3s_frac expected={t1=3.0,t2=2.5,t3=0.0} "inputs: file(a),const(b),file(c:(c>0)?a:b)"
  call SELECT inputA=2.5 inputB=ram:testfile_3s inputC=ram:testfile_3s_frac expected={t1=2.5,t2=-2.0,t3=2.5} "inputs: const(a),file(b),file(c:(c>0)?a:b)"

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure Trigonometry
  !    Sine        - single input, so mix input test not needed
  !    SineD       - single input, so mix input test not needed
  !    SineC       - single input, so mix input test not needed
  !    Cosine      - single input, so mix input test not needed
  !    CosineD     - single input, so mix input test not needed
  !    CosineC     - single input, so mix input test not needed
  !    Tangent     - single input, so mix input test not needed
  !    TangentD    - single input, so mix input test not needed
  !    TangentC    - single input, so mix input test not needed
  !    ArcSine     - single input, so mix input test not needed
  !    ArcSineD    - single input, so mix input test not needed
  !    ArcSineC    - single input, so mix input test not needed
  !    ArcCosine   - single input, so mix input test not needed
  !    ArcCosineD  - single input, so mix input test not needed
  !    ArcCosineC  - single input, so mix input test not needed
  !    ArcTangent  - single input, so mix input test not needed
  !    ArcTangentD - single input, so mix input test not needed
  !    ArcTangentC - single input, so mix input test not needed
  call ArcTangent2 inputA=2.0 inputB=ram:testfile_3s expected={t1=0.98279372,t2=-0.78539816,t3=0.0} "inputs: const,file"
  call ArcTangent2 inputA=ram:testfile_3s_mag_gt1 inputB=1.5 expected={t1=0.46364761,t2=2.4980915,t3=0.93804749} "inputs: file,const"
return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure Complex
  call COMPLEXADDITION       inputA=(2,-5) inputB=ram:testfile_3c expected={t1=(3.9,-7.3),t2=(-3.21,-14.21),t3=(8.51,-3.975),t1i=(4,-7),t2i=(-3,-14),t3i=(9,-4)} "inputs: const,file"
  call COMPLEXADDITION       inputA=ram:testfile_3c inputB=(2,-5) expected={t1=(3.9,7.3),t2=(-3.21,14.21),t3=(8.51,3.975),t1i=(4,7),t2i=(-3,14),t3i=(9,4)} "inputs: file,const"
  call COMPLEXSUBTRACTION    inputA=(2,-5) inputB=ram:testfile_3c expected={t1=(0.1,-2.7),t2=(7.21,4.21),t3=(-4.51,-6.025),t1i=(0,-3),t2i=(7,4),t3i=(-5,-6)} "inputs: const,file"
  call COMPLEXSUBTRACTION    inputA=ram:testfile_3c inputB=(2,-5) expected={t1=(-0.1,-2.7),t2=(-7.21,4.21),t3=(4.51,-6.025),t1i=(0,-3),t2i=(-7,4),t3i=(5,-6)} "inputs: file,const"
  call COMPLEXMULTIPLICATION inputA=(2,-5) inputB=ram:testfile_3c expected={t1=(-7.7,-14.1),t2=(-56.47,7.63),t3=(18.145,-30.5),t1i=(-6,-14),t2i=(-55,7),t3i=(19,-33)} "inputs: const,file"
  call COMPLEXMULTIPLICATION inputA=ram:testfile_3c inputB=(2,-5) expected={t1=(-7.7,14.1),t2=(-56.47,-7.63),t3=(18.145,30.5),t1i=(-6,14),t2i=(-55,-7),t3i=(19,33)} "inputs: file,const"
  call COMPLEXDIVISION       inputA=(2,-5) inputB=ram:testfile_3c expected={t1=(1.719101,-0.550562),t2=(0.3182153,0.3971663338),t3=(0.1817837,-0.796671),t1i=(1,0),t2i=(0,0),t3i=(0,0)} "inputs: const,file"
  call COMPLEXDIVISION       inputA=ram:testfile_3c inputB=(2,-5) expected={t1=(0.5275862,-0.1689655),t2=(1.228621,1.533448),t3=(0.2722414,-1.1931036),t1i=(0,0),t2i=(1,1),t3i=(0,-1)} "inputs: file,const"
  !    COMPLEXCONJ           - single input, so mix input test not needed
  !    CONVERTR2C            - single input, so mix input test not needed
  !    GETREALORIMAG         - single input, so mix input test not needed
  !    COMPLEXMAG            - single input, so mix input test not needed
  !    COMPLEXMAG2           - single input, so mix input test not needed
  call COMPLEXMUX            inputA=2.5   inputB=ram:testfile_3s  expected={t1=(2.5,3.0),t2=(2.5,-2.0),t3=(2.5,0.0)} "inputs: const,file"
  call COMPLEXMUX            inputA=ram:testfile_3s   inputB=2.5  expected={t1=(3.0,2.5),t2=(-2.0,2.5),t3=(0.0,2.5)} "inputs: file,const"
  !    COMPLEXDEMUX          - single input, so mix input test not needed

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure Vector
  call VECTORADD     inputA=(2.2,-3.3,5.5)  inputB=ram:testfile_3v expected={t1=(4.1,-1.0,9.7),t2=(-3.01,5.91,9.4),t3=(8.71,-4.325,8.9)} "inputs: const,file"
  call VECTORADD     inputA=ram:testfile_3v  inputB=(2.2,-3.3,5.5) expected={t1=(4.1,-1.0,9.7),t2=(-3.01,5.91,9.4),t3=(8.71,-4.325,8.9)} "inputs: file,const"
  call VECTORSUB     inputA=(2.2,-3.3,5.5)  inputB=ram:testfile_3v expected={t1=(0.3,-5.6,1.3),t2=(7.41,-12.51,1.6),t3=(-4.31,-2.275,2.1)} "inputs: const,file"
  call VECTORSUB     inputA=ram:testfile_3v  inputB=(2.2,-3.3,5.5) expected={t1=(-.3,5.6,-1.3),t2=(-7.41,12.51,-1.6),t3=(4.31,2.275,-2.1)} "inputs: file,const"
  call VECTORDOT     inputA=(2.2,-3.3,5.5)  inputB=ram:testfile_3v expected={t1=19.69,t2=-20.405,t3=36.4045} "inputs: const,file"
  call VECTORDOT     inputA=ram:testfile_3v  inputB=(2.2,-3.3,5.5) expected={t1=19.69,t2=-20.405,t3=36.4045} "inputs: const,file"
  call VECTORVMUX    inputA=2.5 inputB=-5.0 inputC=ram:testfile_3s expected={t1=(2.5,-5.0,3.0),t2=(2.5,-5.0,-2.0),t3=(2.5,-5.0,0.0)} "inputs: const,const,file"
  call VECTORVMUX    inputA=2.5 inputB=ram:testfile_3s inputC=-5.0 expected={t1=(2.5,3.0,-5.0),t2=(2.5,-2.0,-5.0),t3=(2.5,0.0,-5.0)} "inputs: const,file,const"
  call VECTORVMUX    inputA=ram:testfile_3s inputB=2.5 inputC=-5.0 expected={t1=(3.0,2.5,-5.0),t2=(-2.0,2.5,-5.0),t3=(0.0,2.5,-5.0)} "inputs: file,const,const"
  call VECTORVMUX    inputA=2.5 inputB=ram:testfile_3s_wfrac inputC=ram:testfile_3s expected={t1=(2.5,3.4,3.0),t2=(2.5,-2.1,-2.0),t3=(2.5,0.0,0.0)} "inputs: const,file,file"
  call VECTORVMUX    inputA=ram:testfile_3s inputB=2.5 inputC=ram:testfile_3s_wfrac expected={t1=(3.0,2.5,3.4),t2=(-2.0,2.5,-2.1),t3=(0.0,2.5,0.0)} "inputs: file,const,file"
  call VECTORVMUX    inputA=ram:testfile_3s inputB=ram:testfile_3s_wfrac inputC=-5.0 expected={t1=(3.0,3.4,-5.0),t2=(-2.0,-2.1,-5.0),t3=(0.0,0.0,-5.0)} "inputs: file,file,const"
  !    VECTORVDEMUX  - single input, so mix input test not needed
return


!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure extreme_cases
  ! Test Operator Argument Size Adjustment Using Integer Division (causes divide by 0 if not right)
  !  test with type 1000 Scalar files
  call OP_ARG_SIZE_INT_DIV   inputA=ram:testfile_10s_big_val inputB=ram:testfile_3s_mag_gt1 expected={t1i=40,t2i=30,t3i=24,tfsize=3} "inputs: 10elemT1file,3elemT1file"
  call OP_ARG_SIZE_INT_DIV   inputA=ram:testfile_3s inputB=ram:testfile_10s_mag_gt1 expected={t1i=1,t2i=2,t3i=0,tfsize=3} "inputs: 3elemT1file,10elemT1file"
  call OP_ARG_SIZE_INT_DIV   inputA=ram:testfile_10s_big_val inputB=test_fcalc_mix_largenottl.tmp expected={t1i=40,t2i=-20,t3i=8,tfsize=10} "inputs: 10elemT1file,1536elemT1file"
  call OP_ARG_SIZE_INT_DIV   inputA=test_fcalc_mix_largenottl.tmp inputB=test_fcalc_mix_large_tl.tmp expected={t1i=1,t2i=1,t3i=1,tfsize=1536} "inputs: 1536elemT1file,2048eleT1file"
  call OP_ARG_SIZE_INT_DIV   inputA=test_fcalc_mix_bigvlargenottl.tmp inputB=test_fcalc_mix_largenottl.tmp expected={t1i=7.0,t2i=7.0,t3i=7.0,tfsize=1536} "inputs: 1536elemT1file,1536eleT1file"
  call ONE_ELEM_INT_DIV   inputA=ram:testfile_10s_big_val inputB=ram:testfile_1s expected={t1i=40,tfsize=1} "inputs: 10elemT1file,1elemT1file"
  call ONE_ELEM_INT_DIV   inputA=ram:testfile_1s inputB=test_fcalc_mix_large_tl.tmp expected={t1i=1,tfsize=1} "inputs: 1elemT1file,2048elemT1file"
  call ONE_ELEM_INT_DIV   inputA=ram:testfile_1s inputB=ram:testfile_10s_mag_gt1 expected={t1i=1,tfsize=1} "inputs: 1elemT1file,10elemT1file"
  ! test with Type 2000 Complex files
  call OP_ARG_SIZE_INT_DIV   inputA=ram:testfile_10s_t2_big_val inputB=ram:testfile_3s_t2_mag_gt1 expected={t1i=40,t2i=30,t3i=24,tfsize=3} "inputs: 10elemT2file,3elemT2file"
  call OP_ARG_SIZE_INT_DIV   inputA=ram:testfile_3s_t2 inputB=ram:testfile_10s_t2_mag_gt1 expected={t1i=1,t2i=2,t3i=0,tfsize=3} "inputs: 3elemT2file,10elemT2file"
  call OP_ARG_SIZE_INT_DIV   inputA=ram:testfile_10s_t2_big_val inputB=test_fcalc_mix_larget2nottl.tmp expected={t1i=40,t2i=-20,t3i=8,tfsize=10} "inputs: 10elemT2file,1536elemT2file"
  call OP_ARG_SIZE_INT_DIV   inputA=test_fcalc_mix_larget2nottl.tmp inputB=test_fcalc_mix_larget2tl.tmp expected={t1i=1,t2i=1,t3i=1,tfsize=1536} "inputs: 1536elemT2file,2048eleT2file"
  ! test with a mix of Type 1000 & Type 2000 - need to decide on desired behavior, backing out changes & tests
!  call OP_ARG_SIZE_INT_DIV   inputA=ram:testfile_10s_big_val inputB=ram:testfile_3s_t2_mag_gt1 expected={t1i=40,t2i=30,t3i=24,tfsize=3} "inputs: 10elemT1file,3elemT2file"
  call OP_ARG_SIZE_INT_DIV   inputA=ram:testfile_3s_t2 inputB=ram:testfile_10s_mag_gt1 expected={t1i=1,t2i=2,t3i=0,tfsize=3} "inputs: 3elemT2file,10elemT1file"
!  call OP_ARG_SIZE_INT_DIV   inputA=ram:testfile_10s_big_val inputB=test_fcalc_mix_larget2nottl.tmp expected={t1i=40,t2i=-20,t3i=8,tfsize=10} "inputs: 10elemT1file,1536elemT2file"

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure ADDITION fn:inputA fn:inputB t:expected s:type_inputs

  fcalc ram:ADDITION ^inputA ^inputB +
  file open in ram:ADDITION
     invoke row in.getDataTable(0)
     ASSERT/text="FCALC: SCALAR/+/1st ^type_inputs" row.F1 eqt ^{expected.t1}
     invoke row in.getDataTable(1)
     ASSERT/text="FCALC: SCALAR/+/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
     invoke row in.getDataTable(2)
     ASSERT/text="FCALC: SCALAR/+/3rd Test ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

  fcalc ram:ADDITION ^inputA ^inputB + /TYPE=L
  file open in ram:ADDITION
     invoke row in.getDataTable(0)
     ASSERT/text="FCALC: SCALAR/+/1st/TYPE=L ^type_inputs" row.F1 eqt ^{expected.t1i}
     invoke row in.getDataTable(1)
     ASSERT/text="FCALC: SCALAR/+/2nd/TYPE=L ^type_inputs" row.F1 eqt ^{expected.t2i}
     invoke row in.getDataTable(2)
     ASSERT/text="FCALC: SCALAR/+/3rd/TYPE=L ^type_inputs" row.F1 eqt ^{expected.t3i}
     invoke row in.getDataTable(3)
  file close in

  fcalc ram:ADDITION ^inputA ^inputB + /TYPE=F
  file open in ram:ADDITION
     invoke row in.getDataTable(0)
     ASSERT/text="FCALC: SCALAR/+/1st/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t1}
     invoke row in.getDataTable(1)
     ASSERT/text="FCALC: SCALAR/+/2nd /TYPE=F ^type_inputs" row.F1 eqt ^{expected.t2}
     invoke row in.getDataTable(2)
     ASSERT/text="FCALC: SCALAR/+/3rd/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

  fcalc ram:ADDITION ^inputA ^inputB + /TYPE=D
  file open in ram:ADDITION
     invoke row in.getDataTable(0)
     ASSERT/text="FCALC: SCALAR/+/1st/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t1}
     invoke row in.getDataTable(1)
     ASSERT/text="FCALC: SCALAR/+/2nd/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t2}
     invoke row in.getDataTable(2)
     ASSERT/text="FCALC: SCALAR/+/3rd/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure SUBTRACTION fn:inputA fn:inputB t:expected  s:type_inputs

   fcalc ram:SUBTRACTION ^inputA ^inputB -
   file open in ram:SUBTRACTION
     invoke row in.getDataTable(0)
     ASSERT/text="FCALC: SCALAR/-/1st ^type_inputs" row.F1 eqt ^{expected.t1}
     invoke row in.getDataTable(1)
     ASSERT/text="FCALC: SCALAR/-/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
     ASSERT/text="FCALC: SCALAR/-/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

   fcalc ram:SUBTRACTION ^inputA ^inputB - /TYPE=L
   file open in ram:SUBTRACTION
     invoke row in.getDataTable(0)
     ASSERT/text="FCALC: SCALAR/-/1st/TYPE=L  ^type_inputs" row.F1 eqt ^{expected.t1i}
     invoke row in.getDataTable(1)
     ASSERT/text="FCALC: SCALAR/-/2nd/TYPE=L  ^type_inputs" row.F1 eqt ^{expected.t2i}
     invoke row in.getDataTable(2)
     ASSERT/text="FCALC: SCALAR/-/3rd/TYPE=L  ^type_inputs" row.F1 eqt ^{expected.t3i}
  file close in

   fcalc ram:SUBTRACTION ^inputA ^inputB - /TYPE=F
   file open in ram:SUBTRACTION
     invoke row in.getDataTable(0)
     ASSERT/text="FCALC: SCALAR/-/1st/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t1}
     invoke row in.getDataTable(1)
     ASSERT/text="FCALC: SCALAR/-/2nd/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t2}
     invoke row in.getDataTable(2)
     ASSERT/text="FCALC: SCALAR/-/3rd/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

   fcalc ram:SUBTRACTION ^inputA ^inputB - /TYPE=D
   file open in ram:SUBTRACTION
     invoke row in.getDataTable(0)
     ASSERT/text="FCALC: SCALAR/-/1st/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t1}
     invoke row in.getDataTable(1)
     ASSERT/text="FCALC: SCALAR/-/2nd/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t2}
     invoke row in.getDataTable(2)
     ASSERT/text="FCALC: SCALAR/-/3rd/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure MULTIPLICATION fn:inputA fn:inputB t:expected s:type_inputs

    fcalc ram:MULTIPLICATION ^inputA ^inputB *
    file open in ram:MULTIPLICATION
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: SCALAR/*/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: SCALAR/*/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: SCALAR/*/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
    file close in

    fcalc ram:MULTIPLICATION ^inputA ^inputB * /TYPE=L
    file open in ram:MULTIPLICATION
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: SCALAR/*/1st/TYPE=L ^type_inputs" row.F1 eqt ^{expected.t1i}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: SCALAR/*/2nd/TYPE=L ^type_inputs" row.F1 eqt ^{expected.t2i}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: SCALAR/*/3rd/TYPE=L ^type_inputs" row.F1 eqt ^{expected.t3i}
    file close in

    fcalc ram:MULTIPLICATION ^inputA ^inputB * /TYPE=F
    file open in ram:MULTIPLICATION
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: SCALAR/*/1st/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: SCALAR/*/2nd/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: SCALAR/*/3rd/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t3}
    file close in

    fcalc ram:MULTIPLICATION ^inputA ^inputB * /TYPE=D
    file open in ram:MULTIPLICATION
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: SCALAR/*/1st/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: SCALAR/*/2nd/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: SCALAR/*/3rd/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t3}
    file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure DIVISION fn:inputA fn:inputB t:expected s:type_inputs

    fcalc ram:DIVISION ^inputA ^inputB DIV
    file open in ram:DIVISION

      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: SCALAR///1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: SCALAR///2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: SCALAR///3rd ^type_inputs" row.F1 eqt ^{expected.t3}
    file close in


    fcalc ram:DIVISION ^inputA ^inputB DIV /TYPE=L
    file open in ram:DIVISION
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: SCALAR///1st/TYPE=L ^type_inputs" row.F1 eqt ^{expected.t1i}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: SCALAR///2nd/TYPE=L ^type_inputs" row.F1 eqt ^{expected.t2i}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: SCALAR///3rd/TYPE=L ^type_inputs" row.F1 eqt ^{expected.t3i}
    file close in

    fcalc ram:DIVISION ^inputA ^inputB DIV /TYPE=F
    file open in ram:DIVISION
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: SCALAR///1st/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: SCALAR///2nd/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: SCALAR///3rd/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t3}
    file close in

    fcalc ram:DIVISION ^inputA ^inputB DIV /TYPE=D
    file open in ram:DIVISION
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: SCALAR///1st/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: SCALAR///2nd/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: SCALAR///3rd/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t3}
    file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure POWER fn:inputA fn:inputB t:expected s:type_inputs

    fcalc ram:POWER ^inputA ^inputB **
    file open in ram:POWER
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: SCALAR/**/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: SCALAR/**/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: SCALAR/**/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
    file close in

    fcalc ram:POWER ^inputA ^inputB ** /TYPE=L
    file open in ram:POWER
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: SCALAR/**/1st/TYPE=L ^type_inputs" row.F1 eqt ^{expected.t1i}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: SCALAR/**/2nd/TYPE=L ^type_inputs" row.F1 eqt ^{expected.t2i}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: SCALAR/**/3rd/TYPE=L ^type_inputs" row.F1 eqt ^{expected.t3i}
      invoke row in.getDataTable(3)
    file close in

    fcalc ram:POWER ^inputA ^inputB ** /TYPE=F
    file open in ram:POWER
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: SCALAR/**/1st/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: SCALAR/**/2nd/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: SCALAR/**/3rd/TYPE=F ^type_inputs" row.F1 eqt ^{expected.t3}
    file close in

    fcalc ram:POWER ^inputA ^inputB ** /TYPE=D
    file open in ram:POWER
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: SCALAR/**/1st/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: SCALAR/**/2nd/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: SCALAR/**/3rd/TYPE=D ^type_inputs" row.F1 eqt ^{expected.t3}
    file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure CLIP fn:inputA fn:inputB fn:inputC t:expected s:type_inputs

  fcalc ram:CLIP ^inputA ^inputB ^inputC CLIP
  file open in ram:CLIP
    invoke row in.getDataTable(0)
    ASSERT/text="FCALC: SCALAR/CLIP/1st ^type_inputs" row.F1 eqt ^{expected.t1}
    invoke row in.getDataTable(1)
    ASSERT/text="FCALC: SCALAR/CLIP/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
    invoke row in.getDataTable(2)
    ASSERT/text="FCALC: SCALAR/CLIP/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure MAX fn:inputA fn:inputB t:expected s:type_inputs

  fcalc ram:MAX ^inputA ^inputB MAX
  file open in ram:MAX
    invoke row in.getDataTable(0)
    ASSERT/text="FCALC: SCALAR/MAX/1st ^type_inputs" row.F1 eqt ^{expected.t1}
    invoke row in.getDataTable(1)
    ASSERT/text="FCALC: SCALAR/MAX/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
    invoke row in.getDataTable(2)
    ASSERT/text="FCALC: SCALAR/MAX/3rd ^type_inputs" row.F1 eqt ^{expected.t3}

  file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure MIN fn:inputA fn:inputB t:expected s:type_inputs

  fcalc ram:MIN ^inputA ^inputB MIN
  file open in ram:MIN
    invoke row in.getDataTable(0)
    ASSERT/text="FCALC: SCALAR/MIN/1st ^type_inputs" row.F1 eqt ^{expected.t1}
    invoke row in.getDataTable(1)
    ASSERT/text="FCALC: SCALAR/MIN/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
    invoke row in.getDataTable(2)
    ASSERT/text="FCALC: SCALAR/MIN/3rd ^type_inputs" row.F1 eqt ^{expected.t3}

  file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure MODULO fn:inputA fn:inputB t:expected s:type_inputs

  fcalc ram:MOD ^inputA ^inputB MOD/T
  file open in ram:MOD
    invoke row in.getDataTable(0)
    ASSERT/text="FCALC: SCALAR/MOD/1st ^type_inputs" row.F1 eqt ^{expected.t1}
    invoke row in.getDataTable(1)
    ASSERT/text="FCALC: SCALAR/MOD/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
    invoke row in.getDataTable(2)
    ASSERT/text="FCALC: SCALAR/MOD/3rd ^type_inputs" row.F1 eqt ^{expected.t3}

  file close in

  fcalc ram:MOD_E ^inputA ^inputB MOD/E
  file open in ram:MOD_E
!   "TODO: SCALAR/MOD/E Test NOT OPERATIONAL !!!!!!!!!!!!!!!!!!!!!!"
    invoke row in.getDataTable(0)
    ASSERT/text="FCALC: SCALAR/MOD/E/1st ^type_inputs" row.F1 eqt /NOOP="TODO: SCALAR/MOD/E test is not operational"
!    say ^row.F1
    invoke row in.getDataTable(1)
!    ASSERT/text="FCALC: SCALAR/MOD/E/2nd ^type_inputs" row.F1 eqt
!    say ^row.F1
    invoke row in.getDataTable(2)
!    ASSERT/text="FCALC: SCALAR/MOD/E/3rd ^type_inputs" row.F1 eqt
!    say ^row.F1
  file close in

  fcalc ram:MOD_F ^inputA ^inputB MOD/F
    file open in ram:MOD_F
!   "TODO: SCALAR/MOD/F Test NOT OPERATIONAL !!!!!!!!!!!!!!!!!!!!!!"
    invoke row in.getDataTable(0)
    ASSERT/text="FCALC: SCALAR/MOD/F/1st ^type_inputs" row.F1 eqt /NOOP="TODO: SCALAR/MOD/F test is not operational"
!    say ^row.F1
    invoke row in.getDataTable(1)
!    ASSERT/text="FCALC: SCALAR/MOD/F/2nd ^type_inputs" row.F1 eqt
!    say ^row.F1
    invoke row in.getDataTable(2)
!    ASSERT/text="FCALC: SCALAR/MOD/F/3rd ^type_inputs" row.F1 eqt
!    say ^row.F1

  file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure SELECT fn:inputA fn:inputB fn:inputC t:expected s:type_inputs

  fcalc ram:SEL ^inputA ^inputB ^inputC SEL
  file open in ram:SEL
    invoke row in.getDataTable(0)
    ASSERT/text="FCALC: SCALAR/SEL/1st ^type_inputs" row.F1 eqt ^{expected.t1}
    invoke row in.getDataTable(1)
    ASSERT/text="FCALC: SCALAR/SEL/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
    invoke row in.getDataTable(2)
    ASSERT/text="FCALC: SCALAR/SEL/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure ArcTangent2 fn:inputA fn:inputB t:expected s:type_inputs

  fcalc ram:ARCTANGENT2 ^inputA ^inputB ATAN2
  file open in ram:ARCTANGENT2
    invoke row in.getDataTable(0)
    ASSERT/text="FCALC: SCALAR/Arctangent2/1st ^type_inputs" row.F1 eqt ^{expected.t1}
    invoke row in.getDataTable(1)
    ASSERT/text="FCALC: SCALAR/Arctangent2/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
    invoke row in.getDataTable(2)
    ASSERT/text="FCALC: SCALAR/Arctangent2/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure COMPLEXADDITION fn:inputA fn:inputB  t:expected s:type_inputs

  fcalc ram:COMPLEXADD ^inputA ^inputB ~+
  file open in ram:COMPLEXADD
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/ADD/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/ADD/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/ADD/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

  fcalc ram:COMPLEXADD_L ^inputA ^inputB ~+ /TYPE=L
  file open in ram:COMPLEXADD_L
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/ADD/TYPE=L/1st ^type_inputs" row.F1 eqt ^{expected.t1i}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/ADD/TYPE=L/2nd ^type_inputs" row.F1 eqt ^{expected.t2i}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/ADD/TYPE=L/3rd ^type_inputs" row.F1 eqt ^{expected.t3i}
  file close in

  fcalc ram:COMPLEXADD_F ^inputA ^inputB ~+ /TYPE=F
  file open in ram:COMPLEXADD_F
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/ADD/TYPE=F/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/ADD/TYPE=F/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/ADD/TYPE=F/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

  fcalc ram:COMPLEXADD_D ^inputA ^inputB ~+ /TYPE=D
  file open in ram:COMPLEXADD_D
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/ADD/TYPE=D/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/ADD/TYPE=D/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/ADD/TYPE=D/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
   file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure COMPLEXSUBTRACTION fn:inputA fn:inputB  t:expected s:type_inputs

  fcalc ram:COMPLEXSUBTRACTION ^inputA ^inputB ~-
  file open in ram:COMPLEXSUBTRACTION
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/SUB/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/SUB/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/SUB/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

  fcalc ram:COMPLEXSUBTRACTION_L ^inputA ^inputB ~- /TYPE=L
  file open in ram:COMPLEXSUBTRACTION_L
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/SUB/TYPE=L/1st ^type_inputs" row.F1 eqt ^{expected.t1i}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/SUB/TYPE=L/2nd ^type_inputs" row.F1 eqt ^{expected.t2i}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/SUB/TYPE=L/3rd ^type_inputs" row.F1 eqt ^{expected.t3i}
  file close in

  fcalc ram:COMPLEXSUBTRACTION_F ^inputA ^inputB ~- /TYPE=F
  file open in ram:COMPLEXSUBTRACTION_F
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/SUB/TYPE=F/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/SUB/TYPE=F/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/SUB/TYPE=F/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

  fcalc ram:COMPLEXSUBTRACTION_D ^inputA ^inputB ~- /TYPE=D
  file open in ram:COMPLEXSUBTRACTION_D
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/SUB/TYPE=D/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/SUB/TYPE=D/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/SUB/TYPE=D/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
   file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure COMPLEXMULTIPLICATION fn:inputA fn:inputB  t:expected s:type_inputs

  fcalc ram:COMPLEXMULT ^inputA ^inputB ~*
  file open in ram:COMPLEXMULT
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/MULT/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/MULT/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/MULT/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

  fcalc ram:COMPLEXMULT_L ^inputA ^inputB ~* /TYPE=L
  file open in ram:COMPLEXMULT_L
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/MULT/TYPE=L/1st ^type_inputs" row.F1 eqt ^{expected.t1i}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/MULT/TYPE=L/2nd ^type_inputs" row.F1 eqt ^{expected.t2i}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/MULT/TYPE=L/3rd ^type_inputs" row.F1 eqt ^{expected.t3i}
   file close in

  fcalc ram:COMPLEXMULT_F ^inputA ^inputB ~* /TYPE=F
  file open in ram:COMPLEXMULT_F
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/MULT/TYPE=F/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/MULT/TYPE=F/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/MULT/TYPE=F/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
   file close in

  fcalc ram:COMPLEXMULT_D ^inputA ^inputB  ~* /TYPE=D
  file open in ram:COMPLEXMULT_D
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/MULT/TYPE=D/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/MULT/TYPE=D/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/MULT/TYPE=D/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
   file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure COMPLEXDIVISION fn:inputA fn:inputB  t:expected s:type_inputs

  fcalc ram:COMPLEXDIV ^inputA ^inputB ~/
  file open in ram:COMPLEXDIV
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/DIV/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/DIV/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/DIV/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

  fcalc ram:COMPLEXDIV_L ^inputA ^inputB ~/ /TYPE=L
  file open in ram:COMPLEXDIV_L
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/DIV/TYPE=L/1st ^type_inputs" row.F1 eqt ^{expected.t1i}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/DIV/TYPE=L/2nd ^type_inputs" row.F1 eqt ^{expected.t2i}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/DIV/TYPE=L/3rd ^type_inputs" row.F1 eqt ^{expected.t3i}
  file close in

  fcalc ram:COMPLEXDIV_F ^inputA ^inputB ~/ /TYPE=F
  file open in ram:COMPLEXDIV_F
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/DIV/TYPE=F/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/DIV/TYPE=F/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/DIV/TYPE=F/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

  fcalc ram:COMPLEXDIV_D ^inputA ^inputB ~/ /TYPE=D
  file open in ram:COMPLEXDIV_D
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/DIV/TYPE=D/1st ^type_inputs" row.F1 eqt ^{expected.t1}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/DIV/TYPE=D/2nd ^type_inputs" row.F1 eqt ^{expected.t2}
        invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/DIV/TYPE=D/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure COMPLEXMUX fn:inputA fn:inputB   t:expected s:type_inputs

  fcalc ram:MUX ^inputA ^inputB MUX
  file open in ram:MUX
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: COMPLEX/MUX/1st ^type_inputs" row.F1 eqt ^{expected.t1}

      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: COMPLEX/MUX/2nd ^type_inputs" row.F1 eqt ^{expected.t2}

      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: COMPLEX/MUX/3rd ^type_inputs" row.F1 eqt ^{expected.t3}

  file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------

procedure VECTORADD fn:inputA fn:inputB  t:expected s:type_inputs

  fcalc ram:VADD ^inputA ^inputB +
  file open in ram:VADD
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: VECTOR/VADD/1st ^type_inputs"  row.F1 eqt ^{expected.t1}

      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: VECTOR/VADD/2nd ^type_inputs" row.F1 eqt ^{expected.t2}

      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: VECTOR/VADD/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

return
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure VECTORSUB fn:inputA fn:inputB  t:expected s:type_inputs

  fcalc ram:VSUB ^inputA ^inputB -
  file open in ram:VSUB
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: VECTOR/VSUB/1st ^type_inputs" row.F1 eqt ^{expected.t1}

      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: VECTOR/VSUB/2nd ^type_inputs" row.F1 eqt ^{expected.t2}

      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: VECTOR/VSUB/3rd ^type_inputs" row.F1 eqt ^{expected.t3}
  file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure VECTORDOT fn:inputA fn:inputB  t:expected s:type_inputs

  fcalc ram:VDOT ^inputA ^inputB DOT
  file open in ram:VDOT
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: VECTOR/DOT/1st ^type_inputs" row.F1 eqt ^{expected.t1}

      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: VECTOR/DOT/2nd ^type_inputs" row.F1 eqt ^{expected.t2}

      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: VECTOR/DOT/3rd ^type_inputs" row.F1 eqt ^{expected.t3}


  file close in

return
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure VECTORVMUX fn:inputA fn:inputB fn:inputC  t:expected s:type_inputs

  fcalc ram:VMUX ^inputA ^inputB ^inputC VMUX
  file open in ram:VMUX
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: VECTOR/VMUX/1st ^type_inputs" row.F1 eqt ^{expected.t1}

      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: VECTOR/VMUX/2nd ^type_inputs" row.F1 eqt ^{expected.t2}

      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: VECTOR/VMUX/3rd ^type_inputs" row.F1 eqt ^{expected.t3}

  file close in
return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure OP_ARG_SIZE_INT_DIV fn:inputA fn:inputB t:expected s:type_inputs

    fcalc ram:DIVISION ^inputA ^inputB DIV /TYPE=L
    status ram:DIVISION size=file_size
    ASSERT/text="FCALC: OP_ARG_SIZE_DIV File Size ^type_inputs" file_size eq ^{expected.tfsize}
    file open in ram:DIVISION
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: OP_ARG_SIZE_DIV/1st ^type_inputs" row.F1 eqt ^{expected.t1i}
      invoke row in.getDataTable(1)
      ASSERT/text="FCALC: OP_ARG_SIZE_DIV/2nd ^type_inputs" row.F1 eqt ^{expected.t2i}
      invoke row in.getDataTable(2)
      ASSERT/text="FCALC: OP_ARG_SIZE_DIV/3rd ^type_inputs" row.F1 eqt ^{expected.t3i}
    file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure ONE_ELEM_INT_DIV fn:inputA fn:inputB t:expected s:type_inputs

    fcalc ram:DIVISION ^inputA ^inputB DIV /TYPE=L
    status ram:DIVISION size=file_size
    ASSERT/text="FCALC: ONE_ELEM_INT_DIV File Size ^type_inputs" file_size eq ^{expected.tfsize}
    file open in ram:DIVISION
      invoke row in.getDataTable(0)
      ASSERT/text="FCALC: ONE_ELEM_INT_DIV ^type_inputs" row.F1 eqt ^{expected.t1i}
    file close in

return

!------------------------------------------------------------------------------------------------------------------------------------------------------------------
!******************************************************************************************************************************************************************
!------------------------------------------------------------------------------------------------------------------------------------------------------------------
procedure cleanUp

  erase ram:testfile_1s

  erase ram:testfile_3s
  erase ram:testfile_3s_flip_sign
  erase ram:testfile_3s_mag_gt1
  erase ram:testfile_3s_wfrac
  erase ram:testfile_3s_pos
  erase ram:testfile_3s_neg
  erase ram:testfile_3s_frac

  erase ram:testfile_10s_big_val
  erase ram:testfile_10s_mag_gt1

  erase ram:testfile_3s_t2
  erase ram:testfile_3s_t2_mag_gt1

  erase ram:testfile_10s_t2_big_val
  erase ram:testfile_10s_t2_mag_gt1

  erase ram:testfile_3c
  erase ram:testfile_6c_big_val

  erase ram:testfile_3v

  erase test_fcalc_mix_bigvlargenottl.tmp
  erase test_fcalc_mix_largenottl.tmp
  erase test_fcalc_mix_large_tl.tmp

  erase test_fcalc_mix_larget2nottl.tmp
  erase test_fcalc_mix_larget2tl.tmp

return
