Package autocomplete
Class AutocompleteTests
- java.lang.Object
-
- autocomplete.AutocompleteTests
-
- Direct Known Subclasses:
BinarySearchAutocompleteTests
,SequentialSearchAutocompleteTests
,TernarySearchTreeAutocompleteTests
,TreeSetAutocompleteTests
@TestInstance(PER_CLASS) public abstract class AutocompleteTests extends Object
Abstract class providing test cases for allAutocomplete
implementations.- See Also:
Autocomplete
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
AutocompleteTests.RuntimeExperiments
-
Field Summary
Fields Modifier and Type Field Description private List<String>
cities
Associating each city name to the importance weight of that city.private static int
MAX_CITIES
Maximum number of cities to parse.private static String
PATH
Path to the cities dataset.private Autocomplete
reference
Reference implementation of theAutocomplete
interface for comparison.private Autocomplete
testing
Testing implementation of theAutocomplete
interface for comparison.
-
Constructor Summary
Constructors Constructor Description AutocompleteTests()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) void
assertAllMatches(String prefix)
Asserts that the reference and testing implementations'allMatches
methods produce the same results ignoring order.(package private) void
comparePrefixSea()
(package private) void
compareRandomPrefixes()
abstract Autocomplete
createAutocomplete()
Returns an emptyAutocomplete
instance.(package private) void
setup()
-
-
-
Field Detail
-
MAX_CITIES
private static final int MAX_CITIES
Maximum number of cities to parse.- See Also:
- Constant Field Values
-
PATH
private static final String PATH
Path to the cities dataset.- See Also:
- Constant Field Values
-
cities
private final List<String> cities
Associating each city name to the importance weight of that city.
-
reference
private final Autocomplete reference
Reference implementation of theAutocomplete
interface for comparison.
-
testing
private final Autocomplete testing
Testing implementation of theAutocomplete
interface for comparison.
-
-
Method Detail
-
createAutocomplete
public abstract Autocomplete createAutocomplete()
Returns an emptyAutocomplete
instance.- Returns:
- an empty
Autocomplete
instance
-
setup
@BeforeAll void setup() throws IOException
- Throws:
IOException
-
comparePrefixSea
@Test void comparePrefixSea()
-
compareRandomPrefixes
@Test void compareRandomPrefixes()
-
assertAllMatches
void assertAllMatches(String prefix)
Asserts that the reference and testing implementations'allMatches
methods produce the same results ignoring order.- Parameters:
prefix
- the prefix string to pass toallMatches
-
-