Tests: copy the EdDSA test.data file to where the classloader can find it

This commit is contained in:
str4d
2014-11-14 21:16:28 +00:00
parent 9104bd7304
commit a0bf8433e4
2 changed files with 7 additions and 3 deletions

View File

@ -128,6 +128,7 @@
<!-- EdDSA test vectors --> <!-- EdDSA test vectors -->
<copy todir="./build/obj"> <copy todir="./build/obj">
<fileset dir="./test/junit/"> <fileset dir="./test/junit/">
<include name="net/i2p/crypto/eddsa/test.data"/>
<include name="net/i2p/crypto/eddsa/math/baseDblPrecmp"/> <include name="net/i2p/crypto/eddsa/math/baseDblPrecmp"/>
<include name="net/i2p/crypto/eddsa/math/basePrecmp"/> <include name="net/i2p/crypto/eddsa/math/basePrecmp"/>
</fileset> </fileset>
@ -154,7 +155,7 @@
<!-- warning - The junit.test target below doesn't actually include i2ptest.jar in the classpath, <!-- warning - The junit.test target below doesn't actually include i2ptest.jar in the classpath,
only the build/obj directory. only the build/obj directory.
--> -->
<jar destfile="./build/i2ptest.jar" basedir="./build/obj" includes="**/*.class **/baseDblPrecmp **/basePrecmp" /> <jar destfile="./build/i2ptest.jar" basedir="./build/obj" includes="**/*.class **/test.data **/baseDblPrecmp **/basePrecmp" />
</target> </target>
<!-- preparation of code coverage tool of choice --> <!-- preparation of code coverage tool of choice -->
<target name="prepareClover" depends="compile" if="with.clover"> <target name="prepareClover" depends="compile" if="with.clover">

View File

@ -2,6 +2,7 @@ package net.i2p.crypto.eddsa;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -32,8 +33,10 @@ public class Ed25519TestVectors {
List<TestTuple> testCases = new ArrayList<TestTuple>(); List<TestTuple> testCases = new ArrayList<TestTuple>();
BufferedReader file = null; BufferedReader file = null;
try { try {
file = new BufferedReader(new InputStreamReader( InputStream is = Ed25519TestVectors.class.getResourceAsStream(fileName);
Ed25519TestVectors.class.getResourceAsStream(fileName))); if (is == null)
throw new IOException("Resource not found: " + fileName);
file = new BufferedReader(new InputStreamReader(is));
String line; String line;
while ((line = file.readLine()) != null) { while ((line = file.readLine()) != null) {
testCases.add(new TestTuple(line)); testCases.add(new TestTuple(line));