openenvutils/commandshell/shell/test/scripts/printtest.sh
changeset 0 2e3d3ce01487
child 1 0fdb7f6b0309
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 # Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of the License "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 #
       
    15 
       
    16 init()
       
    17 {
       
    18     let totalno=0
       
    19     let passno=0
       
    20     let failno=0
       
    21 }
       
    22 
       
    23 test_print2()
       
    24 {
       
    25 let totalno=totalno+1
       
    26 echo "Test $totalno: print with a \"-aC <no_of_columns>\" option to print strings as <no_of_columns> columns per row"
       
    27 print -aC 3 ab cd ef gh ij kl mn
       
    28 ret=$?
       
    29 if [ $ret = 0 ]
       
    30 then
       
    31   echo "PASS"
       
    32   let passno=passno+1
       
    33  else
       
    34   echo "FAIL: Expected return value 0, but  returned $ret"
       
    35   let failno=failno+1
       
    36 fi
       
    37 }
       
    38 
       
    39 test_print3()
       
    40 {
       
    41 let totalno=totalno+1
       
    42 echo "Test $totalno: print with a -ac option to print strings as columns"
       
    43 print -ac 3 ab cd ef gh ij kl mn
       
    44 ret=$?
       
    45 if [ $ret = 0 ]
       
    46 then
       
    47   echo "PASS"
       
    48   let passno=passno+1
       
    49  else
       
    50   echo "FAIL: Expected return value 0, but  returned $ret"
       
    51   let failno=failno+1
       
    52 fi
       
    53 }
       
    54 
       
    55 test_print4()
       
    56 {
       
    57 let totalno=totalno+1
       
    58 echo "Test $totalno: print with a -o option to print strings in ascending order"
       
    59 sortedarray=(`print -o z y`)
       
    60 ret=$?
       
    61 if [ $ret = 0 ]
       
    62 then
       
    63   if [ $sortedarray[0] = y ] && [ $sortedarray[2] = z ]
       
    64     then
       
    65         echo "PASS"
       
    66         let passno=passno+1
       
    67     else
       
    68         echo "FAIL: Expected y z, but  returned $sortedarray"
       
    69         let failno=failno+1
       
    70     fi
       
    71  else
       
    72   echo "FAIL: Expected return value 0, but  returned $ret"
       
    73   let failno=failno+1
       
    74 fi
       
    75 }
       
    76 
       
    77 test_print5()
       
    78 {
       
    79 let totalno=totalno+1
       
    80 echo "Test $totalno: print with a -O option to print strings in descending order"
       
    81 sortedarray=(`print -O y z`)
       
    82 ret=$?
       
    83 if [ $ret = 0 ]
       
    84 then
       
    85   if [ $sortedarray[0] = z ] && [ $sortedarray[2] = y ]
       
    86     then
       
    87         echo "PASS"
       
    88         let passno=passno+1
       
    89     else
       
    90         echo "FAIL: Expected z y, but  returned $sortedarray"
       
    91         let failno=failno+1
       
    92     fi
       
    93  else
       
    94   echo "FAIL: Expected return value 0, but  returned $ret"
       
    95   let failno=failno+1
       
    96 fi
       
    97 }
       
    98 
       
    99 test_print6()
       
   100 {
       
   101 let totalno=totalno+1
       
   102 echo "Test $totalno: print with a -io option to print strings in ascending order case independently"
       
   103 sortedarray=(`print -io Yy yY`)
       
   104 ret=$?
       
   105 if [ $ret = 0 ]
       
   106 then
       
   107   if [ $sortedarray[0] = Yy ] && [ $sortedarray[2] = yY ]
       
   108     then
       
   109         echo "PASS"
       
   110         let passno=passno+1
       
   111     else
       
   112         echo "FAIL: Expected Yy yY, but  returned $sortedarray"
       
   113         let failno=failno+1
       
   114     fi
       
   115  else
       
   116   echo "FAIL: Expected return value 0, but  returned $ret"
       
   117   let failno=failno+1
       
   118 fi
       
   119 }
       
   120 
       
   121 test_print7()
       
   122 {
       
   123 let totalno=totalno+1
       
   124 echo "Test $totalno: print with a -iO option to print strings in descending order case independently"
       
   125 sortedarray=(`print -iO yY Yy`)
       
   126 ret=$?
       
   127 if [ $ret = 0 ]
       
   128 then
       
   129   if [ $sortedarray[0] = yY ] && [ $sortedarray[2] = Yy ]
       
   130     then
       
   131         echo "PASS"
       
   132         let passno=passno+1
       
   133     else
       
   134         echo "FAIL: Expected yY Yy, but  returned $sortedarray"
       
   135         let failno=failno+1
       
   136     fi
       
   137  else
       
   138   echo "FAIL: Expected return value 0, but  returned $ret"
       
   139   let failno=failno+1
       
   140 fi
       
   141 }
       
   142 
       
   143 test_print8()
       
   144 {
       
   145 let totalno=totalno+1
       
   146 echo "Test $totalno: print with a -l option to print strings in different lines"
       
   147 print -l p q
       
   148 ret=$?
       
   149 if [ $ret = 0 ]
       
   150 then
       
   151   echo "PASS"
       
   152   let passno=passno+1
       
   153  else
       
   154   echo "FAIL: Expected return value 0, but  returned $ret"
       
   155   let failno=failno+1
       
   156 fi
       
   157 }
       
   158 
       
   159 test_print9()
       
   160 {
       
   161 let totalno=totalno+1
       
   162 echo "Test $totalno: print with a -m option to print strings not containing a pattern"
       
   163 array=(`print -m'a' j a j j`)
       
   164 ret=$?
       
   165 if [ $ret = 0 ]
       
   166 then
       
   167   if [ $array[0] = j ] && [ $array[2] = j ]
       
   168     then
       
   169         echo "PASS"
       
   170         let passno=passno+1
       
   171     else
       
   172         echo "FAIL: Expected j j, but  returned $array"
       
   173         let failno=failno+1
       
   174     fi
       
   175  else
       
   176   echo "FAIL: Expected return value 0, but  returned $ret"
       
   177   let failno=failno+1
       
   178 fi
       
   179 }
       
   180 
       
   181 test_print10()
       
   182 {
       
   183 let totalno=totalno+1
       
   184 echo "Test $totalno: print with a -n option to print strings without inserting a line feed"
       
   185 array=(`print -n a b`)
       
   186 ret=$?
       
   187 if [ $ret = 0 ]
       
   188 then
       
   189   if [ $array[0] = a ] && [ $array[2] = b ]
       
   190     then
       
   191         echo "PASS"
       
   192         let passno=passno+1
       
   193     else
       
   194         echo "FAIL: Expected a b, but  returned $array"
       
   195         let failno=failno+1
       
   196     fi
       
   197  else
       
   198   echo "FAIL: Expected return value 0, but  returned $ret"
       
   199   let failno=failno+1
       
   200 fi
       
   201 }
       
   202 
       
   203 test_print11()
       
   204 {
       
   205 let totalno=totalno+1
       
   206 echo "Test $totalno: print with a -N option to print strings separated and terminated by nulls"
       
   207 res=(`print -N s y m b i a n`)
       
   208 ret=$?
       
   209 if [ $ret = 0 ]
       
   210 then
       
   211   if [ $res[0] = s ] && [ $res[2] = y ] && [ $res[3] = m ]
       
   212     then
       
   213         echo "PASS"
       
   214         let passno=passno+1
       
   215     else
       
   216         echo "FAIL: Expected symbian, but  returned \"$res\""
       
   217         let failno=failno+1
       
   218     fi
       
   219  else
       
   220   echo "FAIL: Expected return value 0, but  returned $ret"
       
   221   let failno=failno+1
       
   222 fi
       
   223 }
       
   224 
       
   225 
       
   226 test_print12()
       
   227 {
       
   228 let totalno=totalno+1
       
   229 echo "Test $totalno: print with a -P option to expand prompt"
       
   230 res=`print -P %c`
       
   231 ret=$?
       
   232 if [ $ret = 0 ]
       
   233 then
       
   234   if [ $res = `pwd` ]
       
   235     then
       
   236         echo "PASS"
       
   237         let passno=passno+1
       
   238     else
       
   239         echo "FAIL: Expected \"$cwd\", but  returned \"$res\""
       
   240         let failno=failno+1
       
   241     fi
       
   242  else
       
   243   echo "FAIL: Expected return value 0, but  returned $ret"
       
   244   let failno=failno+1
       
   245 fi
       
   246 }
       
   247 
       
   248 test_print13()
       
   249 {
       
   250 let totalno=totalno+1
       
   251 echo "Test $totalno: print with a -r option to ignore escape conventions of echo"
       
   252 res=`print -r hello`
       
   253 ret=$?
       
   254 if [ $ret = 0 ]
       
   255 then
       
   256   if [ $res = hello ]
       
   257     then
       
   258         echo "PASS"
       
   259         let passno=passno+1
       
   260     else
       
   261         echo "FAIL: Expected hello, but  returned \"$res\""
       
   262         let failno=failno+1
       
   263     fi
       
   264  else
       
   265   echo "FAIL: Expected return value 0, but  returned $ret"
       
   266   let failno=failno+1
       
   267 fi
       
   268 }
       
   269 
       
   270 test_print14()
       
   271 {
       
   272 let totalno=totalno+1
       
   273 echo "Test $totalno: print with a -R option to emulate BSD print which does not process escape sequences unless -e option is given"
       
   274 res=(`print -R -P %c`)
       
   275 ret=$?
       
   276 if [ $ret = 0 ]
       
   277 then
       
   278   if [ $res[0] = -P ] && [ $res[2] = %c ]
       
   279     then
       
   280         echo "PASS"
       
   281         let passno=passno+1
       
   282     else
       
   283         echo "FAIL: Expected -P %c, but  returned \"$res\""
       
   284         let failno=failno+1
       
   285     fi
       
   286  else
       
   287   echo "FAIL: Expected return value 0, but  returned $ret"
       
   288   let failno=failno+1
       
   289 fi
       
   290 }
       
   291 
       
   292 test_print15()
       
   293 {
       
   294 let totalno=totalno+1
       
   295 echo "Test $totalno: print with a -u option without file descriptor value"
       
   296 print -u hello
       
   297 ret=$?
       
   298 if [ $ret = 1 ]
       
   299 then
       
   300   echo "PASS"
       
   301   let passno=passno+1
       
   302  else
       
   303   echo "FAIL: Expected return value 1, but  returned $ret"
       
   304   let failno=failno+1
       
   305 fi
       
   306 }
       
   307 
       
   308 test_print16()
       
   309 {
       
   310 let totalno=totalno+1
       
   311 echo "Test $totalno: print with a -u option to write the argument string to a file descriptor"
       
   312 print -u 2 hello
       
   313 ret=$?
       
   314 if [ $ret = 0 ]
       
   315 then
       
   316    echo "PASS"
       
   317    let passno=passno+1
       
   318  else
       
   319   echo "FAIL: Expected return value 0, but  returned $ret"
       
   320   let failno=failno+1
       
   321 fi
       
   322 }
       
   323 
       
   324 #Test: Test print with -s option, to place the results in history 
       
   325 test_print17()
       
   326 {
       
   327 	let totalno=totalno+1
       
   328 	echo "Test $totalno: print with -s option, to place the results in history"
       
   329 	print -s Im history now
       
   330 	ret=$?
       
   331 	
       
   332 	if [ $ret = 0 ]
       
   333 	then
       
   334    		echo "PASS"
       
   335    		let passno=passno+1
       
   336  	else
       
   337   		echo "FAIL: Expected return value 0, but  returned $ret"
       
   338   		let failno=failno+1
       
   339 	fi
       
   340 }
       
   341 
       
   342 #Test: Test print with -z option, to place the results in editing buffer stack
       
   343 test_print18()
       
   344 {
       
   345     let totalno=totalno+1
       
   346     echo "Test $totalno: print with -z option, to place the results in editing buffer stack"
       
   347     print -z editing buffer stack
       
   348     ret=$?
       
   349 
       
   350     if [ $ret = 0 ]
       
   351     then
       
   352         echo "PASS"
       
   353         let passno=passno+1
       
   354     else
       
   355         echo "FAIL: Expected return value 0, but  returned $ret"
       
   356         let failno=failno+1
       
   357     fi
       
   358 }
       
   359 
       
   360 #Test: Test printf with format specifier %d 
       
   361 test_print19()
       
   362 {
       
   363     let totalno=totalno+1
       
   364     echo "Test $totalno: printf with format specifier %d "
       
   365     printf '%d\n' 628
       
   366     ret=$?
       
   367 
       
   368     if [ $ret = 0 ]
       
   369     then
       
   370         echo "PASS"
       
   371         let passno=passno+1
       
   372     else
       
   373         echo "FAIL: Expected return value 0, but  returned $ret"
       
   374         let failno=failno+1
       
   375     fi
       
   376 }
       
   377 
       
   378 #Test: Test printf with format specifier %g
       
   379 test_print20()
       
   380 {
       
   381     let totalno=totalno+1
       
   382     echo "Test $totalno: printf with format specifier %g "
       
   383     printf '%g\n' 172.82
       
   384     ret=$?
       
   385 
       
   386     if [ $ret = 0 ]
       
   387     then
       
   388         echo "PASS"
       
   389         let passno=passno+1
       
   390     else
       
   391         echo "FAIL: Expected return value 0, but  returned $ret"
       
   392         let failno=failno+1
       
   393     fi
       
   394 }
       
   395 
       
   396 
       
   397 #Test: Test printf with format specifier %<num>c
       
   398 test_print21()
       
   399 {
       
   400     let totalno=totalno+1
       
   401     echo "Test $totalno: printf with format specifier %<num>c "
       
   402     printf '%5c\n' x
       
   403     ret=$?
       
   404 
       
   405     if [ $ret = 0 ]
       
   406     then
       
   407         echo "PASS"
       
   408         let passno=passno+1
       
   409     else
       
   410         echo "FAIL: Expected return value 0, but  returned $ret"
       
   411         let failno=failno+1
       
   412     fi
       
   413 }
       
   414 
       
   415 #Test: Test printf with format specifier %.<num>s to chop the string
       
   416 test_print22()
       
   417 {
       
   418     let totalno=totalno+1
       
   419     echo "Test $totalno: printf with format specifier %.<num>s to chop the string"
       
   420     printf '%.5s\n' Trim_the_end
       
   421     ret=$?
       
   422 
       
   423     if [ $ret = 0 ]
       
   424     then
       
   425         echo "PASS"
       
   426         let passno=passno+1
       
   427     else
       
   428         echo "FAIL: Expected return value 0, but  returned $ret"
       
   429         let failno=failno+1
       
   430     fi
       
   431 }
       
   432 
       
   433 
       
   434 #Test: Test printf with format specifier %*.*f
       
   435 test_print23()
       
   436 {
       
   437     let totalno=totalno+1
       
   438     echo "Test $totalno: printf with format specifier %*.*f"
       
   439     printf '%*.*f\n' 4 1 1283.526
       
   440     ret=$?
       
   441 
       
   442     if [ $ret = 0 ]
       
   443     then
       
   444         echo "PASS"
       
   445         let passno=passno+1
       
   446     else
       
   447         echo "FAIL: Expected return value 0, but  returned $ret"
       
   448         let failno=failno+1
       
   449     fi
       
   450 }
       
   451 
       
   452 #Test: Test printf with invalid format specifier 
       
   453 test_print24()
       
   454 {
       
   455     let totalno=totalno+1
       
   456     echo "Test $totalno: printf with invalid format specifier"
       
   457     printf '%y' fgsdf
       
   458     ret=$?
       
   459 
       
   460     if [ $ret = 1 ]
       
   461     then
       
   462         echo "PASS"
       
   463         let passno=passno+1
       
   464     else
       
   465         echo "FAIL: Expected return value 0, but  returned $ret"
       
   466         let failno=failno+1
       
   467     fi
       
   468 }
       
   469 
       
   470 #Test: Test printf with bad math expression
       
   471 test_print25()
       
   472 {
       
   473     let totalno=totalno+1
       
   474     echo "Test $totalno: printf with bad math expression"
       
   475     printf '%d\n' 9u
       
   476     ret=$?
       
   477 
       
   478     if [ $ret = 1 ]
       
   479     then
       
   480         echo "PASS"
       
   481         let passno=passno+1
       
   482     else
       
   483         echo "FAIL: Expected return value 0, but  returned $ret"
       
   484         let failno=failno+1
       
   485     fi
       
   486 }
       
   487 
       
   488 #Test: Test printf with no arguments and %d as format specifier
       
   489 test_print26()
       
   490 {
       
   491     let totalno=totalno+1
       
   492     echo "Test $totalno: printf with no arguments and %d as format specifier"
       
   493     printf '%d\n'
       
   494     ret=$?
       
   495 
       
   496     if [ $ret = 0 ]
       
   497     then
       
   498         echo "PASS"
       
   499         let passno=passno+1
       
   500     else
       
   501         echo "FAIL: Expected return value 0, but  returned $ret"
       
   502         let failno=failno+1
       
   503     fi
       
   504 }
       
   505 
       
   506 #Test: Test printf with initial -- before format specifier printf ignores --
       
   507 test_print27()
       
   508 {
       
   509     let totalno=totalno+1
       
   510     echo "Test $totalno: printf with initial -- before format specifier. printf ignores --"
       
   511     printf -- '%s\n' Hello
       
   512     ret=$?
       
   513 
       
   514     if [ $ret = 0 ]
       
   515     then
       
   516         echo "PASS"
       
   517         let passno=passno+1
       
   518     else
       
   519         echo "FAIL: Expected return value 0, but  returned $ret"
       
   520         let failno=failno+1
       
   521     fi
       
   522 }
       
   523 
       
   524 #Test: Test print with -D option
       
   525 test_print28()
       
   526 {
       
   527     let totalno=totalno+1
       
   528     echo "Test $totalno: print with -D option"
       
   529     print -D "${HOME}"
       
   530     ret=$?
       
   531 
       
   532     if [ $ret = 1 ]
       
   533     then
       
   534         echo "PASS"
       
   535         let passno=passno+1
       
   536     else
       
   537         echo "FAIL: Expected return value 0, but  returned $ret"
       
   538         let failno=failno+1
       
   539     fi
       
   540 }
       
   541 
       
   542 #Test: Test print -m option with bad pattern specified
       
   543 test_print29()
       
   544 {
       
   545     let totalno=totalno+1
       
   546     echo "Test $totalno: print -m option with bad pattern specified"
       
   547     print -m '[]' 8 9njk jkdd
       
   548     ret=$?
       
   549 
       
   550     if [ $ret = 1 ]
       
   551     then
       
   552         echo "PASS"
       
   553         let passno=passno+1
       
   554     else
       
   555         echo "FAIL: Expected return value 0, but  returned $ret"
       
   556         let failno=failno+1
       
   557     fi
       
   558 }
       
   559 
       
   560 
       
   561 #Test: Test printf with %b format specifier
       
   562 test_print30()
       
   563 {
       
   564     let totalno=totalno+1
       
   565     echo "Test $totalno: printf with %b format specifier"
       
   566     printf '%b' Hello'\n\t'World
       
   567     ret=$?
       
   568 
       
   569     if [ $ret = 0 ]
       
   570     then
       
   571         echo "PASS"
       
   572         let passno=passno+1
       
   573     else
       
   574         echo "FAIL: Expected return value 0, but  returned $ret"
       
   575         let failno=failno+1
       
   576     fi
       
   577 }
       
   578 
       
   579 #Test: Test printf with %q format specifier
       
   580 test_print31()
       
   581 {
       
   582     let totalno=totalno+1
       
   583     echo "Test $totalno: printf with %q format specifier"
       
   584     printf '%q' '\tHello\'
       
   585     ret=$?
       
   586 
       
   587     if [ $ret = 0 ]
       
   588     then
       
   589         echo "PASS"
       
   590         let passno=passno+1
       
   591     else
       
   592         echo "FAIL: Expected return value 0, but  returned $ret"
       
   593         let failno=failno+1
       
   594     fi
       
   595 }
       
   596 
       
   597 #Test: Test printf with %x format specifier
       
   598 test_print32()
       
   599 {
       
   600     let totalno=totalno+1
       
   601     echo "Test $totalno: printf with %x format specifier"
       
   602     printf '%x' 10
       
   603     ret=$?
       
   604 
       
   605     if [ $ret = 0 ]
       
   606     then
       
   607         echo "PASS"
       
   608         let passno=passno+1
       
   609     else
       
   610         echo "FAIL: Expected return value 0, but  returned $ret"
       
   611         let failno=failno+1
       
   612     fi
       
   613 }
       
   614 
       
   615 #Test: Test printf with %X format specifier
       
   616 test_print33()
       
   617 {
       
   618     let totalno=totalno+1
       
   619     echo "Test $totalno: printf with %X format specifier"
       
   620     printf '%X' 10
       
   621     ret=$?
       
   622 
       
   623     if [ $ret = 0 ]
       
   624     then
       
   625         echo "PASS"
       
   626         let passno=passno+1
       
   627     else
       
   628         echo "FAIL: Expected return value 0, but  returned $ret"
       
   629         let failno=failno+1
       
   630     fi
       
   631 }
       
   632 
       
   633 #Test: Test printf with %E format specifier
       
   634 test_print34()
       
   635 {
       
   636     let totalno=totalno+1
       
   637     echo "Test $totalno: printf with %E format specifier"
       
   638     printf '%.1E' 1021.2823
       
   639     ret=$?
       
   640 
       
   641     if [ $ret = 0 ]
       
   642     then
       
   643         echo "PASS"
       
   644         let passno=passno+1
       
   645     else
       
   646         echo "FAIL: Expected return value 0, but returned $ret"
       
   647         let failno=failno+1
       
   648     fi
       
   649 }
       
   650 
       
   651 #Test: Test printf with out of range %n$ format specifier
       
   652 test_print35()
       
   653 {
       
   654     let totalno=totalno+1
       
   655     echo "Test $totalno: printf with out of range %n$ format specifier"
       
   656     printf '%20$d' 9 28
       
   657     ret=$?
       
   658 
       
   659     if [ $ret = 1 ]
       
   660     then
       
   661         echo "PASS"
       
   662         let passno=passno+1
       
   663     else
       
   664         echo "FAIL: Expected return value 1, but returned $ret"
       
   665         let failno=failno+1
       
   666     fi
       
   667 }
       
   668 
       
   669 #Test: Test print with -R -en option to emulate BSD echo command
       
   670 test_print36()
       
   671 {
       
   672     let totalno=totalno+1
       
   673     echo "Test $totalno: print with -R -en option to emulate BSD echo command"
       
   674     print -R -en Hello\\nWorld
       
   675     ret=$?
       
   676 
       
   677     if [ $ret = 0 ]
       
   678     then
       
   679         echo "PASS"
       
   680         let passno=passno+1
       
   681     else
       
   682         echo "FAIL: Expected return value 0, but returned $ret"
       
   683         let failno=failno+1
       
   684     fi
       
   685 }
       
   686 
       
   687 #Test: Test print with -R -En option to emulate BSD echo command
       
   688 test_print37()
       
   689 {
       
   690     let totalno=totalno+1
       
   691     echo "Test $totalno: print with -R -En option to emulate BSD echo command"
       
   692     print -R -E Hello\\nWorld
       
   693     ret=$?
       
   694 
       
   695     if [ $ret = 0 ]
       
   696     then
       
   697         echo "PASS"
       
   698         let passno=passno+1
       
   699     else
       
   700         echo "FAIL: Expected return value 0, but returned $ret"
       
   701         let failno=failno+1
       
   702     fi
       
   703 }
       
   704 
       
   705 #Test: Test print -aC with invalid number of columns
       
   706 test_print38()
       
   707 {
       
   708     let totalno=totalno+1
       
   709     echo "Test $totalno: print -aC with invalid number of columns"
       
   710     print -aC -9 jf 9 dk9 fk8 99dm
       
   711     ret=$?
       
   712 
       
   713     if [ $ret = 1 ]
       
   714     then
       
   715         echo "PASS"
       
   716         let passno=passno+1
       
   717     else
       
   718         echo "FAIL: Expected return value 1, but returned $ret"
       
   719         let failno=failno+1
       
   720     fi
       
   721 }
       
   722 
       
   723 #Test: Test print -aC with non numerical argument for columns
       
   724 test_print39()
       
   725 {
       
   726     let totalno=totalno+1
       
   727     echo "Test $totalno: print -aC with non numerical argument for columns"
       
   728     print -aC a b c d e
       
   729     ret=$?
       
   730 
       
   731     if [ $ret = 1 ]
       
   732     then
       
   733         echo "PASS"
       
   734         let passno=passno+1
       
   735     else
       
   736         echo "FAIL: Expected return value 1, but returned $ret"
       
   737         let failno=failno+1
       
   738     fi
       
   739 }
       
   740 
       
   741 
       
   742 #Test: Test print with -p option, for 'bad file name' condition 
       
   743 test_print40()
       
   744 {
       
   745     let totalno=totalno+1
       
   746     echo "Test $totalno: print with -p option, for 'bad file name' condition"
       
   747     print -p coprocess
       
   748     ret=$?
       
   749 
       
   750     if [ $ret = 1 ]
       
   751     then
       
   752         echo "PASS"
       
   753         let passno=passno+1
       
   754     else
       
   755         echo "FAIL: Expected return value 1, but returned $ret"
       
   756         let failno=failno+1
       
   757     fi
       
   758 }
       
   759 
       
   760 #Test: Test print with -C option, not along with -a option
       
   761 test_print41()
       
   762 {
       
   763     let totalno=totalno+1
       
   764     echo "Test $totalno: print with -C option, not along with -a option"
       
   765     print -C 4 a b c d e f
       
   766     ret=$?
       
   767 
       
   768     if [ $ret = 0 ]
       
   769     then
       
   770         echo "PASS"
       
   771         let passno=passno+1
       
   772     else
       
   773         echo "FAIL: Expected return value 0, but returned $ret"
       
   774         let failno=failno+1
       
   775     fi
       
   776 }
       
   777 
       
   778 #Test: Test print with -c option, not along with -a option
       
   779 test_print42()
       
   780 {
       
   781     let totalno=totalno+1
       
   782     echo "Test $totalno: print with -c option, not along with -a option"
       
   783     print -c a b c d e f
       
   784     ret=$?
       
   785 
       
   786     if [ $ret = 0 ]
       
   787     then
       
   788         echo "PASS"
       
   789         let passno=passno+1
       
   790     else
       
   791         echo "FAIL: Expected return value 0, but returned $ret"
       
   792         let failno=failno+1
       
   793     fi
       
   794 }
       
   795 
       
   796 #Test: Test printf with format specifier %i
       
   797 test_print43()
       
   798 {
       
   799     let totalno=totalno+1
       
   800     echo "Test $totalno: printf with format specifier %i"
       
   801     printf '%i\n' 65
       
   802     ret=$?
       
   803 
       
   804     if [ $ret = 0 ]
       
   805     then
       
   806         echo "PASS"
       
   807         let passno=passno+1
       
   808     else
       
   809         echo "FAIL: Expected return value 0, but  returned $ret"
       
   810         let failno=failno+1
       
   811     fi
       
   812 }
       
   813 
       
   814 #Test: Test printf with format specifier %o
       
   815 test_print44()
       
   816 {
       
   817     let totalno=totalno+1
       
   818     echo "Test $totalno: printf with format specifier %o"
       
   819     printf '%o\n' 15
       
   820     ret=$?
       
   821 
       
   822     if [ $ret = 0 ]
       
   823     then
       
   824         echo "PASS"
       
   825         let passno=passno+1
       
   826     else
       
   827         echo "FAIL: Expected return value 0, but  returned $ret"
       
   828         let failno=failno+1
       
   829     fi
       
   830 }
       
   831 
       
   832 #Test: Test printf with format specifier %u
       
   833 test_print45()
       
   834 {
       
   835     let totalno=totalno+1
       
   836     echo "Test $totalno: printf with format specifier %u"
       
   837     printf '%u\n' 15128121
       
   838     ret=$?
       
   839 
       
   840     if [ $ret = 0 ]
       
   841     then
       
   842         echo "PASS"
       
   843         let passno=passno+1
       
   844     else
       
   845         echo "FAIL: Expected return value 0, but  returned $ret"
       
   846         let failno=failno+1
       
   847     fi
       
   848 }
       
   849 
       
   850 #Test: Test printf with format specifier %G
       
   851 test_print46()
       
   852 {
       
   853     let totalno=totalno+1
       
   854     echo "Test $totalno: printf with format specifier %G"
       
   855     printf '%G\n' 15128121
       
   856     ret=$?
       
   857 
       
   858     if [ $ret = 0 ]
       
   859     then
       
   860         echo "PASS"
       
   861         let passno=passno+1
       
   862     else
       
   863         echo "FAIL: Expected return value 0, but  returned $ret"
       
   864         let failno=failno+1
       
   865     fi
       
   866 }
       
   867 
       
   868 #Test: Test printf with format specifier %e
       
   869 test_print47()
       
   870 {
       
   871     let totalno=totalno+1
       
   872     echo "Test $totalno: printf with format specifier %e"
       
   873     printf '%e\n' 123.3456
       
   874     ret=$?
       
   875 
       
   876     if [ $ret = 0 ]
       
   877     then
       
   878         echo "PASS"
       
   879         let passno=passno+1
       
   880     else
       
   881         echo "FAIL: Expected return value 0, but  returned $ret"
       
   882         let failno=failno+1
       
   883     fi
       
   884 }
       
   885 
       
   886 
       
   887 report()
       
   888     {
       
   889     echo "---------------------------------------------------------"
       
   890     echo "Total tests   : $totalno"
       
   891     echo "Passed tests  : $passno"
       
   892     echo "Failed tests  : $failno"
       
   893     echo "---------------------------------------------------------"
       
   894     }
       
   895 
       
   896 init
       
   897 test_print2
       
   898 test_print3
       
   899 test_print4
       
   900 test_print5
       
   901 test_print6
       
   902 test_print7
       
   903 test_print8
       
   904 test_print9
       
   905 # test_print10
       
   906 # test_print11
       
   907 test_print12
       
   908 test_print13
       
   909 test_print14
       
   910 test_print15
       
   911 test_print16
       
   912 test_print17
       
   913 #test_print18
       
   914 test_print19
       
   915 test_print20
       
   916 test_print21
       
   917 test_print22
       
   918 test_print23
       
   919 test_print24
       
   920 test_print25
       
   921 test_print26
       
   922 test_print27
       
   923 test_print28
       
   924 test_print29
       
   925 test_print30
       
   926 test_print31
       
   927 test_print32
       
   928 test_print33
       
   929 test_print34
       
   930 test_print35
       
   931 test_print36 # Defect No: 55
       
   932 test_print37 # Defect No: 56
       
   933 test_print38
       
   934 test_print39
       
   935 test_print40
       
   936 test_print41
       
   937 test_print42
       
   938 test_print43
       
   939 test_print44
       
   940 test_print45
       
   941 test_print46
       
   942 test_print47
       
   943 report