[Htmlparser-cvs] htmlparser/src/org/htmlparser/tests/lexerTests StreamTests.java,1.13,1.14
Brought to you by:
derrickoswald
From: <der...@us...> - 2003-12-31 02:50:53
|
Update of /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/lexerTests In directory sc8-pr-cvs1:/tmp/cvs-serv23579/src/org/htmlparser/tests/lexerTests Modified Files: StreamTests.java Log Message: Add filter support to NodeList. Rework LinkExtractor and remove MailRipper and Robot example programs. Clean out docs directory. Index: StreamTests.java =================================================================== RCS file: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tests/lexerTests/StreamTests.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** StreamTests.java 8 Dec 2003 01:31:54 -0000 1.13 --- StreamTests.java 31 Dec 2003 02:50:50 -0000 1.14 *************** *** 97,137 **** { String link; - ArrayList bytes1; - ArrayList bytes2; URL url; ! URLConnection connection; BufferedInputStream in; ! int b; Stream stream; int index; // pick a big file ! link = "http://sourceforge.net/projects/htmlparser/HTMLParser_Coverage.html"; ! bytes1 = new ArrayList (); ! bytes2 = new ArrayList (); try { url = new URL (link); ! connection = url.openConnection (); ! connection.connect (); ! in = new BufferedInputStream (connection.getInputStream ()); ! while (-1 != (b = in.read ())) ! bytes1.add (new Byte ((byte)b)); ! in.close (); ! ! connection = url.openConnection (); ! connection.connect (); ! stream = new Stream (connection.getInputStream ()); ! while (-1 != (b = stream.read ())) ! bytes2.add (new Byte ((byte)b)); ! stream.close (); ! index = 0; ! while (index < bytes1.size ()) { ! assertEquals ("bytes differ at position " + index, bytes1.get (index), bytes2.get (index)); index++; } ! assertTrue ("extra bytes", index == bytes2.size ()); } catch (MalformedURLException murle) --- 97,132 ---- { String link; URL url; ! URLConnection connection1; ! URLConnection connection2; BufferedInputStream in; ! int b1; ! int b2; Stream stream; int index; // pick a big file ! link = "http://htmlparser.sourceforge.net/HTMLParser_Coverage.html"; try { url = new URL (link); ! connection1 = url.openConnection (); ! connection1.connect (); ! in = new BufferedInputStream (connection1.getInputStream ()); ! connection2 = url.openConnection (); ! connection2.connect (); ! stream = new Stream (connection2.getInputStream ()); index = 0; ! while (-1 != (b1 = in.read ())) { ! b2 = stream.read (); ! if (b1 != b2) ! fail ("bytes differ at position " + index + ", expected " + b1 + ", actual " + b2); index++; } ! b2 = stream.read (); ! stream.close (); ! in.close (); ! assertTrue ("extra bytes", b2 == -1); } catch (MalformedURLException murle) *************** *** 289,293 **** // pick a small file > 2000 bytes ! link = "http://sourceforge.net/projects/htmlparser/overview-summary.html"; bytes1 = new ArrayList (); bytes2 = new ArrayList (); --- 284,288 ---- // pick a small file > 2000 bytes ! link = "http://htmlparser.sourceforge.net/javadoc_1_3/overview-summary.html"; bytes1 = new ArrayList (); bytes2 = new ArrayList (); *************** *** 364,368 **** // pick a small file > 2000 bytes ! link = "http://sourceforge.net/projects/htmlparser/overview-summary.html"; bytes1 = new ArrayList (); bytes2 = new ArrayList (); --- 359,363 ---- // pick a small file > 2000 bytes ! link = "http://htmlparser.sourceforge.net/javadoc_1_3/overview-summary.html"; bytes1 = new ArrayList (); bytes2 = new ArrayList (); |