package edu.mit.anonauth;

import static org.junit.Assert.*;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.junit.Test;

public class SecretBoxTest extends SecretBox {
	
	public Point sample(BigInteger x) {
		throw new UnsupportedOperationException();
	}
	
	public List<BigInteger> getCoefficients() {
		throw new UnsupportedOperationException();
	}
	
	@Test
	public void test() {
		int r = 5;
		BigInteger c = BigInteger.valueOf(123);
		
		SecretBox a = randomSecretBox(r);
		List<Point> samples = new ArrayList<Point>();
		for (int i = 1; i <= r; i++) {
			samples.add(a.sample(BigInteger.valueOf(i)));
		}
		
		SecretBox b = fromPoints(samples);
		
		assertEquals(a.secret(), b.secret());
		assertTrue(Arrays.equals(a.secretHash(), b.secretHash()));
		assertTrue(Arrays.equals(a.hmac(c), b.hmac(c)));
	}
}

@@ -871,10 +871,271 @@
 )));%0A%09%7D%0A
+%09%0A%09@Test%0A%09public void testSecretHashLength() %7B%0A%09%09SecretBox b = randomSecretBox(5);%0A%09%09assertEquals(32, b.secretHash().length);%0A%09%7D%0A%09%0A%09@Test%0A%09public void testHmacLength() %7B%0A%09%09SecretBox b = randomSecretBox(5);%0A%09%09assertEquals(32, b.hmac(BigInteger.ZERO).length);%0A%09%7D%0A
 %7D%0A

Add tests to guarantee hash lengths