package edu.mit.anonauth;

import static org.junit.Assert.*;

import org.junit.Test;

public class ProtocolDoorTest extends ProtocolDoor {
	
	public ProtocolDoorTest() { super(2); }
	
    @Test
    public void testBasicExchange() {
    	int r = 5;
    	int user = 101;
    	
    	ProtocolDoor door = new ProtocolDoor(r);
    	ProtocolCard card = new ProtocolCard(door.privatePoints(user));
    	
    	byte[] broadcast = door.getBroadcast();
    	byte[] response = card.authenticate(broadcast);
    	assertTrue(door.checkResponse(response));
    }
}

@@ -220,16 +220,22 @@
 Exchange
+SmallR
 () %7B%0A   
@@ -267,139 +267,1354 @@
 r = 
-101;%0A    %09%0A    %09ProtocolDoor door = new ProtocolDoor(r);%0A    %09ProtocolCard card = new ProtocolCard(door.privatePoints(user));%0A    %09
+5001;%0A    %09%0A    %09ProtocolDoor door = new ProtocolDoor(r);%0A    %09ProtocolCard card = new ProtocolCard(door.privatePoints(user));%0A    %09assertTrue(exchange(door, card));%0A    %7D%0A    %0A    @Test%0A    public void testBasicExchangeLargeR() %7B%0A    %09int r = 500;%0A    %09int user = 5001;%0A    %09%0A    %09ProtocolDoor door = new ProtocolDoor(r);%0A    %09ProtocolCard card = new ProtocolCard(door.privatePoints(user));%0A    %09assertTrue(exchange(door, card));%0A    %7D%0A    %0A    @Test%0A    public void testRevocation() %7B%0A    %09int r = 5;%0A    %09int user = 5001;%0A    %09%0A    %09ProtocolDoor door = new ProtocolDoor(r);%0A    %09ProtocolCard card = new ProtocolCard(door.privatePoints(user));%0A    %09%0A    %09assertTrue(exchange(door, card));%0A    %09door.revoke(user);%0A    %09assertFalse(exchange(door, card));%0A    %7D%0A    %0A    @Test%0A    public void testRevocationMultiUser() %7B%0A    %09int r = 5;%0A    %09int userA = 5001;%0A    %09int userB = 5002;%0A    %09%0A    %09ProtocolDoor door = new ProtocolDoor(r);%0A    %09ProtocolCard cardA = new ProtocolCard(door.privatePoints(userA));%0A    %09ProtocolCard cardB = new ProtocolCard(door.privatePoints(userB));%0A    %09%0A    %09assertTrue(exchange(door, cardA));%0A    %09assertTrue(exchange(door, cardB));%0A    %09door.revoke(userB);%0A    %09assertTrue(exchange(door, cardA));%0A    %09assertFalse(exchange(door, cardB));%0A    %7D%0A    %0A    public boolean exchange(ProtocolDoor door, ProtocolCard card) %7B
 %0A   
@@ -1713,27 +1713,23 @@
 );%0A    %09
-assertTrue(
+return 
 door.che
@@ -1748,17 +1748,16 @@
 esponse)
-)
 ;%0A    %7D%0A

Add more complex protocol tests