package squeek.spiceoflife;

import static org.junit.Assert.assertTrue;
import org.junit.Test;
import squeek.spiceoflife.foodtracker.FoodEaten;
import squeek.spiceoflife.foodtracker.foodqueue.FixedHungerQueue;
import squeek.spiceoflife.foodtracker.foodqueue.FixedSizeQueue;

public class TestFixedQueues
{
	protected final FixedHungerQueue hungerQueue = new FixedHungerQueue(12);
	protected final FixedSizeQueue fixedQueue = new FixedSizeQueue(12);

	@Test
	public void testFixedHungerQueue()
	{
		for (int i=1; i<30; i++)
		{
			FoodEaten foodEaten = new FoodEaten();
			foodEaten.hungerRestored = i;
			hungerQueue.add(foodEaten);
			assertTrue(hungerQueue.hunger() <= 12);
		}
	}

	@Test
	public void testFixedSizeQueue()
	{
		for (int i=1; i<30; i++)
		{
			FoodEaten foodEaten = new FoodEaten();
			foodEaten.hungerRestored = i;
			fixedQueue.add(foodEaten);
			assertTrue(fixedQueue.size() <= 12);
		}
	}

}

@@ -53,26 +53,17 @@
 .Assert.
-assertTrue
+*
 ;%0Aimport
@@ -257,16 +257,126 @@
 zeQueue;
+%0Aimport squeek.spiceoflife.foodtracker.foodqueue.FixedTimeQueue;%0Aimport squeek.spiceoflife.helpers.MiscHelper;
 %0A%0Apublic
@@ -542,16 +542,84 @@
 eue(12);
+%0A%09protected final FixedTimeQueue timeQueue = new FixedTimeQueue(12);
 %0A%0A%09@Test
@@ -1066,18 +1066,18 @@
 %3C= 12);%0A
-
 %09%09%7D%0A%09%7D%0A%0A
 %7D%0A
@@ -1074,10 +1074,1000 @@
 %09%09%7D%0A%09%7D%0A%0A
+%09@Test%0A%09public void testFixedTimeQueue()%0A%09%7B%0A%09%09ModConfig.PROGRESS_TIME_WHILE_LOGGED_OFF = false;%0A%09%09%0A%09%09for (int i=1; i%3C30; i++)%0A%09%09%7B%0A%09%09%09FoodEaten foodEaten = new FoodEaten();%0A%09%09%09foodEaten.hungerRestored = i;%0A%09%09%09timeQueue.add(foodEaten);%0A%09%09%09assertTrue(timeQueue.size() == i);%0A%09%09%7D%0A%09%09%0A%09%09timeQueue.prune(0,0);%0A%09%09assertEquals(29, timeQueue.size());%0A%09%09timeQueue.prune(12*MiscHelper.TICKS_PER_DAY,0);%0A%09%09assertEquals(29, timeQueue.size());%0A%09%09timeQueue.prune(0,12*MiscHelper.TICKS_PER_DAY);%0A%09%09assertEquals(0, timeQueue.size());%0A%0A%09%09ModConfig.PROGRESS_TIME_WHILE_LOGGED_OFF = true;%0A%09%09%0A%09%09for (int i=1; i%3C30; i++)%0A%09%09%7B%0A%09%09%09FoodEaten foodEaten = new FoodEaten();%0A%09%09%09foodEaten.hungerRestored = i;%0A%09%09%09timeQueue.add(foodEaten);%0A%09%09%09assertTrue(timeQueue.size() == i);%0A%09%09%7D%0A%0A%09%09timeQueue.prune(0,0);%0A%09%09assertEquals(29, timeQueue.size());%0A%09%09timeQueue.prune(0,12*MiscHelper.TICKS_PER_DAY);%0A%09%09assertEquals(29, timeQueue.size());%0A%09%09timeQueue.prune(12*MiscHelper.TICKS_PER_DAY,0);%0A%09%09assertEquals(0, timeQueue.size());%0A%09%7D%0A%0A
 %7D%0A

Add test for time-based queue