From f9a76ade7376f92e5501d5f040e0c1a04ab97a41 Mon Sep 17 00:00:00 2001 From: Maecenas Li Date: Mon, 2 Jul 2018 10:13:45 +0800 Subject: [PATCH] Add test-output --- README.md | 22 +- .../Assignment1-Percolation-Union_Find.txt | 560 ++++++++ ...ent2-Deque_RandomizedQueue-Stack_Queue.txt | 1137 +++++++++++++++++ .../Assignment3-CollinearPoints-Sorting.txt | 611 +++++++++ .../Assignment4-8_Puzzle-PriorityQueue.txt | 941 ++++++++++++++ 5 files changed, 3260 insertions(+), 11 deletions(-) create mode 100644 test-output/Assignment1-Percolation-Union_Find.txt create mode 100644 test-output/Assignment2-Deque_RandomizedQueue-Stack_Queue.txt create mode 100644 test-output/Assignment3-CollinearPoints-Sorting.txt create mode 100644 test-output/Assignment4-8_Puzzle-PriorityQueue.txt diff --git a/README.md b/README.md index 39eec30..9ca3133 100644 --- a/README.md +++ b/README.md @@ -8,16 +8,16 @@ Also known as [algs4](http://algs4.cs.princeton.edu/) and Princeton [COS 226](ww ## Programming Assignments -- [Percolation](http://coursera.cs.princeton.edu/algs4/assignments/percolation.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/percolation.html) - Union-Find -- [Deque and RandomizedQueue](http://coursera.cs.princeton.edu/algs4/assignments/queues.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/queues.html) - Stack and Queue -- [Collinear Points](http://coursera.cs.princeton.edu/algs4/assignments/collinear.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/collinear.html) - Sorting -- [8 Puzzle](http://coursera.cs.princeton.edu/algs4/assignments/8puzzle.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/8puzzle.html) - PriorityQueue -- [KdTree](http://coursera.cs.princeton.edu/algs4/assignments/kdtree.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/kdtree.html) - SearchTree -- [WordNet](http://coursera.cs.princeton.edu/algs4/assignments/wordnet.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/wordnet.html) - DirectedGraph -- [Seam Carving](http://coursera.cs.princeton.edu/algs4/assignments/seamCarving.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/seamCarving.html) - Shortest Path -- [Baseball Elimination](http://coursera.cs.princeton.edu/algs4/assignments/baseball.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/baseball.html) - MaxFlow -- [Boggle](http://coursera.cs.princeton.edu/algs4/assignments/boggle.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/boggle.html) - Trie -- [Burrows-Wheeler](http://coursera.cs.princeton.edu/algs4/assignments/burrows.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/burrows.html) - Data Compression +- [Percolation](http://coursera.cs.princeton.edu/algs4/assignments/percolation.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/percolation.html) [:computer:](./src/main/java/assignment1) [:100:](./test-output/Assignment1-Percolation-Union_Find.txt) - Union-Find +- [Deque and RandomizedQueue](http://coursera.cs.princeton.edu/algs4/assignments/queues.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/queues.html) [:computer:](./src/main/java/assignment2) [:100:](./test-output/Assignment2-Deque_RandomizedQueue-Stack_Queue.txt) - Stack and Queue +- [Collinear Points](http://coursera.cs.princeton.edu/algs4/assignments/collinear.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/collinear.html) [:computer:](./src/main/java/assignment3) [:100:](./test-output/Assignment3-CollinearPoints-Sorting.txt) - Sorting +- [8 Puzzle](http://coursera.cs.princeton.edu/algs4/assignments/8puzzle.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/8puzzle.html) [:computer:](./src/main/java/assignment4) [:100:](./test-output/Assignment4-8_Puzzle-PriorityQueue.txt) - PriorityQueue +- [KdTree](http://coursera.cs.princeton.edu/algs4/assignments/kdtree.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/kdtree.html) [:computer:](./src/main/java/assignment5) [:100:](./test-output/Assignment5-KdTree-SearchTree.txt) - SearchTree +- [WordNet](http://coursera.cs.princeton.edu/algs4/assignments/wordnet.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/wordnet.html) [:computer:](./src/main/java/assignment6) [:100:](./test-output/Assignment6-WordNet-DirectedGraph.txt) - DirectedGraph +- [Seam Carving](http://coursera.cs.princeton.edu/algs4/assignments/seamCarving.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/seamCarving.html) [:computer:](./src/main/java/assignment7) [:100:](./test-output/Assignment7-Seam_Carving-ShortestPath.txt) - Shortest Path +- [Baseball Elimination](http://coursera.cs.princeton.edu/algs4/assignments/baseball.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/baseball.html) [:computer:](./src/main/java/assignment8) [:100:](./test-output/Assignment8-Baseball_Elimination-MaxFlow.txt) - MaxFlow +- [Boggle](http://coursera.cs.princeton.edu/algs4/assignments/boggle.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/boggle.html) [:computer:](./src/main/java/assignment9) [:100:](./test-output/Assignment9-Boggle-Trie.txt) - Trie +- [Burrows-Wheeler](http://coursera.cs.princeton.edu/algs4/assignments/burrows.html) [√](http://coursera.cs.princeton.edu/algs4/checklists/burrows.html) [:computer:](./src/main/java/assignment10) [:100:](./test-output/Assignment10-Burrows_Wheeler-Data_Compression.txt) - Data Compression ## Reference @@ -27,5 +27,5 @@ The [algs4 booksite](http://algs4.cs.princeton.edu/) is open to everyone and con ## Copyright -Copyright. All rights reserved. All video recordings, lecture slides, assessments and other materials made available in connection with this course are subject to copyright protection and may be used only for private study by persons who are enrolled in this course. Any other use of these materials must be with the express, written permission of Robert Sedgewick and Kevin Wayne. +All rights reserved. All video recordings, lecture slides, assessments and other materials made available in connection with this course are subject to copyright protection and may be used only for private study by persons who are enrolled in this course. Any other use of these materials must be with the express, written permission of Robert Sedgewick and Kevin Wayne. diff --git a/test-output/Assignment1-Percolation-Union_Find.txt b/test-output/Assignment1-Percolation-Union_Find.txt new file mode 100644 index 0000000..8971dd1 --- /dev/null +++ b/test-output/Assignment1-Percolation-Union_Find.txt @@ -0,0 +1,560 @@ +See the Assessment Guide for information on how to interpret this report. + +ASSESSMENT SUMMARY + +Compilation: PASSED +API: PASSED + +Findbugs: PASSED +PMD: PASSED +Checkstyle: PASSED + +Correctness: 30/30 tests passed +Memory: 9/8 tests passed +Timing: 20/20 tests passed + +Aggregate score: 101.25% +[Compilation: 5%, API: 5%, Findbugs: 0%, PMD: 0%, Checkstyle: 0%, Correctness: 60%, Memory: 10%, Timing: 20%] + +ASSESSMENT DETAILS + +The following files were submitted: +---------------------------------- +4.1K Jun 4 08:34 Percolation.java +2.0K Jun 4 08:34 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 . +*----------------------------------------------------------- +PercolationStats.java:8: Can you replace the instance (or static) variable 'fractions' with a local variable? [SingularField] +PercolationStats.java:8: The private instance (or static) variable 'fractions' can be made 'final'; it is initialized only in the declaration or constructor. [ImmutableField] +PercolationStats.java:9: The private instance (or static) variable 'mean' can be made 'final'; it is initialized only in the declaration or constructor. [ImmutableField] +PercolationStats.java:10: The private instance (or static) variable 'stddev' can be made 'final'; it is initialized only in the declaration or constructor. [ImmutableField] +PercolationStats.java:11: The private instance (or static) variable 'confidenceLo' can be made 'final'; it is initialized only in the declaration or constructor. [ImmutableField] +PercolationStats.java:12: The private instance (or static) variable 'confidenceHi' can be made 'final'; it is initialized only in the declaration or constructor. [ImmutableField] +PMD ends with 6 warnings. + + +================================================================ + + +% checkstyle *.java +*----------------------------------------------------------- + +% custom checkstyle checks for Percolation.java +*----------------------------------------------------------- + +% 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 + * filename = input8.txt + * filename = input8-no.txt + * filename = input10-no.txt + * filename = greeting57.txt + * filename = heart25.txt +==> passed + +Test 2: open random sites until just before system percolates + * n = 3 + * n = 5 + * n = 10 + * n = 10 + * n = 20 + * n = 20 + * n = 50 + * n = 50 +==> passed + +Test 3: open predetermined sites for n = 1 and n = 2 (corner case test) + * filename = input1.txt + * filename = input1-no.txt + * filename = input2.txt + * filename = input2-no.txt +==> passed + +Test 4: check predetermined sites with long percolating path + * filename = snake13.txt + * filename = snake101.txt +==> passed + +Test 5: open every site + * filename = input5.txt +==> passed + +Test 6: open random sites until just before system percolates, + allowing open() to be called on a site more than once + * n = 3 + * n = 5 + * n = 10 + * n = 10 + * n = 20 + * n = 20 + * n = 50 + * n = 50 +==> passed + +Test 7: call methods with invalid arguments + * n = 10, (row, col) = (-1, 5) + * n = 10, (row, col) = (11, 5) + * n = 10, (row, col) = (0, 5) + * n = 10, (row, col) = (5, -1) + * n = 10, (row, col) = (5, 11) + * n = 10, (row, col) = (5, 0) + * n = 10, (row, col) = (-2147483648, -2147483648) + * n = 10, (row, col) = (2147483647, 2147483647) +==> passed + +Test 8: call constructor with invalid argument + * n = -10 + * n = -1 + * n = 0 +==> passed + +Test 9: create multiple Percolation objects at the same time + (to make sure you didn't store data in static variables) +==> passed + +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 + * n = 5 + * n = 7 + * n = 10 + * n = 20 + * n = 50 +==> passed + +Test 12: call all methods in random order until almost all sites are open, + but with inputs not prone to backwash + * n = 3 + * n = 5 + * n = 7 + * n = 10 + * n = 20 + * n = 50 +==> passed + +Test 13: check for backwash with predetermined sites + * filename = input20.txt + * filename = input10.txt + * filename = input50.txt + * filename = jerry47.txt + * filename = sedgewick60.txt + * filename = wayne98.txt +==> passed + +Test 14: check for backwash with predetermined sites that have + multiple percolating paths + * filename = input3.txt + * filename = input4.txt + * filename = input7.txt +==> passed + +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 + * n = 5 + * n = 7 + * n = 10 + * n = 20 + * n = 50 +==> passed + + +Total: 15/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 208 +=> passed 32 336 +=> passed 64 592 +=> passed 128 1104 +==> 4/4 tests passed + + +Estimated student memory = 8.00 T + 80.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 + * n = 50, trials = 20 + * n = 100, trials = 50 + * n = 64, trials = 150 +==> passed + +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.5 + 1024 0.49 2.3 + 1448 1.33 2.9 + 2048 3.36 2.7 + 2896 8.41 2.7 +==> passed + + +Total: 4/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 45280 +=> passed 256 721120 +=> passed 512 2883808 +=> passed 1024 11534560 +==> 4/4 tests passed + + +Estimated student memory = 11.00 n^2 + 0.00 n + 224.00 (R^2 = 1.000) + + +Test 2 (bonus): check that total memory <= 11 n^2 + 128 n + 1024 bytes +==> passed + + +Total: 5/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 234 1319 1 +=> passed 32 645 4138 1 +=> passed 64 2619 17110 1 +=> passed 128 11405 73354 1 +=> passed 256 46034 298109 1 +=> passed 512 186090 1206275 1 +=> passed 1024 740157 4809314 1 +==> 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 16 0 1 0 +=> passed 32 19 0 1 0 +=> passed 64 19 0 1 0 +=> passed 128 19 0 1 0 +=> passed 256 19 0 1 0 +=> passed 512 19 0 1 0 +=> passed 1024 19 0 1 0 +==> 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.15 2.0 6161047 1.9 + 1448 0.39 2.7 12521426 2.0 + 2048 1.08 3.0 25276297 2.0 + 2896 2.84 2.8 50251326 2.0 + 4096 6.35 2.3 100456686 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 + ------------------------------------------- + 1024 0.15 2.2 6992316 2.1 + 1448 0.37 2.7 13785638 2.0 + 2048 1.13 3.2 27523338 2.0 + 2896 2.92 2.7 55076094 2.0 + 4096 6.82 2.4 110554621 2.0 +==> passed + + +Total: 16/16 tests passed! + + +================================================================ + diff --git a/test-output/Assignment2-Deque_RandomizedQueue-Stack_Queue.txt b/test-output/Assignment2-Deque_RandomizedQueue-Stack_Queue.txt new file mode 100644 index 0000000..f3be572 --- /dev/null +++ b/test-output/Assignment2-Deque_RandomizedQueue-Stack_Queue.txt @@ -0,0 +1,1137 @@ +See the Assessment Guide for information on how to interpret this report. + +ASSESSMENT SUMMARY + +Compilation: PASSED (0 errors, 2 warnings) +API: PASSED + +Findbugs: PASSED +PMD: PASSED +Checkstyle: FAILED (0 errors, 3 warnings) + +Correctness: 43/43 tests passed +Memory: 106/105 tests passed +Timing: 136/136 tests passed + +Aggregate score: 100.10% +[Compilation: 5%, API: 5%, Findbugs: 0%, PMD: 0%, Checkstyle: 0%, Correctness: 60%, Memory: 10%, Timing: 20%] + +ASSESSMENT DETAILS + +The following files were submitted: +---------------------------------- +7.3K Jun 9 09:44 Deque.java + 785 Jun 9 09:44 Permutation.java +3.1K Jun 9 09:44 RandomizedQueue.java + + +******************************************************************************** +* COMPILING +******************************************************************************** + + +% javac Deque.java +*----------------------------------------------------------- + +% javac RandomizedQueue.java +*----------------------------------------------------------- +RandomizedQueue.java:15: warning: [unchecked] unchecked cast + this.items = (Item[]) new Object[1]; + ^ + required: Item[] + found: Object[] + where Item is a type-variable: + Item extends Object declared in class RandomizedQueue +RandomizedQueue.java:86: warning: [unchecked] unchecked cast + Item[] tmpArr = (Item[]) new Object[capacity]; + ^ + required: Item[] + found: Object[] + where Item is a type-variable: + Item extends Object declared in class RandomizedQueue +2 warnings + +% javac Permutation.java +*----------------------------------------------------------- + + +================================================================ + + +Checking the APIs of your programs. +*----------------------------------------------------------- +Deque: + +RandomizedQueue: + +Permutation: + +================================================================ + + +******************************************************************************** +* CHECKING STYLE AND COMMON BUG PATTERNS +******************************************************************************** + + +% findbugs *.class +*----------------------------------------------------------- + + +================================================================ + + +% pmd . +*----------------------------------------------------------- +RandomizedQueue.java:56: The private instance (or static) variable 'randomIndex' can be made 'final'; it is initialized only in the declaration or constructor. [ImmutableField] +PMD ends with 1 warning. + + +================================================================ + + +% checkstyle *.java +*----------------------------------------------------------- +[WARN] Deque.java:156:3: '//' or '/*' is not followed by whitespace. [WhitespaceAfter] +[WARN] Deque.java:157:3: The comment is empty. [EmptyComment] +[WARN] Deque.java:231:3: The comment is empty. [EmptyComment] +Checkstyle ends with 0 errors and 3 warnings. + +% custom checkstyle checks for Deque.java +*----------------------------------------------------------- + +% custom checkstyle checks for RandomizedQueue.java +*----------------------------------------------------------- + +% custom checkstyle checks for Permutation.java +*----------------------------------------------------------- + + +================================================================ + + +******************************************************************************** +* TESTING CORRECTNESS +******************************************************************************** + +Testing correctness of Deque +*----------------------------------------------------------- +Running 16 total tests. + +Tests 1-6 make random calls to addFirst(), addLast(), removeFirst(), +removeLast(), isEmpty(), and size(). The probabilities of each +operation are (p1, p2, p3, p4, p5, p6), respectively. + +Test 1: check random calls to addFirst(), addLast(), and size() + * 5 random calls (0.4, 0.4, 0.0, 0.0, 0.0, 0.2) + * 50 random calls (0.4, 0.4, 0.0, 0.0, 0.0, 0.2) + * 500 random calls (0.4, 0.4, 0.0, 0.0, 0.0, 0.2) + * 1000 random calls (0.4, 0.4, 0.0, 0.0, 0.0, 0.2) +==> passed + +Test 2: check random calls to addFirst(), removeFirst(), and isEmpty() + * 5 random calls (0.8, 0.0, 0.1, 0.0, 0.1, 0.0) + * 50 random calls (0.8, 0.0, 0.1, 0.0, 0.1, 0.0) + * 500 random calls (0.8, 0.0, 0.1, 0.0, 0.1, 0.0) + * 1000 random calls (0.8, 0.0, 0.1, 0.0, 0.1, 0.0) + * 5 random calls (0.1, 0.0, 0.8, 0.0, 0.1, 0.0) + * 50 random calls (0.1, 0.0, 0.8, 0.0, 0.1, 0.0) + * 500 random calls (0.1, 0.0, 0.8, 0.0, 0.1, 0.0) + * 1000 random calls (0.1, 0.0, 0.8, 0.0, 0.1, 0.0) +==> passed + +Test 3: check random calls to addFirst(), removeLast(), and isEmpty() + * 5 random calls (0.8, 0.0, 0.0, 0.1, 0.1, 0.0) + * 50 random calls (0.8, 0.0, 0.0, 0.1, 0.1, 0.0) + * 500 random calls (0.8, 0.0, 0.0, 0.1, 0.1, 0.0) + * 1000 random calls (0.8, 0.0, 0.0, 0.1, 0.1, 0.0) + * 5 random calls (0.1, 0.0, 0.0, 0.8, 0.1, 0.0) + * 50 random calls (0.1, 0.0, 0.0, 0.8, 0.1, 0.0) + * 500 random calls (0.1, 0.0, 0.0, 0.8, 0.1, 0.0) + * 1000 random calls (0.1, 0.0, 0.0, 0.8, 0.1, 0.0) +==> passed + +Test 4: check random calls to addLast(), removeLast(), and isEmpty() + * 5 random calls (0.0, 0.8, 0.0, 0.1, 0.1, 0.0) + * 50 random calls (0.0, 0.8, 0.0, 0.1, 0.1, 0.0) + * 500 random calls (0.0, 0.8, 0.0, 0.1, 0.1, 0.0) + * 1000 random calls (0.0, 0.8, 0.0, 0.1, 0.1, 0.0) + * 5 random calls (0.0, 0.1, 0.0, 0.8, 0.1, 0.0) + * 50 random calls (0.0, 0.1, 0.0, 0.8, 0.1, 0.0) + * 500 random calls (0.0, 0.1, 0.0, 0.8, 0.1, 0.0) + * 1000 random calls (0.0, 0.1, 0.0, 0.8, 0.1, 0.0) +==> passed + +Test 5: check random calls to addLast(), removeFirst(), and isEmpty() + * 5 random calls (0.0, 0.8, 0.1, 0.0, 0.1, 0.0) + * 50 random calls (0.0, 0.8, 0.1, 0.0, 0.1, 0.0) + * 500 random calls (0.0, 0.8, 0.1, 0.0, 0.1, 0.0) + * 1000 random calls (0.0, 0.8, 0.1, 0.0, 0.1, 0.0) + * 5 random calls (0.0, 0.1, 0.8, 0.0, 0.1, 0.0) + * 50 random calls (0.0, 0.1, 0.8, 0.0, 0.1, 0.0) + * 500 random calls (0.0, 0.1, 0.8, 0.0, 0.1, 0.0) + * 1000 random calls (0.0, 0.1, 0.8, 0.0, 0.1, 0.0) +==> passed + +Test 6: check random calls to addFirst(), addLast(), removeFirst(), + removeLast(), isEmpty(), and size() + * 5 random calls (0.3, 0.3, 0.1, 0.1, 0.1, 0.1) + * 50 random calls (0.3, 0.3, 0.1, 0.1, 0.1, 0.1) + * 500 random calls (0.3, 0.3, 0.1, 0.1, 0.1, 0.1) + * 1000 random calls (0.3, 0.3, 0.1, 0.1, 0.1, 0.1) + * 5 random calls (0.1, 0.1, 0.3, 0.3, 0.1, 0.1) + * 50 random calls (0.1, 0.1, 0.3, 0.3, 0.1, 0.1) + * 500 random calls (0.1, 0.1, 0.3, 0.3, 0.1, 0.1) + * 1000 random calls (0.1, 0.1, 0.3, 0.3, 0.1, 0.1) +==> passed + +Test 7: check removeFirst() and removeLast() from an empty deque + * removeFirst() + * removeLast() +==> passed + +Test 8: check whether two Deque objects can be created at the same time +==> passed + +Test 9: check iterator() after n calls to addFirst() + * n = 10 + * n = 50 +==> passed + +Test 10: check iterator() after each of m intermixed calls to + addFirst(), addLast(), removeFirst(), and removeLast() + * m = 20 + * m = 50 + * m = 100 + * m = 1000 +==> passed + +Test 11: create two nested iterators to same deque + * n = 10 + * n = 50 +==> passed + +Test 12: create two parallel iterators to same deque +==> passed + +Test 13: create Deque objects of different parameterized types +==> passed + +Test 14: call addFirst() and addLast() with null argument +==> passed + +Test 15: check that remove() and next() throw the specified exceptions in iterator() +==> passed + +Test 16: call iterator() when the deque is empty +==> passed + + +Total: 16/16 tests passed! + + +================================================================ +Testing correctness of RandomizedQueue +*----------------------------------------------------------- +Running 18 total tests. + +Tests 1-4 make random calls to enqueue(), dequeue(), sample(), +isEmpty(), and size(). The probabilities of each operation are +(p1, p2, p3, p4, p5), respectively. + +Test 1: check random calls to enqueue() and size() + * 5 random calls (0.8, 0.0, 0.0, 0.0, 0.2) + * 50 random calls (0.8, 0.0, 0.0, 0.0, 0.2) + * 500 random calls (0.8, 0.0, 0.0, 0.0, 0.2) + * 1000 random calls (0.8, 0.0, 0.0, 0.0, 0.2) +==> passed + +Test 2: check random calls to enqueue() and dequeue() + * 5 random calls (0.7, 0.1, 0.0, 0.1, 0.1) + * 50 random calls (0.7, 0.1, 0.0, 0.1, 0.1) + * 500 random calls (0.7, 0.1, 0.0, 0.1, 0.1) + * 1000 random calls (0.7, 0.1, 0.0, 0.1, 0.1) + * 5 random calls (0.1, 0.7, 0.0, 0.1, 0.1) + * 50 random calls (0.1, 0.7, 0.0, 0.1, 0.1) + * 500 random calls (0.1, 0.7, 0.0, 0.1, 0.1) + * 1000 random calls (0.1, 0.7, 0.0, 0.1, 0.1) +==> passed + +Test 3: check random calls to enqueue(), sample(), and size() + * 5 random calls (0.8, 0.0, 0.1, 0.0, 0.1) + * 50 random calls (0.8, 0.0, 0.1, 0.0, 0.1) + * 500 random calls (0.8, 0.0, 0.1, 0.0, 0.1) + * 1000 random calls (0.8, 0.0, 0.1, 0.0, 0.1) + * 5 random calls (0.1, 0.0, 0.8, 0.0, 0.1) + * 50 random calls (0.1, 0.0, 0.8, 0.0, 0.1) + * 500 random calls (0.1, 0.0, 0.8, 0.0, 0.1) + * 1000 random calls (0.1, 0.0, 0.8, 0.0, 0.1) +==> passed + +Test 4: check random calls to enqueue(), dequeue(), sample(), isEmpty(), and size() + * 5 random calls (0.6, 0.1, 0.1, 0.1, 0.1) + * 50 random calls (0.6, 0.1, 0.1, 0.1, 0.1) + * 500 random calls (0.6, 0.1, 0.1, 0.1, 0.1) + * 1000 random calls (0.6, 0.1, 0.1, 0.1, 0.1) + * 5 random calls (0.1, 0.6, 0.1, 0.1, 0.1) + * 50 random calls (0.1, 0.6, 0.1, 0.1, 0.1) + * 500 random calls (0.1, 0.6, 0.1, 0.1, 0.1) + * 1000 random calls (0.1, 0.6, 0.1, 0.1, 0.1) +==> passed + +Test 5: call dequeue() and sample() from an empty randomized queue + * dequeue() + * sample() +==> passed + +Test 6: create multiple randomized queue objects at the same time + * n = 10 + * n = 100 +==> passed + +Test 7: check that iterator() returns correct items after a sequence + of n enqueue() operations + * n = 10 + * n = 50 +==> passed + +Test 8: check that iterator() returns correct items after sequence + of m enqueue() and dequeue() operations + * m = 10 + * m = 1000 +==> passed + +Test 9: create two nested iterators over the same randomized queue + * n = 10 + * n = 50 +==> passed + +Test 10: create two parallel iterators over the same randomized queue + * n = 10 + * n = 50 +==> passed + +Test 11: create two iterators over different randomized queues +==> passed + +Test 12: create RandomizedQueue objects of different parameterized types +==> passed + +Test 13: check randomness of sample() by enqueueing n items, repeatedly calling + sample(), and counting the frequency of each item + * n = 3, trials = 12000 + * n = 5, trials = 12000 + * n = 8, trials = 12000 + * n = 10, trials = 12000 +==> passed + +Test 14: check randomness of dequeue() by enqueueing n items, dequeueing n items, + and seeing whether each of the n! permutations is equally likely + * n = 2, trials = 12000 + * n = 3, trials = 12000 + * n = 4, trials = 12000 + * n = 5, trials = 12000 +==> passed + +Test 15: check randomness of iterator() by enqueueing n items, iterating over those + n items, and seeing whether each of the n! permutations is equally likely + * n = 2, trials = 12000 + * n = 3, trials = 12000 + * n = 4, trials = 12000 + * n = 5, trials = 12000 +==> passed + +Test 16: call enqueue() with a null argument +==> passed + +Test 17: check that remove() and next() throw the specified exceptions in iterator() +==> passed + +Test 18: call iterator() when randomized queue is empty +==> passed + + +Total: 18/18 tests passed! + + +================================================================ +******************************************************************************** +* TESTING CORRECTNESS (substituting reference RandomizedQueue and Deque) +******************************************************************************** + +Testing correctness of Permutation +*----------------------------------------------------------- +Tests 1-5 call the main() function directly, resetting standard input +before each call. + +Running 9 total tests. + +Test 1a: check formatting for sample inputs from assignment specification + % java Permutation 3 < distinct.txt + B + C + F + + % java Permutation 3 < distinct.txt + B + F + D + + % java Permutation 8 < duplicates.txt + BB + BB + CC + CC + AA + BB + BB + BB + +==> passed + +Test 1b: check formatting for other inputs + % java Permutation 8 < mediumTale.txt + wisdom + foolishness + was + best + the + age + it + was + + % java Permutation 0 < distinct.txt + [no output] + +==> passed + +Test 2: check that main() reads all data from standard input + * filename = distinct.txt, k = 3 + * filename = distinct.txt, k = 3 + * filename = duplicates.txt, k = 8 + * filename = mediumTale.txt, k = 8 +==> passed + +Test 3a: check that main() prints each item from the sequence at most once + (for inputs with no duplicate strings) + * filename = distinct.txt, k = 3 + * filename = distinct.txt, k = 1 + * filename = distinct.txt, k = 9 + * filename = permutation6.txt, k = 6 + * filename = permutation10.txt, k = 10 +==> passed + +Test 3b: check that main() prints each item from the sequence at most once + (for inputs with duplicate strings) + * filename = duplicates.txt, k = 8 + * filename = duplicates.txt, k = 3 + * filename = permutation8.txt, k = 6 + * filename = permutation8.txt, k = 2 + * filename = tinyTale.txt, k = 10 +==> passed + +Test 3c: check that main() prints each item from the sequence at most once + (for inputs with newlines) + * filename = mediumTale.txt, k = 10 + * filename = mediumTale.txt, k = 20 + * filename = tale.txt, k = 10 + * filename = tale.txt, k = 50 +==> passed + +Test 4: check main() when k = 0 + * filename = distinct.txt, k = 0 + * filename = distinct.txt, k = 0 +==> passed + +Test 5a: check that permutations are uniformly random + (for inputs with no duplicate strings) + * filename = permutation4.txt, k = 1 + * filename = permutation4.txt, k = 2 + * filename = permutation4.txt, k = 3 + * filename = permutation4.txt, k = 4 + * filename = permutation6.txt, k = 2 +==> passed + +Test 5b: check that permutations are uniformly random + (for inputs with duplicate strings) + * filename = permutation5.txt, k = 1 + * filename = permutation5.txt, k = 2 + * filename = permutation5.txt, k = 3 + * filename = duplicates.txt, k = 3 + * filename = permutation8.txt, k = 2 +==> passed + +Total: 9/9 tests passed! + + +================================================================ +******************************************************************************** +* TIMING (substituting reference RandomizedQueue and Deque) +******************************************************************************** + +Timing Permutation +*----------------------------------------------------------- +Running 23 total tests. + +Test 1: count calls to methods in StdIn + * java Permutation 5 < distinct.txt + * java Permutation 10 < permutation10.txt + * java Permutation 1 < mediumTale.txt + * java Permutation 20 < tale.txt + * java Permutation 100 < tale.txt + * java Permutation 16412 < tale.txt +==> passed + +Test 2: count calls to methods in Deque and RandomizedQueue + * java Permutation 5 < distinct.txt + * java Permutation 10 < permutation10.txt + * java Permutation 1 < mediumTale.txt + * java Permutation 20 < tale.txt + * java Permutation 100 < tale.txt + * java Permutation 16412 < tale.txt +==> passed + +Test 3: count calls to methods in StdRandom + * java Permutation 5 < distinct.txt + * java Permutation 10 < permutation10.txt + * java Permutation 1 < mediumTale.txt + * java Permutation 20 < tale.txt + * java Permutation 100 < tale.txt + * java Permutation 16412 < tale.txt +==> passed + +Test 4: Time main() with k = 5, for inputs containing n random strings + + n seconds +------------------------------ +=> passed 1000 0.00 +=> passed 2000 0.00 +=> passed 4000 0.00 +=> passed 8000 0.00 +=> passed 16000 0.01 +=> passed 32000 0.01 +=> passed 64000 0.02 +=> passed 128000 0.05 +=> passed 256000 0.09 +=> passed 512000 0.19 +==> 10/10 tests passed + + +Test 5: Time main() with k = 1000, for inputs containing n random strings + + n seconds +------------------------------ +=> passed 1000 0.00 +=> passed 2000 0.00 +=> passed 4000 0.00 +=> passed 8000 0.00 +=> passed 16000 0.01 +=> passed 32000 0.01 +=> passed 64000 0.02 +=> passed 128000 0.05 +=> passed 256000 0.24 +=> passed 512000 0.26 +==> 10/10 tests passed + + +Total: 23/23 tests passed! + + +================================================================ + + + +******************************************************************************** +* MEMORY +******************************************************************************** + +Analyzing memory of Permutation +*----------------------------------------------------------- +Running 2 total tests. + +Test 1: check that only one Deque or RandomizedQueue object is created + * filename = distinct.txt, n = 9, k = 1 + * filename = distinct.txt, n = 9, k = 2 + * filename = distinct.txt, n = 9, k = 4 + * filename = tinyTale.txt, n = 12, k = 10 + * filename = tale.txt, n = 138653, k = 50 +==> passed + +Test 2: check that the maximum size of any Deque or RandomizedQueue object + created is between k and n + * filename = distinct.txt, n = 9, k = 1 + * filename = distinct.txt, n = 9, k = 2 + * filename = distinct.txt, n = 9, k = 4 + * filename = tinyTale.txt, n = 12, k = 10 + * filename = tale.txt, n = 138653, k = 5 + * filename = tale.txt, n = 138653, k = 50 + * filename = tale.txt, n = 138653, k = 500 + * filename = tale.txt, n = 138653, k = 5000 + * filename = tale.txt, n = 138653, k = 50000 +==> passed + +Test 3 (bonus): check that maximum size of any or Deque or RandomizedQueue object + created is equal to k + * filename = tale.txt, n = 138653, k = 5 + * filename = tale.txt, n = 138653, k = 50 + * filename = tale.txt, n = 138653, k = 500 + * filename = tale.txt, n = 138653, k = 5000 + * filename = tale.txt, n = 138653, k = 50000 +==> passed + +Total: 3/2 tests passed! + +================================================================ + + + +******************************************************************************** +* MEMORY +******************************************************************************** + +Analyzing memory of Deque +*----------------------------------------------------------- +For tests 1-4, the maximum amount of memory allowed for a Deque +containing n items is 48n + 192. + +Running 28 total tests. + +Test 1a-1e: Total memory usage after inserting n items, + where n is a power of 2. + + n bytes +---------------------------------------------------------- +=> passed 8 464 +=> passed 64 3152 +=> passed 256 12368 +=> passed 1024 49232 +=> passed 4096 196688 +==> 5/5 tests passed + +Memory: 48.00 n + 80.00 (R^2 = 1.000) + + + +Test 2a-2e: Total memory usage after inserting n+1 items, + where n is a power of 2. + + n bytes +---------------------------------------------------------- +=> passed 8 512 +=> passed 64 3200 +=> passed 256 12416 +=> passed 1024 49280 +=> passed 4096 196736 +==> 5/5 tests passed + +Memory after adding n = 2^i + 1 items: 48.00 n + 80.00 (R^2 = 1.000) + + + +Test 3a-3e: Total memory usage after inserting 2n+1 items + and deleting n items, where n is a power of 2. + + n bytes +---------------------------------------------------------- +=> passed 8 512 +=> passed 64 3200 +=> passed 256 12416 +=> passed 1024 49280 +=> passed 4096 196736 +==> 5/5 tests passed + +Memory: 48.00 n + 80.00 (R^2 = 1.000) + + + +Test 4a-4e: Total memory usage after inserting n items and then + deleting all but one item, where n is a power of 2. + (should not grow with n or be too large of a constant) + + n bytes +---------------------------------------------------------- +=> passed 8 128 +=> passed 64 128 +=> passed 256 128 +=> passed 1024 128 +=> passed 4096 128 +==> 5/5 tests passed + +Memory after adding n = 2^i items: 128.00 (R^2 = 1.000) + + + +Test 5a-5e: Total memory usage of iterator after inserting n items. + (should not grow with n or be too large of a constant) + + n bytes +---------------------------------------------------------- +=> passed 8 32 +=> passed 64 32 +=> passed 256 32 +=> passed 1024 32 +=> passed 4096 32 +==> 5/5 tests passed + +Memory of iterator after adding n = 2^i items: 32.00 (R^2 = 1.000) + + + +Test 6a: Insert n strings; delete them one at a time, checking for + loitering after each deletion. The probabilities of addFirst() + and addLast() are (p1, p2), respectively. The probabilities of + removeFirst() and removeLast() are (q1, q2), respectively + * 100 random insertions (1.0, 0.0) and 100 random deletions (1.0, 0.0) + * 100 random insertions (1.0, 0.0) and 100 random deletions (0.0, 1.0) + * 100 random insertions (0.0, 1.0) and 100 random deletions (1.0, 0.0) + * 100 random insertions (0.0, 1.0) and 100 random deletions (0.0, 1.0) + * 100 random insertions (0.5, 0.5) and 100 random deletions (0.5, 0.5) +==> passed + +Test 6b: Perform random operations, checking for loitering after + each operation. The probabilities of addFirst(), addLast(), + removeFirst(), and removeLast() are (p1, p2, p3, p4), + respectively. + * 100 random operations (0.8, 0.0, 0.2, 0.0) + * 100 random operations (0.8, 0.0, 0.0, 0.2) + * 100 random operations (0.0, 0.8, 0.2, 0.0) + * 100 random operations (0.0, 0.8, 0.0, 0.2) + * 100 random operations (0.4, 0.4, 0.1, 0.1) + * 100 random operations (0.2, 0.2, 0.3, 0.3) +==> passed + +Test 7: Worst-case constant memory allocated or deallocated + per deque operation? + * 128 random operations + * 256 random operations + * 512 random operations +==> passed + +Total: 28/28 tests passed! + +================================================================ + + + +Analyzing memory of RandomizedQueue +*----------------------------------------------------------- +For tests 1-5, the maximum amount of memory allowed for +a RandomizedQueue containing n items is 48n + 192. + +Test 1a-1i: Total memory usage after inserting n items + when n is a power of 2. + + n bytes +---------------------------------------------------------- +=> passed 32 312 +=> passed 64 568 +=> passed 128 1080 +=> passed 256 2104 +=> passed 512 4152 +=> passed 1024 8248 +=> passed 2048 16440 +=> passed 4096 32824 +=> passed 8192 65592 +==> 9/9 tests passed + +Memory: 8.00 n + 56.00 (R^2 = 1.000) + + +Test 2a-2i: Total memory usage after inserting n items, + when n is one more than a power of 2. + + n bytes +---------------------------------------------------------- +=> passed 33 568 +=> passed 65 1080 +=> passed 129 2104 +=> passed 257 4152 +=> passed 513 8248 +=> passed 1025 16440 +=> passed 2049 32824 +=> passed 4097 65592 +=> passed 8193 131128 +==> 9/9 tests passed + +Memory: 16.00 n + 40.00 (R^2 = 1.000) + + +Test 3a-3i: Total memory usage after inserting 2n-1 items, and then + deleting n-1 items, when n is one more than a power of 2. + + n bytes +---------------------------------------------------------- +=> passed 33 1080 +=> passed 65 2104 +=> passed 129 4152 +=> passed 257 8248 +=> passed 513 16440 +=> passed 1025 32824 +=> passed 2049 65592 +=> passed 4097 131128 +=> passed 8193 262200 +==> 9/9 tests passed + +Memory: 32.00 n + 24.00 (R^2 = 1.000) + + +Test 4a-4i: Total memory usage after inserting n items, deleting n items, + then inserting n times, when n is a power of 2. + + n bytes +---------------------------------------------------------- +=> passed 32 312 +=> passed 64 568 +=> passed 128 1080 +=> passed 256 2104 +=> passed 512 4152 +=> passed 1024 8248 +=> passed 2048 16440 +=> passed 4096 32824 +=> passed 8192 65592 +==> 9/9 tests passed + +Memory: 8.00 n + 56.00 (R^2 = 1.000) + + +Test 5a-5i: Total memory usage after inserting n items, + and then deleting all but one item. + + n bytes +---------------------------------------------------------- +=> passed 32 88 +=> passed 64 88 +=> passed 128 88 +=> passed 256 88 +=> passed 512 88 +=> passed 1024 88 +=> passed 2048 88 +=> passed 4096 88 +=> passed 8192 88 +==> 9/9 tests passed + +Memory: 88.00 (R^2 = 1.000) + + +Test 6a-6d: Total memory usage of iterator after inserting n items. + + n bytes +---------------------------------------------------------- +=> passed 32 192 +=> passed 64 320 +=> passed 128 576 +=> passed 256 1088 +=> passed 512 2112 +=> passed 1024 4160 +=> passed 2048 8256 +=> passed 4096 16448 +=> passed 8192 32832 +==> 9/9 tests passed + +Memory: 4.00 n + 64.00 (R^2 = 1.000) + + +Test 7a: Insert 100 strings; delete them one at a time, checking + for loitering after each deletion. +==> passed + +Test 7b: Perform random operations, checking for loitering after + each operation. The probabilities of enqueue(), dequeue(), + and sample() are (p1, p2, p3), respectively. + * 200 random operations (0.8, 0.2, 0.0) + * 200 random operations (0.2, 0.8, 0.0) + * 200 random operations (0.6, 0.2, 0.2) + * 200 random operations (0.2, 0.4, 0.4) +==> passed + +Test 8: Insert T items into queue; then iterate over queue and check + that worst-case constant memory is allocated or deallocated + per iterator operation. + * T = 64 + * T = 128 + * T = 256 +==> passed + +Test 9: Total memory usage after inserting n items, seeking to identify + values of n where memory usage is minimized as a function of n. + + n bytes +---------------------------------------------------------- +=> passed 8 120 +=> passed 16 184 +=> passed 32 312 +=> passed 64 568 +=> passed 128 1080 +=> passed 256 2104 +=> passed 512 4152 +=> passed 1024 8248 +=> passed 2048 16440 +==> 9/9 tests passed + +Memory: 8.00 n + 56.00 (R^2 = 1.000) + + +Test 10: Total memory usage after inserting 4096 items, then successively + deleting items, seeking values of n where memory usage is maximized + as a function of n + + n bytes +---------------------------------------------------------- +=> passed 2048 65592 +=> passed 1024 32824 +=> passed 512 16440 +=> passed 256 8248 +=> passed 128 4152 +=> passed 64 2104 +=> passed 32 1080 +=> passed 16 568 +=> passed 8 312 +==> 9/9 tests passed + +Memory: 32.00 n + 56.00 (R^2 = 1.000) + + +Min observed memory for RandomizedQueue: 8.00 n + 56.00 (R^2 = 1.000) +Max observed memory for RandomizedQueue: 32.00 n + 24.00 (R^2 = 1.000) + +Running 75 total tests. + +Total: 75/75 tests passed! + +================================================================ + + + +******************************************************************************** +* TIMING +******************************************************************************** + +Timing Deque +*----------------------------------------------------------- +Running 55 total tests. + +Test 1a-1g: make n random calls to addFirst(), removeFirst(), isEmpty(), and size() + with probabilities (0.7, 0.1, 0.1, 0.1) + + n seconds +------------------------------ +=> passed 1024 0.00 +=> passed 2048 0.00 +=> passed 4096 0.00 +=> passed 8192 0.00 +=> passed 16384 0.00 +=> passed 32768 0.00 +=> passed 65536 0.01 +=> passed 128000 0.01 +=> passed 256000 0.02 +=> passed 512000 0.04 +=> passed 1024000 0.08 +=> passed 2048000 0.13 +==> 12/12 tests passed + + +Test 2a-2g: make n random calls to addLast(), removeLast(), isEmpty(), and size(), + with probabilities (0.7, 0.1, 0.1, 0.1) + + n seconds +------------------------------ +=> passed 1024 0.00 +=> passed 2048 0.00 +=> passed 4096 0.00 +=> passed 8192 0.00 +=> passed 16384 0.00 +=> passed 32768 0.00 +=> passed 65536 0.00 +=> passed 128000 0.00 +=> passed 256000 0.01 +=> passed 512000 0.02 +=> passed 1024000 0.04 +=> passed 2048000 0.07 +==> 12/12 tests passed + + +Test 3a-3g: make n random calls to addFirst(), addLast(), removeFirst(), removeLast(), + isEmpty(), and size() with probabilities (0.3, 0.3, 0.1, 0.1, 0.1, 0.1) + + n seconds +------------------------------ +=> passed 1024 0.00 +=> passed 2048 0.00 +=> passed 4096 0.00 +=> passed 8192 0.00 +=> passed 16384 0.00 +=> passed 32768 0.00 +=> passed 65536 0.00 +=> passed 128000 0.01 +=> passed 256000 0.01 +=> passed 512000 0.02 +=> passed 1024000 0.04 +=> passed 2048000 0.16 +==> 12/12 tests passed + + +Test 4a-4g: make n calls to addFirst(); iterate over the n items by calling + next() and hasNext() + + n seconds +------------------------------ +=> passed 1024 0.00 +=> passed 2048 0.00 +=> passed 4096 0.00 +=> passed 8192 0.00 +=> passed 16384 0.00 +=> passed 32768 0.00 +=> passed 65536 0.00 +=> passed 128000 0.01 +=> passed 256000 0.02 +=> passed 512000 0.04 +=> passed 1024000 0.04 +=> passed 2048000 0.03 +==> 12/12 tests passed + + +Test 5a-5g: make n calls to addFirst()/addLast(); interleave n calls each to + removeFirst()/removeLast() and addFirst()/addLast() + + n seconds +---------------------------------- +=> passed 1025 0.00 +=> passed 2049 0.00 +=> passed 4097 0.00 +=> passed 16385 0.00 +=> passed 32767 0.01 +=> passed 32768 0.01 +=> passed 32769 0.00 +==> 7/7 tests passed + +Total: 55/55 tests passed! + + +================================================================ + + + +Timing RandomizedQueue +*----------------------------------------------------------- +Running 58 total tests. + +Test 1: make n calls to enqueue(); make n calls to dequeue(); + count calls to StdRandom + * n = 10 + * n = 100 + * n = 1000 +==> passed + +Test 2: make n calls to enqueue(); make n calls to sample(); + count calls to StdRandom + * n = 10 + * n = 100 + * n = 1000 +==> passed + +Test 3: make n calls to enqueue(); iterate over the n items; + count calls to StdRandom + * n = 10 + * n = 100 + * n = 1000 +==> passed + +Test 4a-g: make n random calls to enqueue(), sample(), dequeue(), isEmpty(), + and size() with probabilities (0.2, 0.2, 0.2, 0.2, 0.2) + + n seconds +---------------------------------- +=> passed 1024 0.00 +=> passed 2048 0.00 +=> passed 4096 0.00 +=> passed 8192 0.00 +=> passed 16384 0.00 +=> passed 32768 0.00 +=> passed 65536 0.00 +=> passed 128000 0.01 +=> passed 256000 0.01 +=> passed 512000 0.02 +=> passed 1024000 0.05 +=> passed 2048000 0.09 +==> 12/12 tests passed + + +Test 5a-g: make n random calls to enqueue(), sample(), dequeue(), isEmpty(), + and size() with probabilities (0.6, 0.1, 0.1, 0.1, 0.1) + + n seconds +---------------------------------- +=> passed 1024 0.00 +=> passed 2048 0.00 +=> passed 4096 0.00 +=> passed 8192 0.00 +=> passed 16384 0.00 +=> passed 32768 0.00 +=> passed 65536 0.00 +=> passed 128000 0.01 +=> passed 256000 0.02 +=> passed 512000 0.03 +=> passed 1024000 0.07 +=> passed 2048000 0.14 +==> 12/12 tests passed + + +Test 6a-g: make n random calls to enqueue(), sample(), dequeue(), isEmpty(), + and size() with probabilities (0.1, 0.1, 0.6, 0.1, 0.1) + + n seconds +---------------------------------- +=> passed 1024 0.00 +=> passed 2048 0.00 +=> passed 4096 0.00 +=> passed 8192 0.00 +=> passed 16384 0.00 +=> passed 32768 0.00 +=> passed 65536 0.00 +=> passed 128000 0.01 +=> passed 256000 0.01 +=> passed 512000 0.02 +=> passed 1024000 0.05 +=> passed 2048000 0.09 +==> 12/12 tests passed + + +Test 7a-g: make n calls to enqueue(); iterate over the n items + by calling next() and hasNext(). + + n seconds +---------------------------------- +=> passed 1024 0.00 +=> passed 2048 0.00 +=> passed 4096 0.00 +=> passed 8192 0.00 +=> passed 16384 0.00 +=> passed 32768 0.00 +=> passed 65536 0.01 +=> passed 128000 0.01 +=> passed 256000 0.02 +=> passed 512000 0.04 +=> passed 1024000 0.06 +=> passed 2048000 0.14 +==> 12/12 tests passed + + +Test 8a-g: make n calls to enqueue(); interleave n calls each + to dequeue() and enqueue(). + + n seconds +---------------------------------- +=> passed 1025 0.00 +=> passed 2049 0.00 +=> passed 4097 0.00 +=> passed 16385 0.00 +=> passed 32767 0.00 +=> passed 32768 0.00 +=> passed 32769 0.00 +==> 7/7 tests passed + +Total: 58/58 tests passed! + + +================================================================ + diff --git a/test-output/Assignment3-CollinearPoints-Sorting.txt b/test-output/Assignment3-CollinearPoints-Sorting.txt new file mode 100644 index 0000000..debe9bd --- /dev/null +++ b/test-output/Assignment3-CollinearPoints-Sorting.txt @@ -0,0 +1,611 @@ +See the Assessment Guide for information on how to interpret this report. + +ASSESSMENT SUMMARY + +Compilation: PASSED +API: PASSED + +Findbugs: FAILED (2 warnings) +PMD: PASSED +Checkstyle: FAILED (0 errors, 1 warning) + +Correctness: 41/41 tests passed +Memory: 1/1 tests passed +Timing: 41/41 tests passed + +Aggregate score: 100.00% +[Compilation: 5%, API: 5%, Findbugs: 0%, PMD: 0%, Checkstyle: 0%, Correctness: 60%, Memory: 10%, Timing: 20%] + +ASSESSMENT DETAILS + +The following files were submitted: +---------------------------------- +2.9K Jun 28 12:09 BruteCollinearPoints.java +3.9K Jun 28 12:09 FastCollinearPoints.java +4.6K Jun 28 12:09 Point.java + + +******************************************************************************** +* COMPILING +******************************************************************************** + + +% javac Point.java +*----------------------------------------------------------- + +% javac BruteCollinearPoints.java +*----------------------------------------------------------- + +% javac FastCollinearPoints.java +*----------------------------------------------------------- + + +================================================================ + + +Checking the APIs of your programs. +*----------------------------------------------------------- +Point: + +BruteCollinearPoints: + +FastCollinearPoints: + +================================================================ + + +******************************************************************************** +* CHECKING STYLE AND COMMON BUG PATTERNS +******************************************************************************** + + +% findbugs *.class +*----------------------------------------------------------- +L D FE_FLOATING_POINT_EQUALITY FE: Tests for exact floating-point equality. Because floating-point calculations may involve rounding, the calculated values may be imprecise. At BruteCollinearPoints.java:[line 23] +L D FE_FLOATING_POINT_EQUALITY FE: Tests for exact floating-point equality. Because floating-point calculations may involve rounding, the calculated values may be imprecise. At FastCollinearPoints.java:[line 36] +Warnings generated: 2 + + +================================================================ + + +% pmd . +*----------------------------------------------------------- + + +================================================================ + + +% checkstyle *.java +*----------------------------------------------------------- +[WARN] BruteCollinearPoints.java:21:30: Do not use the letter 'l' as a local variable name. It is hard to distinguish from the number '1'. [LocalVariableName] +Checkstyle ends with 0 errors and 1 warning. + +% custom checkstyle checks for Point.java +*----------------------------------------------------------- + +% custom checkstyle checks for BruteCollinearPoints.java +*----------------------------------------------------------- + +% custom checkstyle checks for FastCollinearPoints.java +*----------------------------------------------------------- + + +================================================================ + + +******************************************************************************** +* TESTING CORRECTNESS +******************************************************************************** + +Testing correctness of Point +*----------------------------------------------------------- +Running 3 total tests. + +Test 1: p.slopeTo(q) + * positive infinite slope, where p and q have coordinates in [0, 500) + * positive infinite slope, where p and q have coordinates in [0, 32768) + * negative infinite slope, where p and q have coordinates in [0, 500) + * negative infinite slope, where p and q have coordinates in [0, 32768) + * positive zero slope, where p and q have coordinates in [0, 500) + * positive zero slope, where p and q have coordinates in [0, 32768) + * symmetric for random points p and q with coordinates in [0, 500) + * symmetric for random points p and q with coordinates in [0, 32768) + * transitive for random points p, q, and r with coordinates in [0, 500) + * transitive for random points p, q, and r with coordinates in [0, 32768) + * slopeTo(), where p and q have coordinates in [0, 500) + * slopeTo(), where p and q have coordinates in [0, 32768) + * slopeTo(), where p and q have coordinates in [0, 10) + * throw a java.lang.NullPointerException if argument is null +==> passed + +Test 2: p.compareTo(q) + * reflexive, where p and q have coordinates in [0, 500) + * reflexive, where p and q have coordinates in [0, 32768) + * antisymmetric, where p and q have coordinates in [0, 500) + * antisymmetric, where p and q have coordinates in [0, 32768) + * transitive, where p, q, and r have coordinates in [0, 500) + * transitive, where p, q, and r have coordinates in [0, 32768) + * sign of compareTo(), where p and q have coordinates in [0, 500) + * sign of compareTo(), where p and q have coordinates in [0, 32768) + * sign of compareTo(), where p and q have coordinates in [0, 10) + * throw java.lang.NullPointerException exception if argument is null +==> passed + +Test 3: p.slopeOrder().compare(q, r) + * reflexive, where p and q have coordinates in [0, 500) + * reflexive, where p and q have coordinates in [0, 32768) + * antisymmetric, where p, q, and r have coordinates in [0, 500) + * antisymmetric, where p, q, and r have coordinates in [0, 32768) + * transitive, where p, q, r, and s have coordinates in [0, 500) + * transitive, where p, q, r, and s have coordinates in [0, 32768) + * sign of compare(), where p, q, and r have coordinates in [0, 500) + * sign of compare(), where p, q, and r have coordinates in [0, 32768) + * sign of compare(), where p, q, and r have coordinates in [0, 10) + * throw java.lang.NullPointerException if either argument is null +==> passed + + +Total: 3/3 tests passed! + + +================================================================ +******************************************************************************** +* TESTING CORRECTNESS (substituting reference Point and LineSegment) +******************************************************************************** + +Testing correctness of BruteCollinearPoints +*----------------------------------------------------------- +Running 17 total tests. + +The inputs satisfy the following conditions: + - no duplicate points + - no 5 (or more) points are collinear + - all x- and y-coordinates between 0 and 32,767 + +Test 1: points from a file + * filename = input8.txt + * filename = equidistant.txt + * filename = input40.txt + * filename = input48.txt +==> passed + +Test 2a: points from a file with horizontal line segments + * filename = horizontal5.txt + * filename = horizontal25.txt +==> passed + +Test 2b: random horizontal line segments + * 1 random horizontal line segment + * 5 random horizontal line segments + * 10 random horizontal line segments + * 15 random horizontal line segments +==> passed + +Test 3a: points from a file with vertical line segments + * filename = vertical5.txt + * filename = vertical25.txt +==> passed + +Test 3b: random vertical line segments + * 1 random vertical line segment + * 5 random vertical line segments + * 10 random vertical line segments + * 15 random vertical line segments +==> passed + +Test 4a: points from a file with no line segments + * filename = random23.txt + * filename = random38.txt +==> passed + +Test 4b: random points with no line segments + * 5 random points + * 10 random points + * 20 random points + * 50 random points +==> passed + +Test 5: points from a file with fewer than 4 points + * filename = input1.txt + * filename = input2.txt + * filename = input3.txt +==> passed + +Test 6: check for dependence on either compareTo() or compare() + returning { -1, +1, 0 } instead of { negative integer, + positive integer, zero } + * filename = equidistant.txt + * filename = input40.txt + * filename = input48.txt +==> passed + +Test 7: check for fragile dependence on return value of toString() + * filename = equidistant.txt + * filename = input40.txt + * filename = input48.txt +==> passed + +Test 8: random line segments, none vertical or horizontal + * 1 random line segment + * 5 random line segments + * 10 random line segments + * 15 random line segments +==> passed + +Test 9: random line segments + * 1 random line segment + * 5 random line segments + * 10 random line segments + * 15 random line segments +==> passed + +Test 10: check that data type is immutable by testing whether each method + returns the same value, regardless of any intervening operations + * input8.txt + * equidistant.txt +==> passed + +Test 11: check that data type does not mutate the constructor argument + * input8.txt + * equidistant.txt +==> passed + +Test 12: numberOfSegments() is consistent with segments() + * filename = input8.txt + * filename = equidistant.txt + * filename = input40.txt + * filename = input48.txt + * filename = horizontal5.txt + * filename = vertical5.txt + * filename = random23.txt +==> passed + +Test 13: throws an exception if either the constructor argument is null + or any entry in array is null + * argument is null + * Point[] of length 10, number of null entries = 1 + * Point[] of length 10, number of null entries = 10 + * Point[] of length 4, number of null entries = 1 + * Point[] of length 3, number of null entries = 1 + * Point[] of length 2, number of null entries = 1 + * Point[] of length 1, number of null entries = 1 +==> passed + +Test 14: check that the constructor throws an exception if duplicate points + * 50 points + * 25 points + * 5 points + * 4 points + * 3 points + * 2 points +==> passed + + +Total: 17/17 tests passed! + + +================================================================ +Testing correctness of FastCollinearPoints +*----------------------------------------------------------- +Running 21 total tests. + +The inputs satisfy the following conditions: + - no duplicate points + - all x- and y-coordinates between 0 and 32,767 + +Test 1: points from a file + * filename = input8.txt + * filename = equidistant.txt + * filename = input40.txt + * filename = input48.txt + * filename = input299.txt +==> passed + +Test 2a: points from a file with horizontal line segments + * filename = horizontal5.txt + * filename = horizontal25.txt + * filename = horizontal50.txt + * filename = horizontal75.txt + * filename = horizontal100.txt +==> passed + +Test 2b: random horizontal line segments + * 1 random horizontal line segment + * 5 random horizontal line segments + * 10 random horizontal line segments + * 15 random horizontal line segments +==> passed + +Test 3a: points from a file with vertical line segments + * filename = vertical5.txt + * filename = vertical25.txt + * filename = vertical50.txt + * filename = vertical75.txt + * filename = vertical100.txt +==> passed + +Test 3b: random vertical line segments + * 1 random vertical line segment + * 5 random vertical line segments + * 10 random vertical line segments + * 15 random vertical line segments +==> passed + +Test 4a: points from a file with no line segments + * filename = random23.txt + * filename = random38.txt + * filename = random91.txt + * filename = random152.txt +==> passed + +Test 4b: random points with no line segments + * 5 random points + * 10 random points + * 20 random points + * 50 random points +==> passed + +Test 5a: points from a file with 5 or more on some line segments + * filename = input9.txt + * filename = input10.txt + * filename = input20.txt + * filename = input50.txt + * filename = input80.txt + * filename = input300.txt + * filename = inarow.txt +==> passed + +Test 5b: points from a file with 5 or more on some line segments + * filename = kw1260.txt + * filename = rs1423.txt +==> passed + +Test 6: points from a file with fewer than 4 points + * filename = input1.txt + * filename = input2.txt + * filename = input3.txt +==> passed + +Test 7: check for dependence on either compareTo() or compare() + returning { -1, +1, 0 } instead of { negative integer, + positive integer, zero } + * filename = equidistant.txt + * filename = input40.txt + * filename = input48.txt + * filename = input299.txt +==> passed + +Test 8: check for fragile dependence on return value of toString() + * filename = equidistant.txt + * filename = input40.txt + * filename = input48.txt +==> passed + +Test 9: random line segments, none vertical or horizontal + * 1 random line segment + * 5 random line segments + * 25 random line segments + * 50 random line segments + * 100 random line segments +==> passed + +Test 10: random line segments + * 1 random line segment + * 5 random line segments + * 25 random line segments + * 50 random line segments + * 100 random line segments +==> passed + +Test 11: random distinct points in a given range + * 5 random points in a 10-by-10 grid + * 10 random points in a 10-by-10 grid + * 50 random points in a 10-by-10 grid + * 90 random points in a 10-by-10 grid + * 200 random points in a 50-by-50 grid +==> passed + +Test 12: m*n points on an m-by-n grid + * 3-by-3 grid + * 4-by-4 grid + * 5-by-5 grid + * 10-by-10 grid + * 20-by-20 grid + * 5-by-4 grid + * 6-by-4 grid + * 10-by-4 grid + * 15-by-4 grid + * 25-by-4 grid +==> passed + +Test 13: check that data type is immutable by testing whether each method + returns the same value, regardless of any intervening operations + * input8.txt + * equidistant.txt +==> passed + +Test 14: check that data type does not mutate the constructor argument + * input8.txt + * equidistant.txt +==> passed + +Test 15: numberOfSegments() is consistent with segments() + * filename = input8.txt + * filename = equidistant.txt + * filename = input40.txt + * filename = input48.txt + * filename = horizontal5.txt + * filename = vertical5.txt + * filename = random23.txt +==> passed + +Test 16: throws an exception if either constructor argument is null + or any entry in array is null + * argument is null + * Point[] of length 10, number of null entries = 1 + * Point[] of length 10, number of null entries = 10 + * Point[] of length 4, number of null entries = 1 + * Point[] of length 3, number of null entries = 1 + * Point[] of length 2, number of null entries = 1 + * Point[] of length 1, number of null entries = 1 +==> passed + +Test 17: check that the constructor throws an exception if duplicate points + * 50 points + * 25 points + * 5 points + * 4 points + * 3 points + * 2 points +==> passed + + +Total: 21/21 tests passed! + + +================================================================ +******************************************************************************** +* MEMORY +******************************************************************************** + +Analyzing memory of Point +*----------------------------------------------------------- +Running 1 total tests. + +The maximum amount of memory per Point object is 32 bytes. + +Student memory = 24 bytes (passed) + +Total: 1/1 tests passed! + +================================================================ + + + +******************************************************************************** +* TIMING +******************************************************************************** + +Timing BruteCollinearPoints +*----------------------------------------------------------- +Running 10 total tests. + +Test 1a-1e: Find collinear points among n random distinct points + + + slopeTo() + n time slopeTo() compare() + 2*compare() compareTo() +----------------------------------------------------------------------------------------------- +=> passed 16 0.00 3640 0 3640 0 +=> passed 32 0.00 71920 0 71920 0 +=> passed 64 0.01 1270752 0 1270752 0 +=> passed 128 0.04 21336000 0 21336000 0 +=> passed 256 0.31 349585280 0 349585280 0 +==> 5/5 tests passed + +Test 2a-2e: Find collinear points among n/4 arbitrary line segments + + + slopeTo() + n time slopeTo() compare() + 2*compare() compareTo() +----------------------------------------------------------------------------------------------- +=> passed 16 0.00 3786 0 3786 23 +=> passed 32 0.00 72488 0 72488 45 +=> passed 64 0.01 1272836 0 1272836 88 +=> passed 128 0.12 21343948 0 21343948 166 +=> passed 256 1.73 349617038 0 349617038 333 +==> 5/5 tests passed + +Total: 10/10 tests passed! + + +================================================================ + + + +Timing FastCollinearPoints +*----------------------------------------------------------- +Running 31 total tests. + +Test 1a-1g: Find collinear points among n random distinct points + + + slopeTo() + n time slopeTo() compare() + 2*compare() compareTo() +----------------------------------------------------------------------------------------------- +=> passed 64 0.01 3968 18865 41698 303 +=> passed 128 0.01 16128 89591 195310 739 +=> passed 256 0.02 65024 415477 895978 1750 +=> passed 512 0.22 261120 1898670 4058460 3971 +=> passed 1024 0.35 1046528 8563366 18173260 8980 +=> passed 2048 0.96 4190208 38157893 80505994 19973 +==> 6/6 tests passed + +lg ratio(slopeTo() + 2*compare()) = lg (80505994 / 18173260) = 2.15 +=> passed + +==> 7/7 tests passed + +Test 2a-2g: Find collinear points among the n points on an n-by-1 grid + + slopeTo() + n time slopeTo() compare() + 2*compare() compareTo() +----------------------------------------------------------------------------------------------- +=> passed 64 0.00 4032 4764 13560 7056 +=> passed 128 0.00 16256 17796 51848 22970 +=> passed 256 0.01 65280 68717 202714 79797 +=> passed 512 0.02 261632 269399 800430 292576 +=> passed 1024 0.06 1047552 1065026 3177604 1112892 +=> passed 2048 0.18 4192256 4231214 12654684 4329493 +=> passed 4096 0.47 16773120 16859163 50491446 17060394 +==> 7/7 tests passed + +lg ratio(slopeTo() + 2*compare()) = lg (50491446 / 12654684) = 2.00 +=> passed + +==> 8/8 tests passed + +Test 3a-3g: Find collinear points among the n points on an n/4-by-4 grid + + slopeTo() + n time slopeTo() compare() + 2*compare() compareTo() +----------------------------------------------------------------------------------------------- +=> passed 64 0.00 4032 14906 33844 4620 +=> passed 128 0.00 16256 43854 103964 16249 +=> passed 256 0.01 65280 149618 364516 56034 +=> passed 512 0.02 261632 548156 1357944 202146 +=> passed 1024 0.08 1047552 2087496 5222544 758187 +=> passed 2048 0.20 4192256 8122445 20437146 2921990 +=> passed 4096 0.65 16773120 31990953 80755026 11450349 +==> 7/7 tests passed + +lg ratio(slopeTo() + 2*compare()) = lg (80755026 / 20437146) = 1.98 +=> passed + +==> 8/8 tests passed + +Test 4a-4g: Find collinear points among the n points on an n/8-by-8 grid + + slopeTo() + n time slopeTo() compare() + 2*compare() compareTo() +----------------------------------------------------------------------------------------------- +=> passed 64 0.00 4032 18045 40122 3953 +=> passed 128 0.00 16256 75863 167982 16570 +=> passed 256 0.01 65280 232229 529738 61392 +=> passed 512 0.02 261632 854545 1970722 226893 +=> passed 1024 0.08 1047552 3260991 7569534 862608 +=> passed 2048 0.23 4192256 12699218 29590692 3347244 +=> passed 4096 0.92 16773120 50043244 116859608 13163276 +==> 7/7 tests passed + +lg ratio(slopeTo() + 2*compare()) = lg (116859608 / 29590692) = 1.98 +=> passed + +==> 8/8 tests passed + +Total: 31/31 tests passed! + + +================================================================ + diff --git a/test-output/Assignment4-8_Puzzle-PriorityQueue.txt b/test-output/Assignment4-8_Puzzle-PriorityQueue.txt new file mode 100644 index 0000000..ee1c6d3 --- /dev/null +++ b/test-output/Assignment4-8_Puzzle-PriorityQueue.txt @@ -0,0 +1,941 @@ +See the Assessment Guide for information on how to interpret this report. + +ASSESSMENT SUMMARY + +Compilation: PASSED +API: PASSED + +Findbugs: PASSED +PMD: PASSED +Checkstyle: PASSED + +Correctness: 49/49 tests passed +Memory: 22/22 tests passed +Timing: 125/125 tests passed + +Aggregate score: 100.00% +[Compilation: 5%, API: 5%, Findbugs: 0%, PMD: 0%, Checkstyle: 0%, Correctness: 60%, Memory: 10%, Timing: 20%] + +ASSESSMENT DETAILS + +The following files were submitted: +---------------------------------- +5.4K Jul 2 01:57 Board.java +4.0K Jul 2 01:57 Solver.java + + +******************************************************************************** +* COMPILING +******************************************************************************** + + +% javac Board.java +*----------------------------------------------------------- + +% javac Solver.java +*----------------------------------------------------------- + + +================================================================ + + +Checking the APIs of your programs. +*----------------------------------------------------------- +Board: + +Solver: + +================================================================ + + +******************************************************************************** +* CHECKING STYLE AND COMMON BUG PATTERNS +******************************************************************************** + + +% findbugs *.class +*----------------------------------------------------------- + + +================================================================ + + +% pmd . +*----------------------------------------------------------- + + +================================================================ + + +% checkstyle *.java +*----------------------------------------------------------- + +% custom checkstyle checks for Board.java +*----------------------------------------------------------- + +% custom checkstyle checks for Solver.java +*----------------------------------------------------------- + + +================================================================ + + +******************************************************************************** +* TESTING CORRECTNESS +******************************************************************************** + +Testing correctness of Board +*----------------------------------------------------------- +Running 24 total tests. + +Tests 5, 6, 13, and 14 rely upon toString() returning results in prescribed format. + +Test 1a: check hamming() with file inputs + * puzzle04.txt + * puzzle00.txt + * puzzle07.txt + * puzzle17.txt + * puzzle27.txt + * puzzle2x2-unsolvable1.txt +==> passed + +Test 1b: check hamming() with random n-by-n boards + * 2-by-2 + * 3-by-3 + * 4-by-4 + * 5-by-5 + * 9-by-9 + * 10-by-10 + * 127-by-127 +==> passed + +Test 2a: check manhattan() with file inputs + * puzzle04.txt + * puzzle00.txt + * puzzle07.txt + * puzzle17.txt + * puzzle27.txt + * puzzle2x2-unsolvable1.txt +==> passed + +Test 2b: check manhattan() with random n-by-n boards + * 2-by-2 + * 3-by-3 + * 4-by-4 + * 5-by-5 + * 9-by-9 + * 10-by-10 + * 127-by-127 +==> passed + +Test 3: check dimension() with random n-by-n boards + * 2-by-2 + * 3-by-3 + * 4-by-4 + * 5-by-5 + * 6-by-6 +==> passed + +Test 4a: check toString() with file inputs + * puzzle04.txt + * puzzle00.txt + * puzzle06.txt + * puzzle09.txt + * puzzle23.txt + * puzzle2x2-unsolvable1.txt +==> passed + +Test 4b: check toString() with random n-by-n boards + * 2-by-2 + * 3-by-3 + * 4-by-4 + * 5-by-5 + * 9-by-9 + * 10-by-10 + * 127-by-127 +==> passed + +Test 5a: check neighbors() with file inputs + * puzzle04.txt + * puzzle00.txt + * puzzle06.txt + * puzzle09.txt + * puzzle23.txt + * puzzle2x2-unsolvable1.txt +==> passed + +Test 5b: check neighbors() with random n-by-n boards + * 2-by-2 + * 3-by-3 + * 4-by-4 + * 5-by-5 + * 9-by-9 + * 10-by-10 + * 127-by-127 +==> passed + +Test 6a: check neighbors() of neigbors() with file inputs + * puzzle04.txt + * puzzle00.txt + * puzzle06.txt + * puzzle09.txt + * puzzle23.txt + * puzzle2x2-unsolvable1.txt +==> passed + +Test 6b: check neighbors() of neighbors() with random n-by-n boards + * 2-by-2 + * 3-by-3 + * 4-by-4 + * 5-by-5 + * 9-by-9 + * 10-by-10 +==> passed + +Test 7a: check twin() with file inputs + * puzzle04.txt + * puzzle00.txt + * puzzle06.txt + * puzzle09.txt + * puzzle23.txt + * puzzle2x2-unsolvable1.txt +==> passed + +Test 7b: check twin() with random n-by-n boards + * 2-by-2 + * 3-by-3 + * 4-by-4 + * 5-by-5 + * 9-by-9 + * 10-by-10 +==> passed + +Test 8a: check isGoal() with file inputs + * puzzle00.txt + * puzzle04.txt + * puzzle16.txt + * puzzle06.txt + * puzzle09.txt + * puzzle23.txt + * puzzle2x2-unsolvable1.txt + * puzzle3x3-unsolvable1.txt + * puzzle3x3-00.txt + * puzzle4x4-00.txt +==> passed + +Test 8b: check isGoal() on n-by-n goal boards + * 2-by-2 + * 3-by-3 + * 4-by-4 + * 5-by-5 + * 6-by-6 + * 100-by-100 +==> passed + +Test 9: check that two Board objects can be created at the same time + * random 3-by-3 and 3-by-3 boards + * random 4-by-4 and 4-by-4 boards + * random 2-by-2 and 2-by-2 boards + * random 3-by-3 and 4-by-4 boards + * random 4-by-4 and 3-by-3 boards +==> passed + +Test 10a: check equals() + * reflexive + * symmetric + * transitive + * argument is null + * argument is of type String + * Board object stored in a variable of type Object +==> passed + +Test 10b: check correctness of equals() on random n-by-n boards + * n = 2 + * n = 3 + * n = 4 + * 5 <= n < 10 +==> passed + +Test 10c: check equals() when board sizes m and n are different + * m = 4, n = 5 + * m = 2, n = 5 + * m = 5, n = 3 + * m = 2, n = 3 + * m = 3, n = 2 +==> passed + +Test 11: check that Board is immutable by changing argument array after + construction and making sure Board does not mutate +==> passed + +Test 12: check that Board is immutable by testing whether methods + return the same value, regardless of order in which called + * puzzle10.txt + * puzzle20.txt + * puzzle30.txt + * 2-by-2 + * 3-by-3 + * 4-by-4 +==> passed + +Test 13: check dimension() on a board that is kth-neighbor of a board + * 0th neighbor of puzzle27.txt + * 1st neighbor of puzzle27.txt + * 2nd neighbor of puzzle27.txt + * 13th neighbor of puzzle27.txt + * 13th neighbor of puzzle00.txt + * 13th neighbor of puzzle2x2-unsolvable1.txt +==> passed + +Test 14: check hamming() on a board that is kth-neighbor of a board + * 0th neighbor of puzzle27.txt + * 1st neighbor of puzzle27.txt + * 2nd neighbor of puzzle27.txt + * 13th neighbor of puzzle27.txt + * 13th neighbor of puzzle00.txt + * 13th neighbor of puzzle2x2-unsolvable1.txt +==> passed + +Test 15: check manhattan() on a board that is a kth-neighbor of a board + * 0th neighbor of puzzle27.txt + * 1st neighbor of puzzle27.txt + * 2nd neighbor of puzzle27.txt + * 13th neighbor of puzzle27.txt + * 13th neighbor of puzzle00.txt + * 13th neighbor of puzzle2x2-unsolvable1.txt +==> passed + + +Total: 24/24 tests passed! + + +================================================================ +******************************************************************************** +* MEMORY +******************************************************************************** + +Analyzing memory of Board +*----------------------------------------------------------- +Running 10 total tests. + +Memory usage of an n-by-n board +[ must be at most 4n^2 + 32n + 64 bytes ] + + + n student (bytes) reference (bytes) +---------------------------------------------------------- +=> passed 2 144 128 +=> passed 3 208 192 +=> passed 4 256 240 +=> passed 8 576 560 +=> passed 12 1024 1008 +=> passed 16 1600 1584 +=> passed 20 2304 2288 +=> passed 37 6872 6856 +=> passed 72 23104 23088 +=> passed 120 61504 61488 +==> 10/10 tests passed + +Total: 10/10 tests passed! + +Student memory = 4.00 n^2 + 32.00 n + 64.00 (R^2 = 1.000) +Reference memory = 4.00 n^2 + 32.00 n + 48.00 (R^2 = 1.000) + +================================================================ + + + +******************************************************************************** +* TESTING CORRECTNESS (substituting reference Board) +******************************************************************************** + +Testing correctness of Solver +*----------------------------------------------------------- +Running 25 total tests. + +Test 1a: check moves() with file inputs + * puzzle00.txt + * puzzle01.txt + * puzzle02.txt + * puzzle03.txt + * puzzle04.txt + * puzzle05.txt + * puzzle06.txt + * puzzle07.txt + * puzzle08.txt + * puzzle09.txt + * puzzle10.txt + * puzzle11.txt + * puzzle12.txt + * puzzle13.txt +==> passed + +Test 1b: check solution() with file inputs + * puzzle00.txt + * puzzle01.txt + * puzzle02.txt + * puzzle03.txt + * puzzle04.txt + * puzzle05.txt + * puzzle06.txt + * puzzle07.txt + * puzzle08.txt + * puzzle09.txt + * puzzle10.txt + * puzzle11.txt + * puzzle12.txt + * puzzle13.txt +==> passed + +Test 2a: check moves() with more file inputs + * puzzle14.txt + * puzzle15.txt + * puzzle16.txt + * puzzle17.txt + * puzzle18.txt + * puzzle19.txt + * puzzle20.txt + * puzzle21.txt + * puzzle22.txt + * puzzle23.txt + * puzzle24.txt + * puzzle25.txt + * puzzle26.txt + * puzzle27.txt + * puzzle28.txt + * puzzle29.txt + * puzzle30.txt + * puzzle31.txt +==> passed + +Test 2b: check solution() with more file inputs + * puzzle14.txt + * puzzle15.txt + * puzzle16.txt + * puzzle17.txt + * puzzle18.txt + * puzzle19.txt + * puzzle20.txt + * puzzle21.txt + * puzzle22.txt + * puzzle23.txt + * puzzle24.txt + * puzzle25.txt + * puzzle26.txt + * puzzle27.txt + * puzzle28.txt + * puzzle29.txt + * puzzle30.txt + * puzzle31.txt +==> passed + +Test 3a: check moves() with random solvable n-by-n boards + * 1000 random 3-by-3 boards that are exactly 1 move from goal + * 1000 random 3-by-3 boards that are exactly 2 moves from goal + * 1000 random 3-by-3 boards that are exactly 3 moves from goal + * 1000 random 3-by-3 boards that are exactly 4 moves from goal + * 1000 random 3-by-3 boards that are exactly 5 moves from goal + * 1000 random 3-by-3 boards that are exactly 6 moves from goal + * 1000 random 3-by-3 boards that are exactly 7 moves from goal + * 1000 random 3-by-3 boards that are exactly 8 moves from goal + * 1000 random 3-by-3 boards that are exactly 9 moves from goal + * 1000 random 3-by-3 boards that are exactly 10 moves from goal + * 1000 random 3-by-3 boards that are exactly 11 moves from goal + * 1000 random 3-by-3 boards that are exactly 12 moves from goal +==> passed + +Test 3b: check solution() with random solvable n-by-n boards + * 1000 random 3-by-3 boards that are exactly 1 move from goal + * 1000 random 3-by-3 boards that are exactly 2 moves from goal + * 1000 random 3-by-3 boards that are exactly 3 moves from goal + * 1000 random 3-by-3 boards that are exactly 4 moves from goal + * 1000 random 3-by-3 boards that are exactly 5 moves from goal + * 1000 random 3-by-3 boards that are exactly 6 moves from goal + * 1000 random 3-by-3 boards that are exactly 7 moves from goal + * 1000 random 3-by-3 boards that are exactly 8 moves from goal + * 1000 random 3-by-3 boards that are exactly 9 moves from goal + * 1000 random 3-by-3 boards that are exactly 10 moves from goal + * 1000 random 3-by-3 boards that are exactly 11 moves from goal + * 1000 random 3-by-3 boards that are exactly 12 moves from goal +==> passed + +Test 4: create two Solver objects at the same time + * puzzle04.txt and puzzle04.txt + * puzzle00.txt and puzzle04.txt + * puzzle04.txt and puzzle00.txt +==> passed + +Test 5a: call isSolvable() with file inputs + * puzzle01.txt + * puzzle03.txt + * puzzle04.txt + * puzzle17.txt + * puzzle3x3-unsolvable1.txt + * puzzle3x3-unsolvable2.txt + * puzzle4x4-unsolvable.txt +==> passed + +Test 5b: call isSolvable() on random n-by-n boards + * 100 random 2-by-2 boards +==> passed + +Test 6: check moves() on unsolvable puzzles + * puzzle2x2-unsolvable1.txt + * puzzle2x2-unsolvable2.txt + * puzzle3x3-unsolvable1.txt + * puzzle3x3-unsolvable2.txt + * puzzle4x4-unsolvable.txt +==> passed + +Test 7: check solution() on unsolvable puzzles + * puzzle2x2-unsolvable1.txt + * puzzle2x2-unsolvable2.txt + * puzzle3x3-unsolvable1.txt + * puzzle3x3-unsolvable2.txt + * puzzle4x4-unsolvable.txt +==> passed + +Test 8a: check that Solver is immutable by testing whether methods + return the same value, regardless of order in which called + * puzzle3x3-00.txt + * puzzle3x3-01.txt + * puzzle3x3-05.txt + * puzzle3x3-10.txt + * random 2-by-2 solvable boards +==> passed + +Test 8b: check that Solver is immutable by testing whether methods + return the same value, regardless of order in which called + * puzzle3x3-unsolvable1.txt + * puzzle3x3-unsolvable2.txt + * puzzle4x4-unsolvable.txt + * random 2-by-2 unsolvable boards +==> passed + +Test 9a: check that equals() method in Board is called + * puzzle00.txt + * puzzle04.txt + * puzzle05.txt + * puzzle10.txt +==> passed + +Test 9b: check that equals() method in Board is called only + with an argument of type Board + * puzzle00.txt + * puzzle04.txt + * puzzle05.txt + * puzzle10.txt +==> passed + +Test 9c: check that equals() method in Board is called only + with a neighbor of a neighbor as an argument + * puzzle00.txt + * puzzle04.txt + * puzzle05.txt + * puzzle10.txt + * puzzle27.txt +==> passed + +Test 10: check that constructor throws exception if board is null +==> passed + +Test 11a: check moves() with 2-by-2 file inputs + * puzzle2x2-00.txt + * puzzle2x2-01.txt + * puzzle2x2-02.txt + * puzzle2x2-03.txt + * puzzle2x2-04.txt + * puzzle2x2-05.txt + * puzzle2x2-06.txt +==> passed + +Test 11b: check solution() with 2-by-2 file inputs + * puzzle2x2-00.txt + * puzzle2x2-01.txt + * puzzle2x2-02.txt + * puzzle2x2-03.txt + * puzzle2x2-04.txt + * puzzle2x2-05.txt + * puzzle2x2-06.txt +==> passed + +Test 12a: check moves() with 3-by-3 file inputs + * puzzle3x3-00.txt + * puzzle3x3-01.txt + * puzzle3x3-02.txt + * puzzle3x3-03.txt + * puzzle3x3-04.txt + * puzzle3x3-05.txt + * puzzle3x3-06.txt + * puzzle3x3-07.txt + * puzzle3x3-08.txt + * puzzle3x3-09.txt + * puzzle3x3-10.txt + * puzzle3x3-11.txt + * puzzle3x3-12.txt + * puzzle3x3-13.txt + * puzzle3x3-14.txt + * puzzle3x3-15.txt + * puzzle3x3-16.txt + * puzzle3x3-17.txt + * puzzle3x3-18.txt + * puzzle3x3-19.txt + * puzzle3x3-20.txt + * puzzle3x3-21.txt + * puzzle3x3-22.txt + * puzzle3x3-23.txt + * puzzle3x3-24.txt + * puzzle3x3-25.txt + * puzzle3x3-26.txt + * puzzle3x3-27.txt + * puzzle3x3-28.txt + * puzzle3x3-29.txt + * puzzle3x3-30.txt +==> passed + +Test 12b: check solution() with 3-by-3 file inputs + * puzzle3x3-00.txt + * puzzle3x3-01.txt + * puzzle3x3-02.txt + * puzzle3x3-03.txt + * puzzle3x3-04.txt + * puzzle3x3-05.txt + * puzzle3x3-06.txt + * puzzle3x3-07.txt + * puzzle3x3-08.txt + * puzzle3x3-09.txt + * puzzle3x3-10.txt + * puzzle3x3-11.txt + * puzzle3x3-12.txt + * puzzle3x3-13.txt + * puzzle3x3-14.txt + * puzzle3x3-15.txt + * puzzle3x3-16.txt + * puzzle3x3-17.txt + * puzzle3x3-18.txt + * puzzle3x3-19.txt + * puzzle3x3-20.txt + * puzzle3x3-21.txt + * puzzle3x3-22.txt + * puzzle3x3-23.txt + * puzzle3x3-24.txt + * puzzle3x3-25.txt + * puzzle3x3-26.txt + * puzzle3x3-27.txt + * puzzle3x3-28.txt + * puzzle3x3-29.txt + * puzzle3x3-30.txt +==> passed + +Test 13a: check moves() with 4-by-4 file inputs + * puzzle4x4-00.txt + * puzzle4x4-01.txt + * puzzle4x4-02.txt + * puzzle4x4-03.txt + * puzzle4x4-04.txt + * puzzle4x4-05.txt + * puzzle4x4-06.txt + * puzzle4x4-07.txt + * puzzle4x4-08.txt + * puzzle4x4-09.txt + * puzzle4x4-10.txt + * puzzle4x4-11.txt + * puzzle4x4-12.txt + * puzzle4x4-13.txt + * puzzle4x4-14.txt + * puzzle4x4-15.txt + * puzzle4x4-16.txt + * puzzle4x4-17.txt + * puzzle4x4-18.txt + * puzzle4x4-19.txt + * puzzle4x4-20.txt + * puzzle4x4-21.txt + * puzzle4x4-22.txt + * puzzle4x4-23.txt + * puzzle4x4-24.txt + * puzzle4x4-25.txt + * puzzle4x4-26.txt + * puzzle4x4-27.txt + * puzzle4x4-28.txt + * puzzle4x4-29.txt + * puzzle4x4-30.txt +==> passed + +Test 13b: check solution() with 4-by-4 file inputs + * puzzle4x4-00.txt + * puzzle4x4-01.txt + * puzzle4x4-02.txt + * puzzle4x4-03.txt + * puzzle4x4-04.txt + * puzzle4x4-05.txt + * puzzle4x4-06.txt + * puzzle4x4-07.txt + * puzzle4x4-08.txt + * puzzle4x4-09.txt + * puzzle4x4-10.txt + * puzzle4x4-11.txt + * puzzle4x4-12.txt + * puzzle4x4-13.txt + * puzzle4x4-14.txt + * puzzle4x4-15.txt + * puzzle4x4-16.txt + * puzzle4x4-17.txt + * puzzle4x4-18.txt + * puzzle4x4-19.txt + * puzzle4x4-20.txt + * puzzle4x4-21.txt + * puzzle4x4-22.txt + * puzzle4x4-23.txt + * puzzle4x4-24.txt + * puzzle4x4-25.txt + * puzzle4x4-26.txt + * puzzle4x4-27.txt + * puzzle4x4-28.txt + * puzzle4x4-29.txt + * puzzle4x4-30.txt +==> passed + +Test 14a: check moves() with random solvable n-by-n boards + * 100 random 2-by-2 boards that are <= 6 moves from goal + * 200 random 3-by-3 boards that are <= 20 moves from goal + * 200 random 4-by-4 boards that are <= 20 moves from goal + * 200 random 5-by-5 boards that are <= 20 moves from goal +==> passed + +Test 14b: check solution() with random solvable n-by-n boards + * 100 random 2-by-2 boards that are <= 6 moves from goal + * 200 random 3-by-3 boards that are <= 20 moves from goal + * 200 random 4-by-4 boards that are <= 20 moves from goal + * 200 random 5-by-5 boards that are <= 20 moves from goal +==> passed + + +Total: 25/25 tests passed! + + +================================================================ +******************************************************************************** +* MEMORY (substituting reference Board) +******************************************************************************** + +Analyzing memory of Solver +*----------------------------------------------------------- +Running 12 total tests. + +Maximum allowed time per puzzle is 5.0 seconds. +Maximum allowed memory per puzzle = 200000000 bytes. + +Test 1: Measure memory of Solver. + + filename moves memory +--------------------------------------------- +=> passed puzzle10.txt 10 4784 +=> passed puzzle15.txt 15 5792 +=> passed puzzle20.txt 20 3056 +=> passed puzzle25.txt 25 3776 +=> passed puzzle30.txt 30 4496 +=> passed puzzle35.txt 35 6080 +==> 6/6 tests passed + + + +Test 2: Measure memory of MinPQ. + + deep max ending + filename memory size size +-------------------------------------------------------------------- +=> passed puzzle10.txt 28784 34 34 +=> passed puzzle15.txt 35984 52 52 +=> passed puzzle20.txt 218624 587 587 +=> passed puzzle25.txt 1554976 4214 4214 +=> passed puzzle30.txt 6472112 17038 17038 +=> passed puzzle35.txt 92934128 271122 271122 +==> 6/6 tests passed + + +Total: 12/12 tests passed! + +================================================================ + + + +******************************************************************************** +* TIMING (substituting reference Board) +******************************************************************************** + +Timing Solver +*----------------------------------------------------------- +Running 125 total tests. + +Maximum allowed time per puzzle is 5.0 seconds. + +Test 1: Measure CPU time and check correctness + + filename moves n seconds +--------------------------------------------- +=> passed puzzle20.txt 20 3 0.02 +=> passed puzzle22.txt 22 3 0.01 +=> passed puzzle21.txt 21 3 0.01 +=> passed puzzle23.txt 23 3 0.01 +=> passed puzzle24.txt 24 3 0.01 +=> passed puzzle25.txt 25 3 0.02 +=> passed puzzle27.txt 27 3 0.02 +=> passed puzzle29.txt 29 3 0.01 +=> passed puzzle26.txt 26 3 0.02 +=> passed puzzle28.txt 28 3 0.04 +=> passed puzzle30.txt 30 3 0.07 +=> passed puzzle31.txt 31 3 0.06 +=> passed puzzle39.txt 39 4 0.08 +=> passed puzzle41.txt 41 5 0.20 +=> passed puzzle34.txt 34 4 0.16 +=> passed puzzle37.txt 37 4 0.16 +=> passed puzzle44.txt 44 5 0.21 +=> passed puzzle32.txt 32 4 0.30 +=> passed puzzle35.txt 35 4 0.32 +=> passed puzzle33.txt 33 4 0.65 +=> passed puzzle43.txt 43 4 0.71 +=> passed puzzle46.txt 46 4 0.62 +=> passed puzzle40.txt 40 4 0.79 +=> passed puzzle36.txt 36 4 1.50 +=> passed puzzle45.txt 45 4 1.52 +==> 25/25 tests passed + + + +Test 2: Count MinPQ operations + + filename insert() delMin() +--------------------------------------------------- +=> passed puzzle20.txt 1439 852 +=> passed puzzle22.txt 3481 2070 +=> passed puzzle21.txt 3541 2080 +=> passed puzzle23.txt 5299 3148 +=> passed puzzle24.txt 5427 3258 +=> passed puzzle25.txt 10316 6102 +=> passed puzzle27.txt 11209 6740 +=> passed puzzle29.txt 11637 7076 +=> passed puzzle26.txt 11894 7098 +=> passed puzzle28.txt 26974 16230 +=> passed puzzle30.txt 43094 26056 +=> passed puzzle31.txt 46007 27804 +=> passed puzzle39.txt 71417 35044 +=> passed puzzle41.txt 116491 50008 +=> passed puzzle34.txt 151673 73158 +=> passed puzzle37.txt 166811 80084 +=> passed puzzle44.txt 275661 123164 +=> passed puzzle32.txt 521596 249494 +=> passed puzzle35.txt 528418 257296 +=> passed puzzle33.txt 622352 298882 +=> passed puzzle43.txt 1056805 508832 +=> passed puzzle46.txt 1032320 516740 +=> passed puzzle40.txt 1108443 541466 +=> passed puzzle36.txt 2086331 1011484 +=> passed puzzle45.txt 2418079 1189752 +==> 25/25 tests passed + + + +Test 3: Count Board operations (that should not get called) + + filename hamming() toString() tileAt() +-------------------------------------------------------------- +=> passed puzzle20.txt 0 0 0 +=> passed puzzle22.txt 0 0 0 +=> passed puzzle21.txt 0 0 0 +=> passed puzzle23.txt 0 0 0 +=> passed puzzle24.txt 0 0 0 +=> passed puzzle25.txt 0 0 0 +=> passed puzzle27.txt 0 0 0 +=> passed puzzle29.txt 0 0 0 +=> passed puzzle26.txt 0 0 0 +=> passed puzzle28.txt 0 0 0 +=> passed puzzle30.txt 0 0 0 +=> passed puzzle31.txt 0 0 0 +=> passed puzzle39.txt 0 0 0 +=> passed puzzle41.txt 0 0 0 +=> passed puzzle34.txt 0 0 0 +=> passed puzzle37.txt 0 0 0 +=> passed puzzle44.txt 0 0 0 +=> passed puzzle32.txt 0 0 0 +=> passed puzzle35.txt 0 0 0 +=> passed puzzle33.txt 0 0 0 +=> passed puzzle43.txt 0 0 0 +=> passed puzzle46.txt 0 0 0 +=> passed puzzle40.txt 0 0 0 +=> passed puzzle36.txt 0 0 0 +=> passed puzzle45.txt 0 0 0 +==> 25/25 tests passed + + + +Test 4a: Count Board operations (that should get called) + + filename Board() equals() manhattan() +-------------------------------------------------------------------------- +=> passed puzzle20.txt 2289 2279 2291 +=> passed puzzle22.txt 5549 5543 5551 +=> passed puzzle21.txt 5619 5611 5621 +=> passed puzzle23.txt 8445 8437 8447 +=> passed puzzle24.txt 8683 8673 8685 +=> passed puzzle25.txt 16416 16408 16418 +=> passed puzzle27.txt 17947 17939 17949 +=> passed puzzle29.txt 18711 18703 18713 +=> passed puzzle26.txt 18990 18984 18992 +=> passed puzzle28.txt 43202 43192 43204 +=> passed puzzle30.txt 69148 69142 69150 +=> passed puzzle31.txt 73809 73801 73811 +=> passed puzzle39.txt 106459 106451 106461 +=> passed puzzle41.txt 166497 166487 166499 +=> passed puzzle34.txt 224829 224823 224831 +=> passed puzzle37.txt 246893 246885 246895 +=> passed puzzle44.txt 398823 398813 398825 +=> passed puzzle32.txt 771088 771078 771090 +=> passed puzzle35.txt 785712 785702 785714 +=> passed puzzle33.txt 921232 921224 921234 +=> passed puzzle43.txt 1565635 1565627 1565637 +=> passed puzzle46.txt 1549058 1549050 1549060 +=> passed puzzle40.txt 1649907 1649901 1649909 +=> passed puzzle36.txt 3097813 3097803 3097815 +=> passed puzzle45.txt 3607829 3607821 3607831 +==> 25/25 tests passed + + + +Test 4b: count Board operations (that should get called), + rejecting if doesn't adhere to stricter caching limits + + filename Board() equals() manhattan() +-------------------------------------------------------------------------- +=> passed puzzle20.txt 2289 2279 2291 +=> passed puzzle22.txt 5549 5543 5551 +=> passed puzzle21.txt 5619 5611 5621 +=> passed puzzle23.txt 8445 8437 8447 +=> passed puzzle24.txt 8683 8673 8685 +=> passed puzzle25.txt 16416 16408 16418 +=> passed puzzle27.txt 17947 17939 17949 +=> passed puzzle29.txt 18711 18703 18713 +=> passed puzzle26.txt 18990 18984 18992 +=> passed puzzle28.txt 43202 43192 43204 +=> passed puzzle30.txt 69148 69142 69150 +=> passed puzzle31.txt 73809 73801 73811 +=> passed puzzle39.txt 106459 106451 106461 +=> passed puzzle41.txt 166497 166487 166499 +=> passed puzzle34.txt 224829 224823 224831 +=> passed puzzle37.txt 246893 246885 246895 +=> passed puzzle44.txt 398823 398813 398825 +=> passed puzzle32.txt 771088 771078 771090 +=> passed puzzle35.txt 785712 785702 785714 +=> passed puzzle33.txt 921232 921224 921234 +=> passed puzzle43.txt 1565635 1565627 1565637 +=> passed puzzle46.txt 1549058 1549050 1549060 +=> passed puzzle40.txt 1649907 1649901 1649909 +=> passed puzzle36.txt 3097813 3097803 3097815 +=> passed puzzle45.txt 3607829 3607821 3607831 +==> 25/25 tests passed + + +Total: 125/125 tests passed! + + +================================================================ +