acctest.ps 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. %!
  2. % Check that operators do their access tests correctly.
  3. % $Id: acctest.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
  4. % proc dotest => .
  5. /dotest
  6. {
  7. dup
  8. mark
  9. exch
  10. stopped not % False if error, true if no error.
  11. { (Allowed access: ) print cleartomark == }
  12. if
  13. clear
  14. }
  15. def
  16. 0 0 moveto % So the show commands don't bomb because of nocurrentpoint.
  17. { [1 2] executeonly aload } dotest
  18. { (string) executeonly (seek) anchorsearch } dotest
  19. { (string) (seek) executeonly anchorsearch } dotest
  20. { 100 101 (string) noaccess ashow} dotest
  21. { 100 1 array readonly astore } dotest
  22. { 100 101 102 103 104 (string) noaccess awidthshow } dotest
  23. { 1 dict noacess begin } dotest
  24. { 1 array executeonly 1 array copy } dotest
  25. { 1 array 1 array readonly copy } dotest
  26. { 1 dict noaccess 1 dict copy } dotest
  27. { 1 dict 1 dict readonly copy } dotest
  28. { 1 string executeonly 1 string copy } dotest
  29. { 1 string 1 string readonly copy } dotest
  30. { (100) executeonly cvi } dotest
  31. { (string) executeonly cvn } dotest
  32. { (100.001) executeonly cvr } dotest
  33. { 1 10 1 string readonly cvrs } dotest
  34. { true 5 string readonly cvs } dotest
  35. { 1 dict readonly begin /foo true def } dotest
  36. { 10 array readonly dictstack } dotest
  37. { 1 string executeonly 1 string eq } dotest
  38. { 1 string 1 string executeonly eq } dotest
  39. { 10 array readonly execstack } dotest
  40. { 1 string noaccess executeonly } dotest
  41. { 1 array noaccess executeonly } dotest
  42. { 1 array executeonly { pop } forall } dotest
  43. { 1 dict noaccess { pop pop } forall } dotest
  44. { 1 string executeonly { pop } forall } dotest
  45. { (string1) executeonly (string2) ge } dotest
  46. { (string1) (string2) executeonly ge } dotest
  47. { 1 array executeonly 0 get } dotest
  48. { 1 dict noaccess /key get } dotest
  49. { 1 string executeonly 0 get } dotest
  50. { 1 array executeonly 0 1 getinterval } dotest
  51. { 1 string executeonly 0 1 getinterval } dotest
  52. { (string1) executeonly (string2) gt } dotest
  53. { (string1) (string2) executeonly gt } dotest
  54. { 1 dict noaccess /key known } dotest
  55. { {} (string) executeonly kshow } dotest
  56. { (string1) executeonly (string2) le } dotest
  57. { (string1) (string2) executeonly le } dotest
  58. { 1 array executeonly length } dotest
  59. { 1 dict noaccess length } dotest
  60. { 1 string executeonly length } dotest
  61. %%{ /foo 1 dict def foo begin /bar foo def bar noaccess pop /key load } dotest
  62. { (string1) executeonly (string2) lt } dotest
  63. { (string1) (string2) executeonly lt } dotest
  64. { 1 dict noaccess maxlength } dotest
  65. { 1 string executeonly 1 string ne } dotest
  66. { 1 string 1 string executeonly ne } dotest
  67. %{ newpath 0 0 moveto (a) false charpath
  68. % {} {} {} {} pathforall closepath } dotest
  69. { 1 array executeonly 0 put } dotest
  70. { 1 dict noaccess /key put } dotest
  71. { 1 string executeonly 0 put } dotest
  72. { 1 array executeonly 0 1 putinterval } dotest
  73. { 1 string executeonly 0 1 putinterval } dotest
  74. { (access.ps) (r) file executeonly read } dotest
  75. { (access.ps) (r) file executeonly 10 string readhexstring } dotest
  76. { (access.ps) (r) file 10 string readonly readhexstring } dotest
  77. { (access.ps) (r) file executeonly 100 string readline } dotest
  78. { (access.ps) (r) file 100 string readonly readline } dotest
  79. { (access.ps) (r) file executeonly 10 string readstring } dotest
  80. { (access.ps) (r) file 10 string readonly readstring } dotest
  81. % run does not check for no read access?
  82. { (string) executeonly (seek) search } dotest
  83. { (string) (seek) executeonly search } dotest
  84. { (string) executeonly show }
  85. %% some test for store.
  86. { (string) executeonly stringwidth } dotest
  87. { (access.ps) (r) file executeonly token } dotest
  88. { (10) executeonly token } dotest
  89. { /foo 1 dict def foo begin /bar foo def bar noaccess pop /key where } dotest
  90. { 100 101 102 (string) noaccess widthshow } dotest
  91. { (/tmp/_.ps) noaccess (w) file closefile } dotest
  92. { (/tmp/_.ps) (w) noaccess file closefile } dotest
  93. { (/tmp/_.ps) (w) file executeonly 100 write } dotest
  94. { (/tmp/_.ps) (w) file executeonly 10 string writehexstring } dotest
  95. { (/tmp/_.ps) (w) file 10 string executeonly writehexstring } dotest
  96. { (/tmp/_.ps) (w) file executeonly 10 string writestring } dotest
  97. { (/tmp/_.ps) (w) file 10 string executeonly writestring } dotest