Changeset 10311 for trunk/Ohana/src/opihi/cmd.basic/test/sprintf.sh
- Timestamp:
- Nov 30, 2006, 9:02:30 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.basic/test/sprintf.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.basic/test/sprintf.sh
r6231 r10311 1 2 1 list tests 3 2 test1 4 test2 5 test3 6 test4 3 memtest1 7 4 end 8 5 6 # Does sprintf work? 9 7 macro 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 15 16 end 17 16 18 end 17 19 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 21 macro 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) 23 38 $PASS = 0 39 echo "growth: {$endmem-$startmem}" 40 echo "kB/loop: {($endmem-$startmem)/10000}" 24 41 end 42 25 43 end 26 27 macro test328 sprintf line "test %x" 3229 if ("$line" == "test 20")30 $PASS = 131 else32 $PASS = 033 end34 end35 36 macro test437 sprintf line "test %10s" foobar38 if ("$line" == "test foobar")39 $PASS = 140 else41 $PASS = 042 end43 end
Note:
See TracChangeset
for help on using the changeset viewer.
