--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>net.sourceforge.phpeclipse.xdebug.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+#Fri Sep 07 14:46:23 PDT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.source=1.3
--- /dev/null
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Xdebug Test Fragment
+Bundle-SymbolicName: net.sourceforge.phpeclipse.xdebug.test
+Bundle-Version: 1.0.0
+Bundle-Vendor: PHPEclipse team
+Fragment-Host: net.sourceforge.phpeclipse.xdebug.core;bundle-version="0.0.0"
+Require-Bundle: org.junit
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
--- /dev/null
+package net.sourceforge.phpeclipse.xdebug.core;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+public class Base64Test extends TestCase {
+ private static final long SEED = 12345678;
+ private static Random s_random = new Random(SEED);
+
+ private byte[] createData(int length) throws Exception {
+ byte[] bytes = new byte[length];
+ s_random.nextBytes(bytes);
+ return bytes;
+ }
+
+ private void runStreamTest(int length) throws Exception {
+ byte[] data = createData(length);
+ ByteArrayOutputStream out_bytes = new ByteArrayOutputStream();
+ OutputStream out = new Base64.OutputStream(out_bytes);
+ out.write(data);
+ out.close();
+ byte[] encoded = out_bytes.toByteArray();
+ byte[] decoded = Base64.decode(encoded, 0, encoded.length);
+ assertTrue(Arrays.equals(data, decoded));
+
+ Base64.InputStream in = new Base64.InputStream(
+ new ByteArrayInputStream(encoded));
+ out_bytes = new ByteArrayOutputStream();
+ byte[] buffer = new byte[3];
+ for (int n = in.read(buffer); n > 0; n = in.read(buffer)) {
+ out_bytes.write(buffer, 0, n);
+ }
+ out_bytes.close();
+ in.close();
+ decoded = out_bytes.toByteArray();
+ assertTrue(Arrays.equals(data, decoded));
+ }
+
+ public void testStreams() throws Exception {
+ for (int i = 0; i < 100; ++i) {
+ runStreamTest(i);
+ }
+ for (int i = 100; i < 2000; i += 250) {
+ runStreamTest(i);
+ }
+ for (int i = 2000; i < 80000; i += 1000) {
+ runStreamTest(i);
+ }
+ }
+}