This commit is contained in:
2026-03-18 00:39:35 -07:00
commit b4fdc98f10
43 changed files with 85012 additions and 0 deletions

40
debugging/Testing.java Normal file
View File

@@ -0,0 +1,40 @@
import org.junit.jupiter.api.*;
import static org.junit.jupiter.api.Assertions.*;
import java.util.*;
public class Testing {
@Test
@DisplayName("EXAMPLE TEST CASE - createIndex Example")
public void firstCaseTest() {
List<String> documents = new ArrayList<>(List.of("The Bee Movie is great!",
"I love the Bee Movie",
"Y'all seen Dune 2?"));
Map<String, Set<String>> index = InvertedIndex.createIndex(documents);
// Make sure that tokens are correctly converted to lower case
assertTrue(index.containsKey("bee"));
assertFalse(index.containsKey("Bee"));
// Make sure that punctuation is ignored
assertTrue(index.containsKey("great!"));
assertFalse(index.containsKey("great"));
// Check one of the sets
assertEquals(Set.of("The Bee Movie is great!",
"I love the Bee Movie"),
index.get("movie"));
}
@Test
@DisplayName("EXAMPLE TEST CASE - Book 2 String constructor + getters")
public void secondCaseTest() {
Book b = new Book("Title", "Author");
// Test all getters after constructing with 2 Strings
assertEquals("Title", b.getTitle());
assertEquals(List.of("Author"), b.getArtists());
assertEquals(0, b.getNumRatings());
assertEquals(0.0, b.getAverageRating());
}
}