%!PS % begin library code /test { /test.count test.count 1 add def { /test.pass test.pass 1 add def } { ( ) print test.count (....) cvs print (-fail) print } ifelse } bind def /test.start { print (:) print /test.pass 0 def /test.count 0 def } bind def /test.end { ( ) print test.count 0 gt { (Passed ) print test.pass (...) cvs print (/) print test.count (...) cvs print ( \() print test.pass 100 mul test.count idiv (...) cvs print (%\)) print (\r\n) print } if } bind def % end library code /summation { 2 dict begin /ls exch def { ls length 1 eq { exit } if [ 1 1 ls length 1 sub { /s 0 def 1 exch 1 exch { ls exch get s add /s exch def } for s } for ] /ls exch def } loop ls 0 get end } bind def (summation) test.start [1 2 3 4 5] summation 42 eq test [1 3 5 7 9] summation 70 eq test test.end