IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10311


Ignore:
Timestamp:
Nov 30, 2006, 9:02:30 AM (20 years ago)
Author:
eugene
Message:

updated tests from mark pitts

Location:
trunk/Ohana/src/opihi/cmd.basic/test
Files:
6 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.basic/test/cd.sh

    r6265 r10311  
    22list tests
    33 test1
     4 test2
    45end
    56
     
    2122end
    2223
    23 # i have no idea how to test pwd automatically
     24# test that pwd output is correct
     25macro test2
     26 $PASS = 1
     27 exec touch foo.test
     28 pwd -var testdir
     29 file $testdir\/foo.test exists
     30 if ($exists != 1)
     31  $PASS = 0
     32 end
     33 exec rm foo.test
     34end
  • trunk/Ohana/src/opihi/cmd.basic/test/date.sh

    r6265 r10311  
    88macro test1
    99 $PASS = 1
    10  date var
     10 date -var var
    1111 if ($STATUS == 0)
    1212   $PASS = 0
     
    1717macro test2
    1818 $PASS = 1
    19  date date1
     19 date -var date1
    2020 $date2 = `date`
    2121 list w1 -split $date1
  • trunk/Ohana/src/opihi/cmd.basic/test/echo.sh

    r6265 r10311  
    44end
    55
    6 # test that config does not return an error
     6# test that echo actually echoes
    77macro test1
    88 $PASS = 1
  • trunk/Ohana/src/opihi/cmd.basic/test/for.sh

    r9472 r10311  
    9898   end
    9999  end   
     100
     101  $PASS = 1
    100102 
    101103  if (($i != 30) || ($N != 31))
     
    151153 $endmem = $word:1
    152154
     155 $PASS = 1
     156
    153157 if ($endmem - $startmem > 10)
    154158   $PASS = 0
     
    182186 $endmem = $word:1
    183187
     188 $PASS = 1
     189
    184190 if ($i != 9999)
    185191   $PASS = 0
  • trunk/Ohana/src/opihi/cmd.basic/test/fprintf.sh

    r9197 r10311  
    7575 $endmem = $word:1
    7676
    77  if ("$endmem - $startmem" < 10)
     77 if ($endmem - $startmem < 10)
    7878   $PASS = 1
    7979 else
    8080   $PASS = 0
     81   echo growth: {$endmem - $startmem}
     82   echo kB/loop: {($endmem - $startmem)/1000}
    8183 end
    8284end
  • trunk/Ohana/src/opihi/cmd.basic/test/getchr.sh

    r6265 r10311  
    55end
    66
    7 # test that config does not return an error
     7# index test
    88macro test1
    99 $PASS = 1
     
    1414end
    1515
    16 # test that config does not return an error
     16# null test
    1717macro test2
    1818 $PASS = 1
    19  getchr "a long string.string" a var
    20  if ($var != 0)
     19 getchr "a long string.string" x var
     20 if ($var != -1)
    2121   $PASS = 0
    2222 end
  • trunk/Ohana/src/opihi/cmd.basic/test/if.sh

    r9197 r10311  
    1212 test10
    1313 test11
     14 test12
     15 test13
     16 test14
    1417end
    1518
     
    168171
    169172
     173# basic logical test
     174macro test11
     175
     176 local a b
     177
     178 $a = 1
     179 $b = 2
     180
     181 if (($a <= 0) || ($b >= 3))
     182   $PASS = 0
     183 else
     184   $PASS = 1
     185 end
     186end
     187
     188
     189# basic logical test
     190macro test12
     191
     192 local a
     193
     194 $a = 1
     195
     196 if ($a != 1)
     197   $PASS = 0
     198 else
     199   $PASS = 1
     200 end
     201end
     202
     203
    170204# check memleaks
    171 macro test11
     205macro test13
    172206
    173207 local a b i N
     
    197231 end
    198232end
     233
     234# memory test using break
     235macro test14
     236
     237 local a b i N
     238
     239 list word -x "ps -p $PID -o rss"
     240 $startmem = $word:1
     241
     242 output /dev/null
     243 $a = 1
     244 $b = 2
     245 for i 0 10000
     246   if (($a == 1) && ($b == 2))
     247    break
     248    echo "run"   
     249   end
     250 end   
     251 output stdout
     252 
     253 list word -x "ps -p $PID -o rss"
     254 $endmem = $word:1
     255
     256 if ({$endmem - $startmem} < 10)
     257   $PASS = 1
     258 else
     259   $PASS = 0
     260   echo "growth: {$endmem-$startmem}"
     261   echo "kB/loop: {($endmem-$startmem)/10000}"
     262 end
     263end
  • trunk/Ohana/src/opihi/cmd.basic/test/math.sh

    r9360 r10311  
    22list tests
    33 test1
     4 test2
    45 testmem1
    56 testmem2
     
    89end
    910
     11# test subtraction
    1012macro test1
    1113
     14  $PASS = 1
    1215  local i
    1316
     
    2629end
    2730
     31# test addition, division, and multiplication
     32macro test2
     33
     34 $PASS = 1
     35 local a b c
     36
     37 $a = {2 + 4}
     38 $b = {12 / 2}
     39 $c = {2 * 3}
     40
     41 if (($a != 6) || ($b != 6) || ($c != 6))
     42   $PASS = 0
     43   echo "ALL VALUES NOT 6: a=$a\ b=$b\ c=$c\"
     44 end
     45
     46end
     47
    2848# check memleaks (set global)
    2949macro testmem1
    3050
     51 $PASS = 1
    3152 local i
    3253
     
    5374macro testmem2
    5475
     76 $PASS = 1
    5577 local i N
    5678
     
    6183 for i 0 10000
    6284   $N = 99 - 98
     85   $N = 1 + 1
     86   $N = 2 * 2
     87   $N = 22/7
    6388 end   
    6489 output stdout
     
    77102macro testmem3
    78103
     104 $PASS = 1
    79105 local i N
    80106
     
    101127macro testmem4
    102128
     129 $PASS = 1
    103130 local i N
    104131
  • trunk/Ohana/src/opihi/cmd.basic/test/sprintf.sh

    r6231 r10311  
    1 
    21list tests
    32 test1
    4  test2
    5  test3
    6  test4
     3 memtest1
    74end
    85
     6# Does sprintf work?
    97macro test1
    10  sprintf line "test %03d" 50
    11  if ("$line" == "test 050")
    12    $PASS = 1
    13  else
    14    $PASS = 0
     8 $PASS = 1
     9
     10 local test_var
     11
     12 sprint test_var "%7s %5.2f %9.3e" float 34.5 12630000
     13
     14 if ("$test_var" != "  float 34.50 1.263e+07")
     15  $PASS = 0
    1516 end
     17
    1618end
    1719
    18 macro test2
    19  sprintf line "test %6.3f" 123.45678
    20  if ("$line" == "test 123.457")
    21    $PASS = 1
    22  else
     20# Memory test
     21macro memtest1
     22
     23 local i
     24
     25 list word -x "ps -p $PID -o rss"
     26 $startmem = $word:1
     27
     28 for i 0 10000
     29  sprint test_var "%7s %5.2f %9.3e" float 34.5 12630000
     30 end   
     31 
     32 list word -x "ps -p $PID -o rss"
     33 $endmem = $word:1
     34
     35 $PASS = 1
     36
     37 if ($endmem - $startmem > 10)
    2338   $PASS = 0
     39   echo "growth: {$endmem-$startmem}"
     40   echo "kB/loop: {($endmem-$startmem)/10000}"
    2441 end
     42
    2543end
    26 
    27 macro test3
    28  sprintf line "test %x" 32
    29  if ("$line" == "test 20")
    30    $PASS = 1
    31  else
    32    $PASS = 0
    33  end
    34 end
    35 
    36 macro test4
    37  sprintf line "test %10s" foobar
    38  if ("$line" == "test     foobar")
    39    $PASS = 1
    40  else
    41    $PASS = 0
    42  end
    43 end
  • trunk/Ohana/src/opihi/cmd.basic/test/variable.sh

    r9197 r10311  
    1414 test12
    1515 test13
     16 test14
    1617 testmem1
    1718 testmem2
     
    4142end
    4243
    43 #
     44# do math expressions assign the correct value (test2 -> test8)
    4445macro test2
    4546
     
    5758end
    5859
    59 # do we loop up in small steps correctly?
    6060macro test3
    6161
     
    7373end
    7474
    75 # do we loop down in small steps correctly?
    7675macro test4
    7776
     
    8988end
    9089
    91 # do we loop down in small steps correctly?
    9290macro test5
    9391
     
    105103end
    106104
    107 # do we loop down in small steps correctly?
    108105macro test6
    109106
     
    121118end
    122119
    123 # do we loop down in small steps correctly?
     120# testing operation priority
    124121macro test7
    125122
    126   local i
     123  local i j
    127124
    128125  $i = 2 - 3*2
    129 
    130  if ($i == -4)
     126  $j = 10/2*5+5
     127
     128 if (($i == -4) && ($j == 30))
     129   $PASS = 1
     130 else
     131   $PASS = 0
     132   echo "i: $i\ j: $j"
     133 end
     134
     135end
     136
     137# testing math on negative numbers
     138macro test8
     139
     140  local i
     141
     142  $i = -2 - -3
     143
     144 if ($i == 1)
    131145   $PASS = 1
    132146 else
     
    137151end
    138152
    139 # do we loop down in small steps correctly?
    140 macro test8
    141 
    142   local i
    143 
    144   $i = -2 - -3
    145 
    146  if ($i == 1)
    147    $PASS = 1
    148  else
    149    $PASS = 0
    150    echo "i: $i"
    151  end
    152 
    153 end
    154 
    155 # do we loop down in small steps correctly?
     153# testing the existance of variables
    156154macro test9
    157155
     
    237235end
    238236
     237# test local variables
     238macro test14
     239
     240 $PASS = 1
     241
     242 if (($?i == 1) || ($?N == 1))
     243  $PASS = 0
     244 end
     245end
     246
    239247# check memleaks (set global)
    240248macro testmem1
     
    495503 end
    496504end
    497 
Note: See TracChangeset for help on using the changeset viewer.