author | Jaroslav Tulach <jtulach@netbeans.org> |
Sat, 14 Jun 2008 09:53:48 +0200 | |
changeset 87 | 618b79994cd4 |
permissions | -rw-r--r-- |
jtulach@87 | 1 |
package org.apidesign.cycles.array.test; |
jtulach@87 | 2 |
|
jtulach@87 | 3 |
import org.apidesign.cycles.array.*; |
jtulach@87 | 4 |
import java.io.ByteArrayOutputStream; |
jtulach@87 | 5 |
import java.io.IOException; |
jtulach@87 | 6 |
import java.io.OutputStream; |
jtulach@87 | 7 |
import org.apidesign.cycles.crypt.Encryptor; |
jtulach@87 | 8 |
|
jtulach@87 | 9 |
public class Main { |
jtulach@87 | 10 |
public static void main(String[] args) throws Exception { |
jtulach@87 | 11 |
byte[] five = { 1, 2, 3, 4, 5 }; |
jtulach@87 | 12 |
MutableArray arr = new MutableArray(five); |
jtulach@87 | 13 |
|
jtulach@87 | 14 |
ByteArrayOutputStream os = new ByteArrayOutputStream(); |
jtulach@87 | 15 |
arr.encrypt(os); |
jtulach@87 | 16 |
|
jtulach@87 | 17 |
byte[] out = os.toByteArray(); |
jtulach@87 | 18 |
assert out.length == 5; |
jtulach@87 | 19 |
|
jtulach@87 | 20 |
for (int i = 0; i < 5; i++) { |
jtulach@87 | 21 |
int exp = five[i] ^ 0x3d; |
jtulach@87 | 22 |
if (exp != out[i]) { |
jtulach@87 | 23 |
assert false : "Index: " + i + " exp: " + exp + " was: " + out[i]; |
jtulach@87 | 24 |
} |
jtulach@87 | 25 |
} |
jtulach@87 | 26 |
System.err.println("OK"); |
jtulach@87 | 27 |
} |
jtulach@87 | 28 |
} |
jtulach@87 | 29 |