package tlc2.tool.queue;

import java.io.File;

import tlc2.tool.TLCState;

public class DiskStateQueueTest extends StateQueueTest {

	private File file;

	/* (non-Javadoc)
	 * @see tlc2.tool.queue.StateQueueTest#setUp()
	 */
	protected void setUp() throws Exception {
		super.setUp();

		// create a temp folder in java.io.tmpdir and have it deleted on VM exit
		final String diskdir = System.getProperty("java.io.tmpdir") + File.separator + "MultiDiskStateQueueTest_"
				+ System.currentTimeMillis();
		file = new File(diskdir);
		file.mkdirs();
		file.deleteOnExit();
		
		sQueue = new DiskStateQueue(diskdir);
	}
	
	// add Integer.MAX_VALUE states and check growth of MultiStateQueue. 
	// Reuse the same state to speed up instantiation and space requirements
	public void testGrowBeyondIntMaxValue() {
		final TLCState state = new DummyTLCState();

		final long j = Integer.MAX_VALUE + 1L;
		for (long i = 0; i < j; i++) {
			sQueue.sEnqueue(state);
		}
		assertTrue(sQueue.size() == j);
		
		file.delete();
	}
}

@@ -613,16 +613,312 @@
 );%0A%09%7D%0A%09%0A
+%09/* (non-Javadoc)%0A%09 * @see junit.framework.TestCase#tearDown()%0A%09 */%0A%09public void tearDown() %7B%0A%09%09// delete all nested files%0A%09%09final File%5B%5D listFiles = file.listFiles();%0A%09%09for (int i = 0; i %3C listFiles.length; i++) %7B%0A%09%09%09final File aFile = listFiles%5Bi%5D;%0A%09%09%09aFile.delete();%0A%09%09%7D%0A%09%09file.delete();%0A%09%7D%0A%09%0A
 %09// add 
@@ -1287,28 +1287,8 @@
 j);%0A
-%09%09%0A%09%09file.delete();%0A
 %09%7D%0A%7D

Remove test files after test execution