22import static org.junit.jupiter.api.Assertions.assertEquals;
23import static org.junit.jupiter.api.Assertions.assertFalse;
24import static org.junit.jupiter.api.Assertions.assertTrue;
28import org.junit.jupiter.api.Test;
29import org.junit.jupiter.api.io.TempDir;
31import denoptim.io.DenoptimIO;
41 private final String
SEP = System.getProperty(
"file.separator");
49 public void test() throws Exception
51 assertTrue(this.tempDir.isDirectory(),
"Should be a directory ");
52 String memoryFile =
tempDir.getAbsolutePath() +
SEP +
"test_memOnDisk";
53 String allData =
tempDir.getAbsolutePath() +
SEP +
"test_allData";
58 String base =
"entry";
60 for (
int i=0; i<tot; i++)
64 assertEquals(i+1,scs.
size(),
"Size of SCS after adding "+i);
67 for (
int i=0; i<tot; i++)
70 assertTrue(scs.
contains(s),
"Contains "+s);
78 assertEquals(line,base+j,
"Line saves in all data file");
Utility methods for input/output.
static ArrayList< String > readList(String fileName)
Read list of data as text.
Class meant to collect unique strings without leading to memory overflow.
synchronized int size()
Returns the number of unique entries.
synchronized boolean contains(String entry)
Checks if an entry is contained in this collection.
synchronized boolean addNewUniqueEntry(String entry)
Checks if the given entry is already container in the set of known entries and, if not,...
Unit test for SizeControlledSet.