%!PS % begin included library code % see https://codeberg.org/Firedrake/postscript-libraries/ /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 /minmax { 0 dict begin /a exch def /l a dup length 1 sub get def /h l def 0 2 a length 2 sub { /i exch def a i get a i 1 add get 2 copy gt { exch } if h max /h exch def l min /l exch def } for [ l h ] end } bind def /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 % end included library code /maxdistance { minmax exch minmax aload pop 3 -1 roll aload pop 4 1 roll sub 3 1 roll sub max } bind def (maxdistance) test.start [4 5 7] [9 1 3 4] maxdistance 6 eq test [2 3 5 4] [3 2 5 5 8 7] maxdistance 6 eq test [2 1 11 3] [2 5 10 2] maxdistance 9 eq test [1 2 3] [3 2 1] maxdistance 2 eq test [1 0 2 3] [5 0] maxdistance 5 eq test test.end