Skip to content

GitLab

  • Menu
    • Projects Groups Snippets
      Help
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • P project05
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • cs2-22wi
  • project05
  • Merge requests
  • !2

An error occurred while fetching the assigned milestone of the selected merge_request.
The source project of this merge request has been removed.
Closed
Created 2 years ago by Adam Blank@blankOwner
  • Report abuse
Report abuse

First half test updates

  • Overview 0
  • Changes 6
  • Adam Blank @blank closed 2 years ago

    closed

  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
Compare
  • master (base)

and
  • latest version
    2dea24c3
    4 commits, 2 years ago

6 files
+ 45
- 5

    Preferences

    File browser
    Compare changes
.idea/runCo‎nfigurations‎
NGramTe‎sts.xml‎ +2 -0
src/edu/caltech/‎cs2/textgenerator‎
MarkovTextGe‎nerator.java‎ +0 -2
NGram‎.java‎ +0 -1
tests/edu/caltech/‎cs2/datastructures‎
IDictionaryNG‎ramTests.java‎ +12 -2
MoveToFrontDict‎ionaryTests.java‎ +18 -0
NGramTe‎sts.java‎ +13 -0
.idea/runConfigurations/NGramTests.xml
+ 2
- 0
  • View file @ 2dea24c3


Show all unchanged lines Show 20 lines
<option name="ENABLED" value="true" />
</pattern>
</extension>
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="19" />
<option name="PACKAGE_NAME" value="edu.caltech.cs2.datastructures" />
<option name="MAIN_CLASS_NAME" value="edu.caltech.cs2.datastructures.NGramTests" />
<option name="METHOD_NAME" value="" />
Show 20 lines Show all unchanged lines
src/edu/caltech/cs2/textgenerator/MarkovTextGenerator.java
+ 0
- 2
  • View file @ 2dea24c3


