Created
March 30, 2018 14:56
-
-
Save plumps/2973f00e339d46551db19749bb302a08 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Percolation | |
70/100 | |
Hide grader output | |
See the Assessment Guide for information on how to interpret this report. | |
ASSESSMENT SUMMARY | |
Compilation: PASSED | |
API: PASSED | |
Findbugs: PASSED | |
PMD: PASSED | |
Checkstyle: FAILED (0 errors, 11 warnings) | |
Correctness: 16/30 tests passed | |
Memory: 8/8 tests passed | |
Timing: 18/20 tests passed | |
Aggregate score: 70.00% | |
[Compilation: 5%, API: 5%, Findbugs: 0%, PMD: 0%, Checkstyle: 0%, Correctness: 60%, Memory: 10%, Timing: 20%] | |
ASSESSMENT DETAILS | |
The following files were submitted: | |
---------------------------------- | |
3.4K Mar 30 14:05 Percolation.java | |
2.2K Mar 30 14:05 PercolationStats.java | |
******************************************************************************** | |
* COMPILING | |
******************************************************************************** | |
% javac Percolation.java | |
*----------------------------------------------------------- | |
% javac PercolationStats.java | |
*----------------------------------------------------------- | |
================================================================ | |
Checking the APIs of your programs. | |
*----------------------------------------------------------- | |
Percolation: | |
PercolationStats: | |
================================================================ | |
******************************************************************************** | |
* CHECKING STYLE AND COMMON BUG PATTERNS | |
******************************************************************************** | |
% findbugs *.class | |
*----------------------------------------------------------- | |
================================================================ | |
% pmd . | |
*----------------------------------------------------------- | |
Percolation.java:5: The private instance (or static) variable 'auxGrid' can be made 'final'; it is initialized only in the declaration or constructor. [ImmutableField] | |
Percolation.java:5: The private instance (or static) variable 'grid' can be made 'final'; it is initialized only in the declaration or constructor. [ImmutableField] | |
Percolation.java:7: The private instance (or static) variable 'N' can be made 'final'; it is initialized only in the declaration or constructor. [ImmutableField] | |
PercolationStats.java:6: The private instance (or static) variable 'threshold' can be made 'final'; it is initialized only in the declaration or constructor. [ImmutableField] | |
PMD ends with 4 warnings. | |
================================================================ | |
% checkstyle *.java | |
*----------------------------------------------------------- | |
[WARN] Percolation.java:7:21: The instance variable 'N' must start with a lowercase letter and use camelCase. [MemberName] | |
[WARN] Percolation.java:10:28: The parameter variable 'N' must start with a lowercase letter and use camelCase. [ParameterName] | |
[WARN] Percolation.java:28:5: File contains tab characters (this is the first occurrence). Configure your editor to replace tabs with spaces. [FileTabCharacter] | |
[WARN] Percolation.java:29:19: '=' is not preceded with whitespace. [WhitespaceAround] | |
[WARN] Percolation.java:29:20: '=' is not followed by whitespace. [WhitespaceAround] | |
[WARN] Percolation.java:29:24: '<' is not preceded with whitespace. [WhitespaceAround] | |
[WARN] Percolation.java:29:25: '<' is not followed by whitespace. [WhitespaceAround] | |
[WARN] Percolation.java:30:26: Boolean expression can be simplified, e.g., use 'if (!isEmpty)' instead of 'if (isEmpty == false)'. [SimplifyBooleanExpression] | |
[WARN] PercolationStats.java:9:33: The parameter variable 'N' must start with a lowercase letter and use camelCase. [ParameterName] | |
[WARN] PercolationStats.java:9:40: The parameter variable 'T' must start with a lowercase letter and use camelCase. [ParameterName] | |
[WARN] PercolationStats.java:32:15: '//' or '/*' is not followed by whitespace. [WhitespaceAfter] | |
Checkstyle ends with 0 errors and 11 warning. | |
% custom checkstyle checks for Percolation.java | |
*----------------------------------------------------------- | |
[INFO] Percolation.java:29: Using a loop in this method might be a performance bug. [Performance] | |
% custom checkstyle checks for PercolationStats.java | |
*----------------------------------------------------------- | |
================================================================ | |
******************************************************************************** | |
* TESTING CORRECTNESS | |
******************************************************************************** | |
Testing correctness of Percolation | |
*----------------------------------------------------------- | |
Running 15 total tests. | |
Tests 1 through 8 create a Percolation object using your code, then repeatedly | |
open sites by calling open(). After each call to open(), it checks the return | |
values of isOpen(), percolates(), numberOfOpenSites(), and isFull() in that order. | |
Except as noted, a site is opened at most once. | |
Tests 13 through 15 test backwash. | |
Test 1: open predetermined list of sites using file inputs | |
* filename = input6.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = input8.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = input8-no.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = input10-no.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = greeting57.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = heart25.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
==> FAILED | |
Test 2: open random sites until just before system percolates | |
* n = 3 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 5 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 10 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 10 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 20 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 20 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 50 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 50 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
==> FAILED | |
Test 3: open predetermined sites for n = 1 and n = 2 (corner case test) | |
* filename = input1.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = input1-no.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = input2.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = input2-no.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
==> FAILED | |
Test 4: check predetermined sites with long percolating path | |
* filename = snake13.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = snake101.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
==> FAILED | |
Test 5: open every site | |
* filename = input5.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
==> FAILED | |
Test 6: open random sites until just before system percolates, | |
allowing open() to be called on a site more than once | |
* n = 3 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 5 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 10 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 10 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 20 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 20 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 50 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* n = 50 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
==> FAILED | |
Test 7: call methods with invalid arguments | |
* n = 10, (row, col) = (-1, 5) | |
- open() throws the wrong exception | |
- open() throws a java.lang.IndexOutOfBoundsException | |
- open() should throw a java.lang.IllegalArgumentException | |
- isOpen() throws the wrong exception | |
- isOpen() throws a java.lang.IndexOutOfBoundsException | |
- isOpen() should throw a java.lang.IllegalArgumentException | |
- isFull() throws the wrong exception | |
- isFull() throws a java.lang.IndexOutOfBoundsException | |
- isFull() should throw a java.lang.IllegalArgumentException | |
* n = 10, (row, col) = (11, 5) | |
- open() throws the wrong exception | |
- open() throws a java.lang.IndexOutOfBoundsException | |
- open() should throw a java.lang.IllegalArgumentException | |
- isOpen() throws the wrong exception | |
- isOpen() throws a java.lang.IndexOutOfBoundsException | |
- isOpen() should throw a java.lang.IllegalArgumentException | |
- isFull() throws the wrong exception | |
- isFull() throws a java.lang.IndexOutOfBoundsException | |
- isFull() should throw a java.lang.IllegalArgumentException | |
* n = 10, (row, col) = (0, 5) | |
- open() throws the wrong exception | |
- open() throws a java.lang.IndexOutOfBoundsException | |
- open() should throw a java.lang.IllegalArgumentException | |
- isOpen() throws the wrong exception | |
- isOpen() throws a java.lang.IndexOutOfBoundsException | |
- isOpen() should throw a java.lang.IllegalArgumentException | |
- isFull() throws the wrong exception | |
- isFull() throws a java.lang.IndexOutOfBoundsException | |
- isFull() should throw a java.lang.IllegalArgumentException | |
* n = 10, (row, col) = (5, -1) | |
- open() throws the wrong exception | |
- open() throws a java.lang.IndexOutOfBoundsException | |
- open() should throw a java.lang.IllegalArgumentException | |
- isOpen() throws the wrong exception | |
- isOpen() throws a java.lang.IndexOutOfBoundsException | |
- isOpen() should throw a java.lang.IllegalArgumentException | |
- isFull() throws the wrong exception | |
- isFull() throws a java.lang.IndexOutOfBoundsException | |
- isFull() should throw a java.lang.IllegalArgumentException | |
* n = 10, (row, col) = (5, 11) | |
- open() throws the wrong exception | |
- open() throws a java.lang.IndexOutOfBoundsException | |
- open() should throw a java.lang.IllegalArgumentException | |
- isOpen() throws the wrong exception | |
- isOpen() throws a java.lang.IndexOutOfBoundsException | |
- isOpen() should throw a java.lang.IllegalArgumentException | |
- isFull() throws the wrong exception | |
- isFull() throws a java.lang.IndexOutOfBoundsException | |
- isFull() should throw a java.lang.IllegalArgumentException | |
* n = 10, (row, col) = (5, 0) | |
- open() throws the wrong exception | |
- open() throws a java.lang.IndexOutOfBoundsException | |
- open() should throw a java.lang.IllegalArgumentException | |
- isOpen() throws the wrong exception | |
- isOpen() throws a java.lang.IndexOutOfBoundsException | |
- isOpen() should throw a java.lang.IllegalArgumentException | |
- isFull() throws the wrong exception | |
- isFull() throws a java.lang.IndexOutOfBoundsException | |
- isFull() should throw a java.lang.IllegalArgumentException | |
* n = 10, (row, col) = (-2147483648, -2147483648) | |
- open() throws the wrong exception | |
- open() throws a java.lang.IndexOutOfBoundsException | |
- open() should throw a java.lang.IllegalArgumentException | |
- isOpen() throws the wrong exception | |
- isOpen() throws a java.lang.IndexOutOfBoundsException | |
- isOpen() should throw a java.lang.IllegalArgumentException | |
- isFull() throws the wrong exception | |
- isFull() throws a java.lang.IndexOutOfBoundsException | |
- isFull() should throw a java.lang.IllegalArgumentException | |
* n = 10, (row, col) = (2147483647, 2147483647) | |
- open() throws the wrong exception | |
- open() throws a java.lang.IndexOutOfBoundsException | |
- open() should throw a java.lang.IllegalArgumentException | |
- isOpen() throws the wrong exception | |
- isOpen() throws a java.lang.IndexOutOfBoundsException | |
- isOpen() should throw a java.lang.IllegalArgumentException | |
- isFull() throws the wrong exception | |
- isFull() throws a java.lang.IndexOutOfBoundsException | |
- isFull() should throw a java.lang.IllegalArgumentException | |
==> FAILED | |
Test 8: call constructor with invalid argument | |
* n = -10 | |
- the constructor fails to throw an exception | |
- the constructor should throw a java.lang.IllegalArgumentException | |
* n = -1 | |
- the constructor fails to throw an exception | |
- the constructor should throw a java.lang.IllegalArgumentException | |
* n = 0 | |
- the constructor fails to throw an exception | |
- the constructor should throw a java.lang.IllegalArgumentException | |
==> FAILED | |
Test 9: create multiple Percolation objects at the same time | |
(to make sure you didn't store data in static variables) | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
==> FAILED | |
Test 10: open predetermined list of sites using file inputs, | |
but permute the order in which methods are called | |
* filename = input8.txt; order = isFull(), isOpen(), percolates() | |
* filename = input8.txt; order = isFull(), percolates(), isOpen() | |
* filename = input8.txt; order = isOpen(), isFull(), percolates() | |
* filename = input8.txt; order = isOpen(), percolates(), isFull() | |
* filename = input8.txt; order = percolates(), isOpen(), isFull() | |
* filename = input8.txt; order = percolates(), isFull(), isOpen() | |
==> passed | |
Test 11: call all methods in random order until just before system percolates | |
* n = 3 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
- failed on trial 1 of 40 | |
- sequence of operations was: | |
percolation.percolates() | |
percolation.isOpen(row, col) for each row and col | |
percolation.numberOfOpenSites() | |
* n = 5 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
- failed on trial 1 of 20 | |
- sequence of operations was: | |
percolation.isOpen(row, col) for each row and col | |
percolation.numberOfOpenSites() | |
* n = 7 | |
- numberOfOpenSites() returns wrong value after 3 sites opened | |
- student numberOfOpenSites() = 5 | |
- reference numberOfOpenSites() = 3 | |
- failed on trial 1 of 10 | |
- sequence of operations was: | |
percolation.percolates() | |
percolation.open(5, 2) | |
percolation.open(2, 2) | |
percolation.open(3, 1) | |
percolation.isFull(row, col) for each row and col | |
percolation.isFull(row, col) for each row and col | |
percolation.isOpen(row, col) for each row and col | |
percolation.numberOfOpenSites() | |
* n = 10 | |
- numberOfOpenSites() returns wrong value after 2 sites opened | |
- student numberOfOpenSites() = 4 | |
- reference numberOfOpenSites() = 2 | |
- failed on trial 1 of 5 | |
- sequence of operations was: | |
percolation.isFull(row, col) for each row and col | |
percolation.open(6, 9) | |
percolation.isOpen(row, col) for each row and col | |
percolation.percolates() | |
percolation.isOpen(row, col) for each row and col | |
percolation.isFull(row, col) for each row and col | |
percolation.isOpen(row, col) for each row and col | |
percolation.isFull(row, col) for each row and col | |
percolation.isFull(row, col) for each row and col | |
percolation.percolates() | |
percolation.open(3, 10) | |
percolation.isOpen(row, col) for each row and col | |
percolation.isOpen(row, col) for each row and col | |
percolation.numberOfOpenSites() | |
* n = 20 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
- failed on trial 1 of 2 | |
- sequence of operations was: | |
percolation.isFull(row, col) for each row and col | |
percolation.isFull(row, col) for each row and col | |
percolation.numberOfOpenSites() | |
* n = 50 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
- failed on trial 1 of 1 | |
- sequence of operations was: | |
percolation.numberOfOpenSites() | |
==> FAILED | |
Test 12: call all methods in random order until almost all sites are open, | |
but with inputs not prone to backwash | |
* n = 3 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
- failed on trial 1 of 40 | |
* n = 5 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
- failed on trial 1 of 20 | |
* n = 7 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
- failed on trial 1 of 10 | |
* n = 10 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
- failed on trial 1 of 5 | |
* n = 20 | |
- numberOfOpenSites() returns wrong value after 4 sites opened | |
- student numberOfOpenSites() = 6 | |
- reference numberOfOpenSites() = 4 | |
- failed on trial 1 of 2 | |
* n = 50 | |
- numberOfOpenSites() returns wrong value after 1 site opened | |
- student numberOfOpenSites() = 3 | |
- reference numberOfOpenSites() = 1 | |
- failed on trial 1 of 1 | |
==> FAILED | |
Test 13: check for backwash with predetermined sites | |
* filename = input20.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = input10.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = input50.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = jerry47.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = sedgewick60.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = wayne98.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
==> FAILED | |
Test 14: check for backwash with predetermined sites that have | |
multiple percolating paths | |
* filename = input3.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = input4.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
* filename = input7.txt | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
==> FAILED | |
Test 15: call all methods in random order until all sites are open, | |
allowing isOpen() to be called on a site more than once | |
(these inputs are prone to backwash) | |
* n = 3 | |
- numberOfOpenSites() returns wrong value after 2 sites opened | |
- student numberOfOpenSites() = 4 | |
- reference numberOfOpenSites() = 2 | |
- failed on trial 1 of 40 | |
* n = 5 | |
- numberOfOpenSites() returns wrong value after 2 sites opened | |
- student numberOfOpenSites() = 4 | |
- reference numberOfOpenSites() = 2 | |
- failed on trial 1 of 20 | |
* n = 7 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
- failed on trial 1 of 10 | |
* n = 10 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
- failed on trial 1 of 5 | |
* n = 20 | |
- numberOfOpenSites() returns wrong value after 0 sites opened | |
- student numberOfOpenSites() = 2 | |
- reference numberOfOpenSites() = 0 | |
- failed on trial 1 of 2 | |
* n = 50 | |
- numberOfOpenSites() returns wrong value after 1 site opened | |
- student numberOfOpenSites() = 3 | |
- reference numberOfOpenSites() = 1 | |
- failed on trial 1 of 1 | |
==> FAILED | |
Total: 1/15 tests passed! | |
================================================================ | |
******************************************************************************** | |
* TESTING CORRECTNESS (substituting reference Percolation) | |
******************************************************************************** | |
Testing correctness of PercolationStats | |
*----------------------------------------------------------- | |
Running 15 total tests. | |
Test 1: check that methods in PercolationStats do not print to standard output | |
* n = 20, trials = 10 | |
* n = 50, trials = 20 | |
* n = 100, trials = 50 | |
* n = 64, trials = 150 | |
==> passed | |
Test 2: check that mean() returns value in expected range | |
* n = 2, trials = 10000 | |
* n = 5, trials = 10000 | |
* n = 10, trials = 10000 | |
* n = 25, trials = 10000 | |
==> passed | |
Test 3: check that stddev() returns value in expected range | |
* n = 2, trials = 10000 | |
* n = 5, trials = 10000 | |
* n = 10, trials = 10000 | |
* n = 25, trials = 10000 | |
==> passed | |
Test 4: check that PercolationStats creates trials Percolation objects, each of size n-by-n | |
* n = 20, trials = 10 | |
* n = 50, trials = 20 | |
* n = 100, trials = 50 | |
* n = 64, trials = 150 | |
==> passed | |
Test 5: check that PercolationStats calls open() until system percolates | |
* n = 20, trials = 10 | |
* n = 50, trials = 20 | |
* n = 100, trials = 50 | |
* n = 64, trials = 150 | |
==> passed | |
Test 6: check that PercolationStats does not call open() after system percolates | |
* n = 20, trials = 10 | |
* n = 50, trials = 20 | |
* n = 100, trials = 50 | |
* n = 64, trials = 150 | |
==> passed | |
Test 7: check that mean() is consistent with the number of intercepted calls to open() | |
on blocked sites | |
* n = 20, trials = 10 | |
* n = 50, trials = 20 | |
* n = 100, trials = 50 | |
* n = 64, trials = 150 | |
==> passed | |
Test 8: check that stddev() is consistent with the number of intercepted calls to open() | |
on blocked sites | |
* n = 20, trials = 10 | |
* n = 50, trials = 20 | |
* n = 100, trials = 50 | |
* n = 64, trials = 150 | |
==> passed | |
Test 9: check that confidenceLo() and confidenceHigh() are consistent with mean() and stddev() | |
* n = 20, trials = 10 | |
* n = 50, trials = 20 | |
* n = 100, trials = 50 | |
* n = 64, trials = 150 | |
==> passed | |
Test 10: check that exception is thrown if either n or trials is out of bounds | |
* n = -23, trials = 42 | |
* n = 23, trials = 0 | |
* n = -42, trials = 0 | |
* n = 42, trials = -1 | |
* n = -2147483648, trials = -2147483648 | |
==> passed | |
Test 11: create two PercolationStats objects at the same time and check mean() | |
(to make sure you didn't store data in static variables) | |
* n1 = 50, trials1 = 10, n2 = 50, trials2 = 5 | |
* n1 = 50, trials1 = 5, n2 = 50, trials2 = 10 | |
* n1 = 50, trials1 = 10, n2 = 25, trials2 = 10 | |
* n1 = 25, trials1 = 10, n2 = 50, trials2 = 10 | |
* n1 = 50, trials1 = 10, n2 = 15, trials2 = 100 | |
* n1 = 15, trials1 = 100, n2 = 50, trials2 = 10 | |
==> passed | |
Test 12: check that the methods return the same value, regardless of | |
the order in which they are called | |
* n = 20, trials = 10 | |
* n = 50, trials = 20 | |
* n = 100, trials = 50 | |
* n = 64, trials = 150 | |
==> passed | |
Test 13: check that no calls to StdRandom.setSeed() | |
* n = 20, trials = 10 | |
* n = 20, trials = 10 | |
* n = 40, trials = 10 | |
* n = 80, trials = 10 | |
==> passed | |
Test 14: check distribution of number of sites opened until percolation | |
* n = 2, trials = 100000 | |
* n = 3, trials = 100000 | |
* n = 4, trials = 100000 | |
==> passed | |
Test 15: check that each site is opened the expected number of times | |
* n = 2, trials = 100000 | |
* n = 3, trials = 100000 | |
* n = 4, trials = 100000 | |
==> passed | |
Total: 15/15 tests passed! | |
================================================================ | |
******************************************************************************** | |
* MEMORY (substituting reference Percolation) | |
******************************************************************************** | |
Analyzing memory of PercolationStats | |
*----------------------------------------------------------- | |
Running 4 total tests. | |
Test 1a-1d: check memory usage as a function of T trials for n = 100 | |
(max allowed: 8*T + 128 bytes) | |
T bytes | |
-------------------------------------------- | |
=> passed 16 176 | |
=> passed 32 304 | |
=> passed 64 560 | |
=> passed 128 1072 | |
==> 4/4 tests passed | |
Estimated student memory = 8.00 T + 48.00 (R^2 = 1.000) | |
Total: 4/4 tests passed! | |
================================================================ | |
******************************************************************************** | |
* TIMING (substituting reference Percolation) | |
******************************************************************************** | |
Timing PercolationStats | |
*----------------------------------------------------------- | |
Running 4 total tests. | |
Test 1: count calls to StdStats.mean() and StdStats.stddev() | |
* n = 20, trials = 10 | |
- calls StdStats.mean() the wrong number of times | |
- number of student calls to StdStats.mean() = 3 | |
- number of reference calls to StdStats.mean() = 1 | |
- calls StdStats.stddev() the wrong number of times | |
- number of student calls to StdStats.stddev() = 3 | |
- number of reference calls to StdStats.stddev() = 1 | |
* n = 50, trials = 20 | |
- calls StdStats.mean() the wrong number of times | |
- number of student calls to StdStats.mean() = 3 | |
- number of reference calls to StdStats.mean() = 1 | |
- calls StdStats.stddev() the wrong number of times | |
- number of student calls to StdStats.stddev() = 3 | |
- number of reference calls to StdStats.stddev() = 1 | |
* n = 100, trials = 50 | |
- calls StdStats.mean() the wrong number of times | |
- number of student calls to StdStats.mean() = 3 | |
- number of reference calls to StdStats.mean() = 1 | |
- calls StdStats.stddev() the wrong number of times | |
- number of student calls to StdStats.stddev() = 3 | |
- number of reference calls to StdStats.stddev() = 1 | |
* n = 64, trials = 150 | |
- calls StdStats.mean() the wrong number of times | |
- number of student calls to StdStats.mean() = 3 | |
- number of reference calls to StdStats.mean() = 1 | |
- calls StdStats.stddev() the wrong number of times | |
- number of student calls to StdStats.stddev() = 3 | |
- number of reference calls to StdStats.stddev() = 1 | |
==> FAILED | |
Test 2: count calls to methods in StdRandom | |
* n = 20, trials = 10 | |
* n = 20, trials = 10 | |
* n = 40, trials = 10 | |
* n = 80, trials = 10 | |
==> passed | |
Test 3: count calls to methods in Percolation | |
* n = 20, trials = 10 | |
* n = 50, trials = 20 | |
* n = 100, trials = 50 | |
* n = 64, trials = 150 | |
==> passed | |
Test 4: Call PercolationStats methods with trials = 3 and values of n that go up | |
by a factor of sqrt(2). The test passes when n reaches 2,896. | |
The approximate order-of-growth is n ^ (log ratio) | |
n seconds log ratio | |
------------------------ | |
724 0.22 2.4 | |
1024 0.50 2.3 | |
1448 1.39 3.0 | |
2048 3.53 2.7 | |
2896 9.01 2.7 | |
==> passed | |
Total: 3/4 tests passed! | |
================================================================ | |
******************************************************************************** | |
* MEMORY | |
******************************************************************************** | |
Analyzing memory of Percolation | |
*----------------------------------------------------------- | |
Running 4 total tests. | |
Test 1a-1d: check that total memory <= 17 n^2 + 128 n + 1024 bytes | |
n bytes | |
-------------------------------------------- | |
=> passed 64 69920 | |
=> passed 256 1114400 | |
=> passed 512 4456736 | |
=> passed 1024 17826080 | |
==> 4/4 tests passed | |
Estimated student memory = 17.00 n^2 + 0.00 n + 288.00 (R^2 = 1.000) | |
Test 2 (bonus): check that total memory <= 11 n^2 + 128 n + 1024 bytes | |
- failed memory test for n = 64 | |
==> FAILED | |
Total: 4/4 tests passed! | |
================================================================ | |
******************************************************************************** | |
* TIMING | |
******************************************************************************** | |
Timing Percolation | |
*----------------------------------------------------------- | |
Running 16 total tests. | |
Test 1a-1e: Creates an n-by-n percolation system; open sites at random until | |
the system percolates, interleaving calls to percolates() and open(). | |
Count calls to connected(), union() and find(). | |
2 * connected() | |
n union() + find() constructor | |
----------------------------------------------------------------------------------- | |
=> passed 16 387 322 2 | |
=> passed 32 1502 1248 2 | |
=> passed 64 5440 4716 2 | |
=> passed 128 24212 19868 2 | |
=> passed 256 95446 78894 2 | |
=> passed 512 372328 312132 2 | |
=> passed 1024 1471732 1242896 2 | |
==> 7/7 tests passed | |
If one of the values in the table violates the performance limits | |
the factor by which you failed the test appears in parentheses. | |
For example, (9.6x) in the union() column indicates that it uses | |
9.6x too many calls. | |
Tests 2a-2f: Check whether the number of calls to union(), connected(), and find() | |
is a constant per call to open(), isOpen(), isFull(), and percolates(). | |
The table shows the maximum number of union(), connected(), and | |
find() calls made during a single call to open(), isOpen(), isFull(), | |
and percolates(). | |
n per open() per isOpen() per isFull() per percolates() | |
--------------------------------------------------------------------------------------------- | |
=> passed 16 8 0 2 1 | |
=> passed 32 8 0 2 1 | |
=> passed 64 8 0 2 1 | |
=> passed 128 8 0 2 1 | |
=> passed 256 8 0 2 1 | |
=> passed 512 8 0 2 1 | |
=> passed 1024 8 0 2 1 | |
==> 7/7 tests passed | |
Running time (in seconds) depends on the machine on which the script runs. | |
Test 3: Create an n-by-n percolation system; interleave calls to percolates() | |
and open() until the system percolates. The values of n go up by a | |
factor of sqrt(2). The test is passed if n >= 4096 in under 10 seconds. | |
The approximate order-of-growth is n ^ (log ratio) | |
log union-find log | |
n seconds ratio operations ratio | |
------------------------------------------- | |
1024 0.19 2.7 4209000 2.0 | |
1448 0.47 2.6 8485352 2.0 | |
2048 1.30 2.9 16798820 2.0 | |
2896 3.08 2.5 33593234 2.0 | |
4096 7.06 2.4 67183746 2.0 | |
==> passed | |
Test 4: Create an n-by-n percolation system; interleave calls to open(), | |
percolates(), isOpen(), isFull(), and numberOfOpenSites() until. | |
the system percolates. The values of n go up by a factor of sqrt(2). | |
The test is passed if n >= 4096 in under 10 seconds. | |
log union-find log | |
n seconds ratio operations ratio | |
------------------------------------------- | |
128 0.13 4.0 85288 2.2 | |
181 0.50 3.9 170962 2.0 | |
256 1.99 4.0 335574 1.9 | |
362 8.48 4.2 674670 2.0 | |
512 35.61 4.1 1382662 2.1 | |
[ exceeded the time limit of 10.0 seconds ] | |
==> FAILED | |
Total: 15/16 tests passed! | |
================================================================ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment