This is the mail archive of the mauve-patches@sources.redhat.com mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: More BufferedInputStream tests.


I just committed this:

2005-03-08 David Daney <ddaney@avtrex.com>

	* gnu/testlet/java/io/BufferedInputStream/MarkReset.java (marktest):
	Two testcases added for PR libgcj/20389.


I am currently testing my patch to libgcj to fix the problems.


David Daney.
? bis.d
? gc.diff
? ia.diff
? mauve-DAVE
? mauve-libjava
? gnu/testlet/.dirstamp
Index: gnu/testlet/java/io/BufferedInputStream/MarkReset.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/io/BufferedInputStream/MarkReset.java,v
retrieving revision 1.1
diff -c -p -r1.1 MarkReset.java
*** gnu/testlet/java/io/BufferedInputStream/MarkReset.java	26 Dec 1998 18:57:50 -0000	1.1
--- gnu/testlet/java/io/BufferedInputStream/MarkReset.java	8 Mar 2005 22:33:41 -0000
***************
*** 1,7 ****
  /*************************************************************************
  /* MarkReset.java -- Tests BufferedInputStream mark/reset functionality
  /*
! /* Copyright (c) 1998 Free Software Foundation, Inc.
  /* Written by Aaron M. Renn (arenn@urbanophile.com)
  /*
  /* This program is free software; you can redistribute it and/or modify
--- 1,7 ----
  /*************************************************************************
  /* MarkReset.java -- Tests BufferedInputStream mark/reset functionality
  /*
! /* Copyright (c) 1998, 2005 Free Software Foundation, Inc.
  /* Written by Aaron M. Renn (arenn@urbanophile.com)
  /*
  /* This program is free software; you can redistribute it and/or modify
*************** marktest(InputStream ins, TestHarness ha
*** 93,98 ****
--- 93,108 ----
  
    return(total_read);
  }
+   private static void readFully(InputStream in, int len) throws java.io.IOException
+   {
+     int nr;
+     byte[] buf = new byte[len];
+     while (len > 0) {
+       if ((nr = in.read(buf, 0, len)) <= 0)
+         throw new java.io.IOException("Unexpected EOF");
+       len -= nr;
+     }
+   }
  
  public void
  test(TestHarness harness)
*************** test(TestHarness harness)
*** 147,152 ****
--- 157,194 ----
        harness.debug(e);
        harness.check(false);
      }
+ 
+   try
+     {
+       harness.checkPoint("Third BufferedInputStream mark/reset series");
+       ByteArrayInputStream bais = new ByteArrayInputStream(new byte[100000]);
+       BufferedInputStream bis = new BufferedInputStream(bais, 2048);
+       bis.mark(2048);
+       readFully(bis, 2049);
+       harness.check(true);
+     }
+   catch (IOException e)
+     {
+       harness.debug(e);
+       harness.check(false);
+     }
+ 
+   try
+     {
+       harness.checkPoint("Forth BufferedInputStream mark/reset series");
+       ByteArrayInputStream bais = new ByteArrayInputStream(new byte[100000]);
+       BufferedInputStream bis = new BufferedInputStream(bais, 2048);
+       bis.mark(2050);
+       readFully(bis, 2050);
+       bis.mark(2052);
+       readFully(bis, 2052);
+       harness.check(true);
+     }
+   catch (IOException e)
+     {
+       harness.debug(e);
+       harness.check(false);
+     }
  } // main
  
  } // class MarkReset

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]