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 allAutocompleteimplementations.- See Also:
Autocomplete
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classAutocompleteTests.RuntimeExperiments
-
Field Summary
Fields Modifier and Type Field Description private List<String>citiesAssociating each city name to the importance weight of that city.private static intMAX_CITIESMaximum number of cities to parse.private static StringPATHPath to the cities dataset.private AutocompletereferenceReference implementation of theAutocompleteinterface for comparison.private AutocompletetestingTesting implementation of theAutocompleteinterface 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) voidassertAllMatches(String prefix)Asserts that the reference and testing implementations'allMatchesmethods produce the same results ignoring order.(package private) voidcomparePrefixSea()(package private) voidcompareRandomPrefixes()abstract AutocompletecreateAutocomplete()Returns an emptyAutocompleteinstance.(package private) voidsetup()
-
-
-
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 theAutocompleteinterface for comparison.
-
testing
private final Autocomplete testing
Testing implementation of theAutocompleteinterface for comparison.
-
-
Method Detail
-
createAutocomplete
public abstract Autocomplete createAutocomplete()
Returns an emptyAutocompleteinstance.- Returns:
- an empty
Autocompleteinstance
-
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'allMatchesmethods produce the same results ignoring order.- Parameters:
prefix- the prefix string to pass toallMatches
-
-