Class DrawingAutograder
- java.lang.Object
-
- Autograder
-
- DrawingAutograder
-
public class DrawingAutograder extends Autograder
Example child class of the Autograder. Has an additional test for comparing the output of using the StdDraw Library.- See Also:
Autograder
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class Autograder
Autograder.CallableMethod, Autograder.StopExitSecurityManager
-
-
Field Summary
-
Fields inherited from class Autograder
CHECKSTYLE_JAR, CHECKSTYLE_LISTEN_XML, CHECKSTYLE_XML, diffNum, maxScore, visibility
-
-
Constructor Summary
Constructors Constructor Description DrawingAutograder()The constructor of a drawing Autograder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddrawingContainsTest(java.lang.String p, shapes.DummyShape exp, java.lang.String inFile)Test to check whether the students code draws an expected shape.voiddrawingDiffTest(java.lang.String p, boolean size, boolean order, java.lang.String inFile)Test to check whether the students code draws all expected shapes.voiddrawingDiffTest(java.lang.String p, java.util.ArrayList<shapes.DummyShape> exp, boolean size, boolean order, java.lang.String inFile)Test to check whether the students code draws all expected shapes.voiddrawingShapeCountTest(java.lang.String p, int expCount, java.lang.String inFile)Test to check whether the students code draws at least an expected number of shapes.voiddrawingSizeTest(java.lang.String p, int expWidth, int expHeight, java.lang.String inFile)Test to check whether the students code sets the stddraw canvas to the expected size.-
Methods inherited from class Autograder
addConverter, addTestResult, addTestResult, classDoesNotHaveMultipleScanners, classDoesNotUseArrayList, classDoesNotUsePackages, comparisonTest, comparisonTests, compile, compTest, compTest, compTest, compTest, compTest, compTest, compTest, currentScore, diffFiles, getClasses, getMethod, getMethod, getModifiers, getVisibility, hasConstructorTest, hasConstructorTest, hasFieldTest, hasFieldTest, hasMethodsTest, hasMethodTest, hasMethodTest, hasOverriddenMethodTest, hasOverriddenMethodTest, junitTests, logFileDiffTest, logFileDiffTests, logFileDiffTests, runMethodWithTimeout, setScore, setTimeout, setVisibility, stackTraceToString, stdOutDiffTest, stdOutDiffTests, stdOutDiffTests, testCheckstyle, testCompiles, testConstructorCount, testMethodCount, testPublicInstanceVariables, testRunFinished, testRunFinished, testSortedCheckstyle, testSourceExists
-
-
-
-
Method Detail
-
drawingDiffTest
public void drawingDiffTest(java.lang.String p, boolean size, boolean order, java.lang.String inFile)Test to check whether the students code draws all expected shapes. WARNING: A students code may be 100% correct and still not pass this test. This test only checks the lists of shapes and their colors. If a student uses a non-standard color (they calculate the RGB values themself) or use non-standard shapes (creating shapes using the polygon instead of the built in version) they may get the same output but fail the tests. The param size is to know whether to test where size matters (true if you want to compare size) and order is to know whether the order of the drawing matterss (this might be important to check layering)- Parameters:
p- the name of the students program to runsize- boolean false for size agnostic true for size dependent comparisonorder- boolean false for order agnostic true for order dependentinFile- the stdinput to be passed to the main method of the code
-
drawingDiffTest
public void drawingDiffTest(java.lang.String p, java.util.ArrayList<shapes.DummyShape> exp, boolean size, boolean order, java.lang.String inFile)Test to check whether the students code draws all expected shapes. WARNING: A students code may be 100% correct and still not pass this test. This test only checks the lists of shapes and their colors. If a student uses a non-standard color (they calculate the RGB values themself) or use non-standard shapes (creating shapes using the polygon instead of the built in version) they may get the same output but fail the tests. The param size is to know whether to test where size matters (true if you want to compare size) and order is to know whether the order of the drawing matterss (this might be important to check layering)- Parameters:
p- the name of the students program to runexp- a lists containing all the expected shapes that the program should makesize- boolean false for size agnostic true for size dependent comparisonorder- boolean false for order agnostic true for order dependentinFile- the stdinput to be passed to the main method of the code
-
drawingContainsTest
public void drawingContainsTest(java.lang.String p, shapes.DummyShape exp, java.lang.String inFile)Test to check whether the students code draws an expected shape.- Parameters:
p- the name of the students program to runexp- the shape the students code must containinFile- the std input to be passed to the main method of the code
-
drawingShapeCountTest
public void drawingShapeCountTest(java.lang.String p, int expCount, java.lang.String inFile)Test to check whether the students code draws at least an expected number of shapes. This could be a useful test as each shape can only be one color so there is a minimum number of shapes in order to possibly draw the whole image and if it is less than that amount then the submission must be missing part of the drawing.- Parameters:
p- the name of the students program to runexpCount- the number of shapes expected to have been drawninFile- the std input to be passed to the main method of the code
-
drawingSizeTest
public void drawingSizeTest(java.lang.String p, int expWidth, int expHeight, java.lang.String inFile)Test to check whether the students code sets the stddraw canvas to the expected size.- Parameters:
p- the name of the students program to runexpWidth- the desired width of the drawing canvasexpHeight- the desired height of the drawing canvasinFile- the std input to be passed to the main method of the code
-
-