public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* Patch: New java.io.FilePermission.implies action tests
@ 2005-11-16 17:46 Gary Benson
  2005-11-16 17:49 ` Tom Tromey
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Gary Benson @ 2005-11-16 17:46 UTC (permalink / raw)
  To: mauve-patches

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]

Hi,

This patch adds tests for java.io.FilePermission.implies for all
possible combinations of actions.  It passes 100% with the patch
I mailed to classpath-patches this morning entitled "Patch:
java.io.FilePermission.implies checks reversed".

Cheers,
Gary

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1304 bytes --]

Index: gnu/testlet/java/io/FilePermission/simple.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/io/FilePermission/simple.java,v
retrieving revision 1.3
diff -u -r1.3 simple.java
--- gnu/testlet/java/io/FilePermission/simple.java	12 May 2004 13:43:21 -0000	1.3
+++ gnu/testlet/java/io/FilePermission/simple.java	16 Nov 2005 17:39:56 -0000
@@ -151,5 +151,32 @@
     catch (java.lang.IllegalArgumentException ex) {
       harness.check(true);
     }
+
+    harness.checkPoint("implies() action checking");
+    for (int i = 1; i < 1 << actions.length; i++) { 
+      for (int j = 1; j < 1 << actions.length; j++) {
+	FilePermission pi = new FilePermission("/tmp/p", makeActions(i));
+	FilePermission pj = new FilePermission("/tmp/p", makeActions(j));
+
+	harness.check(pi.implies(pj) == ((i & j) == j));
+      }
+    }
+  }
+
+  // stuff for implies action checking
+  private static String[] actions = {"read", "write", "execute", "delete"};
+  private static String makeActions(int mask)
+  {
+    String result = "";
+    for (int i = 0; i < actions.length; i++)
+      {
+	if ((mask & (1 << i)) != 0)
+	  {
+	    if (result.length() > 0)
+	      result += ",";
+	    result += actions[i];
+	  }
+      }
+    return result;
   }
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-11-17 16:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-16 17:46 Patch: New java.io.FilePermission.implies action tests Gary Benson
2005-11-16 17:49 ` Tom Tromey
2005-11-16 17:55   ` Gary Benson
2005-11-16 17:56     ` Tom Tromey
2005-11-16 17:54 ` Gary Benson
2005-11-17 16:45 ` FYI: New java.lang.SecurityManager tests Gary Benson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).