Show all unchanged lines Show 20 lines
import edu.caltech.cs2.datastructures.ChainingHashDictionary;
import edu.caltech.cs2.datastructures.IterableString;
import edu.caltech.cs2.datastructures.MoveToFrontDictionary;
import edu.caltech.cs2.datastructures.TrieMap;
import edu.caltech.cs2.interfaces.IDeque;
import edu.caltech.cs2.interfaces.IDictionary;
import java.io.*;
import java.util.Scanner;
import java.util.function.Function;
public class MarkovTextGenerator {
public static final String CORPUS_FILE = "data/seuss.txt";
Show 20 lines Show all unchanged lines
src/edu/caltech/cs2/textgenerator/NGram.java
+ 0
- 1
  • View file @ 2dea24c3


Show all unchanged lines Show 20 lines
import edu.caltech.cs2.interfaces.IDeque;
import java.util.Iterator;
public class NGram implements Iterable<String>, Comparable<NGram> {
public static final String NO_SPACE_BEFORE = ",?!.-,:'";
public static final String NO_SPACE_AFTER = "-'><=";
Show 20 lines Show all unchanged lines
tests/edu/caltech/cs2/datastructures/IDictionaryNGramTests.java
+ 12
- 2
  • View file @ 2dea24c3


package edu.caltech.cs2.datastructures;
import edu.caltech.cs2.helpers.DependsOn;
import edu.caltech.cs2.helpers.RuntimeInstrumentation;
import edu.caltech.cs2.helpers.TestDescription;
import edu.caltech.cs2.interfaces.IDictionary;
import edu.caltech.cs2.textgenerator.NGram;
import org.junit.jupiter.api.*;
Show 20 lines Show all unchanged lines Show 20 lines
@Order(sanityTestLevel)
@DisplayName("Test that keys are not compared using reference equality")
@Test
@TestDescription("This test checks if you are comparing the values of the keys, not the reference of the keys")
@DependsOn({"equals"})
public void testNoReferenceEquality() {
IDictionary<Object, Object> t = newIDictionary();
for (int i = 0; i < 10; i++) {
Show 20 lines Show all unchanged lines Show 20 lines
class ComplexityTestsNGram {
@Order(specialTestLevel)
@DisplayName("Test get() complexity with NGram keys")
@TestDescription("This test checks that the runtime complexity for get() in any IDictionary class is at most linear time")
@DependsOn({"get"})
@Test
@Timeout(value = 20, unit = SECONDS)
public void testGetComplexity() {
Show 20 lines Show all unchanged lines Show 20 lines
@Order(specialTestLevel)
@DisplayName("Test put() complexity with NGram keys")
@TestDescription("This test checks that the runtime complexity for put() in any IDictionary class is at most linear time")
@DependsOn({"put"})
@Test
@Timeout(value = 20, unit = SECONDS)
public void testPutComplexity() {
Show 20 lines Show all unchanged lines Show 20 lines
@Order(specialTestLevel)
@DisplayName("Test remove() complexity with NGram keys")
@TestDescription("This test checks that the runtime complexity for remove() in any IDictionary class is at most linear time")
@DependsOn({"remove"})
@Test
@Timeout(value = 20, unit = SECONDS)
public void testRemoveComplexity() {
Show 20 lines Show all unchanged lines Show 20 lines
@Order(specialTestLevel)
@DisplayName("Test size() complexity with NGram keys")
@Test
@TestDescription("This test checks that the runtime complexity for size() in any IDictionary class is constant time")
@DependsOn({"size"})
@Timeout(value = 20, unit = SECONDS)
public void testSizeComplexity() {
Function<Integer, IDictionary<Object, Object>> provide = (Integer numElements) -> {
Show 20 lines Show all unchanged lines
tests/edu/caltech/cs2/datastructures/MoveToFrontDictionaryTests.java
+ 18
- 0
  • View file @ 2dea24c3


Show all unchanged lines Show 20 lines
class RuntimeTestsBest {
@Order(specialTestLevel)
@DisplayName("Test get() best case complexity with int keys")
@TestDescription("This test checks that the runtime complexity for get() in any IDictionary class is at best contsant time")
@DependsOn({"get"})
@Test
@Timeout(value = 20, unit = SECONDS)
public void testBestCase() {
Show 20 lines Show all unchanged lines Show 20 lines
@Order(specialTestLevel)
@DisplayName("Test put() best case complexity with int keys")
@TestDescription("This test checks that the runtime complexity for put() in any IDictionary class is at best contsant time")
@DependsOn({"put"})
@Test
@Timeout(value = 20, unit = SECONDS)
public void testBestCasePut() {
Show 20 lines Show all unchanged lines Show 20 lines
class ImplementationTests {
@Order(classSpecificTestLevel)
@DisplayName("Check for linked node class")
@TestDescription("This test checks that hat there is a Node class in the MoveToFrontDictionary")
@Test
public void testLinkedNode() {
Class[] classes = MoveToFrontDictionary.class.getDeclaredClasses();
Show 20 lines Show all unchanged lines Show 20 lines
@Order(classSpecificTestLevel)
@DisplayName("Check MoveToFrontDictionary class is properly implemented")
@TestDescription("This test makes sure that the implementation of the MoveToFront dictionary, i.e. like having the right fields")
@TestHint("MoveToFrontDictionary should only have a head node and an int field to store size")
@Test
public void checkMTF() {
MoveToFrontChecker.checkClass(MoveToFrontDictionary.class);
Show 20 lines Show all unchanged lines Show 20 lines
@Order(classSpecificTestLevel)
@DisplayName("Check for excessive node allocation in put")
@TestDescription("This test checks that no extra nodes are allocated in the put() method")
@DependsOn({"put"})
@Test
public void testForExcessiveNodeAllocationPut() {
NewNode.NUM_CALLS = 0;
Show 20 lines Show all unchanged lines Show 20 lines
@Order(classSpecificTestLevel)
@DisplayName("Check for excessive node allocation in get")
@TestDescription("This test checks that no extra nodes are allocated in the get() method")
@DependsOn({"get"})
@Test
public void testForExcessiveNodeAllocationGet() {
NewNode.NUM_CALLS = 0;
Show 20 lines Show all unchanged lines Show 20 lines
@Order(classSpecificTestLevel)
@DisplayName("Check for excessive Node allocation in remove")
@TestDescription("This test checks that no extra nodes are allocated in the remove() method")
@DependsOn({"remove"})
@Test
public void testForExcessiveNodeAllocationRemove() {
NewObjectArray.NUM_CALLS = 0;
Show 20 lines Show all unchanged lines Show 20 lines
@Test
@DisplayName("Sanity check that accessing keys in various locations in the dictionary works")
@TestDescription("This test tries to obtain and remove data from various parts of the dictionary (front, back) to make sure its accessible")
@Order(classSpecificTestLevel)
public void testDataLocations() {
MoveToFrontDictionary<Integer, Integer> impl = new MoveToFrontDictionary<>();
Show 20 lines Show all unchanged lines Show 20 lines
@Test
@DisplayName("Test that referencing a key moves it to the front")
@TestDescription("This test is checking the fundamental principle of the MoveToFrontDictionary - that when you access a key, it does get moved to the front")
@TestHint("Make sure to check that you update the node pointers correctly")
@Order(specialTestLevel)
public void testMoveToFrontProperty() {
MoveToFrontDictionary<Integer, Integer> impl = new MoveToFrontDictionary<>();
Show 20 lines Show all unchanged lines Show 20 lines
@Order(specialTestLevel)
@DisplayName("Test removing from the front has the desired behavior")
@TestDescription("This test makes sure that removing from the front updates the head and the rest of the linked list correctly")
@TestHint("Make sure you update your head field correctly in removal, and that if a key is removed, the MoveToFrontDictionary is able to recognize and handle that")
@Test
public void testFrontRemove() {
MoveToFrontDictionary<Integer, Integer> impl = new MoveToFrontDictionary<>();
Show 20 lines Show all unchanged lines
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Lock merge request
Unlocked
0
0 participants
Reference:
Source branch: first_half_test_updates

Menu

Projects Groups Snippets
Help