brutecollinearpoints
brutecollinearpoints from Pastebin
Brutecollinearpoints Pastebin
See the Assessment Guide for information on how to interpret this report.
ASSESSMENT SUMMARY
Compilation: PASSED
API: PASSED
Findbugs: FAILED (6 warnings)
PMD: PASSED
Checkstyle: FAILED (0 errors, 7 warnings)
Correctness: 22/41 tests passed
Memory: 1/1 tests passed
Timing: 41/41 tests passed
Aggregate score: 72.20%
[Compilation: 5%, API: 5%, Findbugs: 0%, PMD: 0%, Checkstyle: 0%, Correctness: 60%, Memory: 10%, Timing: 20%]
ASSESSMENT DETAILS
The following files were submitted:
----------------------------------
1.8K Dec 17 11:24 BruteCollinearPoints.java
2.0K Dec 17 11:24 FastCollinearPoints.java
3.9K Dec 17 11:24 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
*-----------------------------------------------------------
M C RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE RCN: Checks whether the variable 'points' is null [line 15], even though it can't be null because it was previously dereferenced. At BruteCollinearPoints.java:[line 14]
M V EI_EXPOSE_REP2 EI2: Stores a reference to an externally mutable object in the instance variable 'points', exposing the internal representation of the class 'BruteCollinearPoints'. Instead, create a defensive copy of the object referenced by the parameter variable 'points' and store that copy in the instance variable 'points'. At BruteCollinearPoints.java:[line 11]
M C RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE RCN: Checks whether the variable 'points' is null [line 14], even though it can't be null because it was previously dereferenced. At FastCollinearPoints.java:[line 13]
M V EI_EXPOSE_REP2 EI2: Stores a reference to an externally mutable object in the instance variable 'points', exposing the internal representation of the class 'FastCollinearPoints'. Instead, create a defensive copy of the object referenced by the parameter variable 'points' and store that copy in the instance variable 'points'. At FastCollinearPoints.java:[line 10]
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 33]
M P URF_UNREAD_FIELD UrF: The instance (or static) variable 'points' is never read. Consider removing it from the class. At BruteCollinearPoints.java:[line 11]
Warnings generated: 6
================================================================
% pmd .
*-----------------------------------------------------------
BruteCollinearPoints.java:6: Avoid unused private instance (or static) variables, such as 'points'. [UnusedPrivateField]
BruteCollinearPoints.java:6: Can you replace the instance (or static) variable 'points' with a local variable? [SingularField]
BruteCollinearPoints.java:6: The private instance (or static) variable 'points' can be made 'final'; it is initialized only in the declaration or constructor. [ImmutableField]
FastCollinearPoints.java:7: Can you replace the instance (or static) variable 'points' with a local variable? [SingularField]
FastCollinearPoints.java:7: The private instance (or static) variable 'points' can be made 'final'; it is initialized only in the declaration or constructor. [ImmutableField]
PMD ends with 5 warnings.
================================================================
% checkstyle *.java
*-----------------------------------------------------------
[WARN] BruteCollinearPoints.java:1:1: Unnecessary import statement for 'java.lang.IllegalArgumentException' because it is from the package 'java.lang'. [RedundantImport]
[WARN] BruteCollinearPoints.java:1:8: Unused import statement for 'java.lang.IllegalArgumentException'. [UnusedImports]
[WARN] BruteCollinearPoints.java:6:1: File contains tab characters (this is the first occurrence). Configure your editor to replace tabs with spaces. [FileTabCharacter]
[WARN] BruteCollinearPoints.java:33:34: Do not use the letter 'l' as a local variable name. It is hard to distinguish from the number '1'. [LocalVariableName]
[WARN] FastCollinearPoints.java:2:8: Unused import statement for 'java.util.Comparator'. [UnusedImports]
[WARN] FastCollinearPoints.java:5:1: File contains tab characters (this is the first occurrence). Configure your editor to replace tabs with spaces. [FileTabCharacter]
[WARN] Point.java:17:1: File contains tab characters (this is the first occurrence). Configure your editor to replace tabs with spaces. [FileTabCharacter]
Checkstyle ends with 0 errors and 7 warnings.
% 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
- data type mutated the points[] array
- data type should have no side effects unless documented in API
* equidistant.txt
- data type mutated the points[] array
- data type should have no side effects unless documented in API
==> FAILED
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
- constructor throws wrong exception
- constructor throws a java.lang.NullPointerException
- constructor should throw a java.lang.IllegalArgumentException
0
* Point[] of length 10, number of null entries = 1
- constructor throws wrong exception
- constructor throws a java.lang.NullPointerException
- constructor should throw a java.lang.IllegalArgumentException
10
25310 16809
28648 16307
null
4985 26386
893 29018
6689 13667
17270 29517
17930 14883
32089 28972
3758 9613
* Point[] of length 10, number of null entries = 10
- constructor throws wrong exception
- constructor throws a java.lang.NullPointerException
- constructor should throw a java.lang.IllegalArgumentException
10
null
null
null
null
null
null
null
null
null
null
* Point[] of length 4, number of null entries = 1
- constructor throws wrong exception
- constructor throws a java.lang.NullPointerException
- constructor should throw a java.lang.IllegalArgumentException
4
13319 19423
7481 27247
8573 19547
null
* Point[] of length 3, number of null entries = 1
- constructor throws wrong exception
- constructor throws a java.lang.NullPointerException
- constructor should throw a java.lang.IllegalArgumentException
3
null
4192 9297
31517 7540
* Point[] of length 2, number of null entries = 1
- constructor throws wrong exception
- constructor throws a java.lang.NullPointerException
- constructor should throw a java.lang.IllegalArgumentException
2
20280 17381
null
* Point[] of length 1, number of null entries = 1
==> FAILED
Test 14: check that the constructor throws an exception if duplicate points
* 50 points
- failed on trial 1 of 5
- constructor fails to throw a java.lang.IllegalArgumentException when passed duplicate points
* 25 points
- failed on trial 1 of 10
- constructor fails to throw a java.lang.IllegalArgumentException when passed duplicate points
* 5 points
- failed on trial 1 of 100
- constructor fails to throw a java.lang.IllegalArgumentException when passed duplicate points
5
7614 26686
30406 24021
14684 24462
11805 8863
14684 24462
* 4 points
- failed on trial 1 of 100
- constructor fails to throw a java.lang.IllegalArgumentException when passed duplicate points
4
21757 12334
26462 29724
26462 29724
17253 16967
* 3 points
- failed on trial 1 of 100
- constructor fails to throw a java.lang.IllegalArgumentException when passed duplicate points
3
24767 21343
19222 16155
19222 16155
* 2 points
- failed on trial 1 of 100
- constructor fails to throw a java.lang.IllegalArgumentException when passed duplicate points
2
29553 31305
29553 31305
==> FAILED
Total: 14/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
- number of entries in student solution: 0
- number of entries in reference solution: 2
- 2 missing entries in student solution, including: '(3000, 4000) -> (6000, 7000) -> (14000, 15000) -> (20000, 21000)'
* filename = equidistant.txt
- number of entries in student solution: 3
- number of entries in reference solution: 4
- 2 extra entries in student solution, including: '(9000, 6000) -> (30000, 0)'
- 3 missing entries in student solution, including: '(30000, 0) -> (20000, 10000) -> (10000, 20000) -> (0, 30000)'
* filename = input40.txt
- segments() contains the same segment more than once
- segment 3: (18000, 5000) -> (31000, 16000)
- segment 6: (18000, 5000) -> (31000, 16000)
- segments() contains a subsegment of a segment in reference solution
- student segment 10: (29000, 17000) -> (13000, 17000)
- reference segment 0: (1000, 17000) -> (13000, 17000) -> (17000, 17000) -> (29000, 17000)
- number of entries in student solution: 24
- number of entries in reference solution: 4
- 24 extra entries in student solution, including: '(29000, 17000) -> (13000, 17000)'
- 4 missing entries in student solution, including: '(2000, 29000) -> (4000, 29000) -> (22000, 29000) -> (28000, 29000)'
* filename = input48.txt
- segments() contains a subsegment of a segment in reference solution
- student segment 25: (15000, 19000) -> (9000, 1000)
- reference segment 3: (9000, 1000) -> (12000, 10000) -> (15000, 19000) -> (16000, 22000)
- number of entries in student solution: 27
- number of entries in reference solution: 6
- 27 extra entries in student solution, including: '(10000, 25000) -> (11000, 26000)'
- 6 missing entries in student solution, including: '(1000, 26000) -> (9000, 26000) -> (11000, 26000) -> (18000, 26000)'
* filename = input299.txt
- segments() contains a subsegment of a segment in reference solution
- student segment 0: (2950, 25400) -> (2950, 4050)
- reference segment 4: (2950, 200) -> (2950, 4050) -> (2950, 5600) -> (2950, 25400)
- number of entries in student solution: 36
- number of entries in reference solution: 6
- 36 extra entries in student solution, including: '(19200, 17850) -> (23350, 24950)'
- 6 missing entries in student solution, including: '(3250, 17450) -> (8500, 17450) -> (13400, 17450) -> (17250, 17450)'
==> FAILED
Test 2a: points from a file with horizontal line segments
* filename = horizontal5.txt
- segments() contains a subsegment of a segment in reference solution
- student segment 4: (13291, 7996) -> (20547, 7996)
- reference segment 2: (8934, 7996) -> (10411, 7996) -> (13291, 7996) -> (20547, 7996)
- number of entries in student solution: 11
- number of entries in reference solution: 5
- 11 extra entries in student solution, including: '(13291, 7996) -> (2682, 14118)'
- 5 missing entries in student solution, including: '(2682, 14118) -> (5067, 14118) -> (7453, 14118) -> (7821, 14118)'
* filename = horizontal25.txt
- segments() contains a subsegment of a segment in reference solution
- student segment 42: (16696, 13497) -> (2387, 13497)
- reference segment 12: (2387, 13497) -> (3728, 13497) -> (16696, 13497) -> (19135, 13497)
- number of entries in student solution: 83
- number of entries in reference solution: 25
- 83 extra entries in student solution, including: '(11738, 16561) -> (20780, 20333)'
- 25 missing entries in student solution, including: '(8784, 20913) -> (9880, 20913) -> (16352, 20913) -> (19666, 20913)'
* filename = horizontal50.txt
- segments() contains the same segment more than once
- segment 54: (9037, 9809) -> (11218, 14194)
- segment 177: (9037, 9809) -> (11218, 14194)
- number of entries in student solution: 185
- number of entries in reference solution: 50
- 185 extra entries in student solution, including: '(12081, 14089) -> (13201, 18776)'
- 50 missing entries in student solution, including: '(5249, 20754) -> (5559, 20754) -> (14800, 20754) -> (17428, 20754)'
* filename = horizontal75.txt
- segments() contains the same segment more than once
- segment 43: (6168, 6620) -> (12634, 4019)
- segment 158: (6168, 6620) -> (12634, 4019)
- segments() contains a subsegment of a segment in reference solution
- student segment 122: (6658, 10307) -> (17334, 10307)
- reference segment 38: (1988, 10307) -> (4413, 10307) -> (6658, 10307) -> (17334, 10307)
- number of entries in student solution: 256
- number of entries in reference solution: 75
- 256 extra entries in student solution, including: '(19234, 18306) -> (12390, 19721)'
- 75 missing entries in student solution, including: '(1536, 20976) -> (6545, 20976) -> (14178, 20976) -> (14591, 20976)'
* filename = horizontal100.txt
- segments() contains the same segment more than once
- segment 62: (12965, 5505) -> (6681, 8650)
- segment 113: (12965, 5505) -> (6681, 8650)
- segments() contains a subsegment of a segment in reference solution
- student segment 197: (20409, 10339) -> (4905, 10339)
- reference segment 52: (3798, 10339) -> (3908, 10339) -> (4905, 10339) -> (20409, 10339)
- number of entries in student solution: 395
- number of entries in reference solution: 100
- 395 extra entries in student solution, including: '(5686, 16284) -> (7211, 17293)'
- 100 missing entries in student solution, including: '(5835, 20698) -> (7673, 20698) -> (16154, 20698) -> (19642, 20698)'
==> FAILED
Test 2b: random horizontal line segments
* 1 random horizontal line segment
- number of entries in student solution: 0
- number of entries in reference solution: 1
- 1 missing entry in student solution: '(1208, 9240) -> (7959, 9240) -> (9398, 9240) -> (17064, 9240)'
- failed on trial 1 of 500
4
1208 9240
7959 9240
9398 9240
17064 9240
* 5 random horizontal line segments
- number of entries in student solution: 9
- number of entries in reference solution: 5
- 9 extra entries in student solution, including: '(17232, 14676) -> (9919, 13579)'
- 5 missing entries in student solution, including: '(1261, 20108) -> (4498, 20108) -> (8517, 20108) -> (10474, 20108)'
- failed on trial 1 of 250
20
5664 1711
1146 2791
7352 14676
16470 13579
1439 13579
9919 13579
11138 2791
1261 20108
10474 20108
4914 2791
16352 14676
2194 1711
20092 1711
1250 2791
19504 13579
8517 20108
9552 1711
3523 14676
4498 20108
17232 14676
* 10 random horizontal line segments
- segments() contains the same segment more than once
- segment 0: (9268, 1310) -> (2108, 17369)
- segment 24: (9268, 1310) -> (2108, 17369)
- segments() contains a subsegment of a segment in reference solution
- student segment 16: (13182, 10572) -> (2558, 10572)
- reference segment 5: (2558, 10572) -> (10064, 10572) -> (13182, 10572) -> (20252, 10572)
- number of entries in student solution: 35
- number of entries in reference solution: 10
- 35 extra entries in student solution, including: '(7673, 12708) -> (1080, 20821)'
- 10 missing entries in student solution, including: '(1080, 20821) -> (7532, 20821) -> (11941, 20821) -> (18887, 20821)'
- failed on trial 1 of 50
* 15 random horizontal line segments
- segments() contains the same segment more than once
- segment 0: (3312, 12211) -> (9126, 3295)
- segment 2: (3312, 12211) -> (9126, 3295)
- segments() contains a subsegment of a segment in reference solution
- student segment 24: (14881, 13012) -> (11676, 13012)
- reference segment 8: (11676, 13012) -> (14881, 13012) -> (15047, 13012) -> (19260, 13012)
- number of entries in student solution: 53
- number of entries in reference solution: 15
- 53 extra entries in student solution, including: '(14881, 13012) -> (11676, 13012)'
- 15 missing entries in student solution, including: '(1483, 20399) -> (4383, 20399) -> (5306, 20399) -> (15581, 20399)'
- failed on trial 1 of 5
==> FAILED
Test 3a: points from a file with vertical line segments
* filename = vertical5.txt
- number of entries in student solution: 0
- number of entries in reference solution: 5
- 5 missing entries in student solution, including: '(14407, 10367) -> (14407, 17188) -> (14407, 17831) -> (14407, 19953)'
* filename = vertical25.txt
- number of entries in student solution: 0
- number of entries in reference solution: 25
- 25 missing entries in student solution, including: '(19953, 10489) -> (19953, 10688) -> (19953, 19299) -> (19953, 20439)'
* filename = vertical50.txt
- number of entries in student solution: 1
- number of entries in reference solution: 50
- 1 extra entry in student solution: '(10209, 12125) -> (19431, 11379)'
- 50 missing entries in student solution, including: '(5991, 15606) -> (5991, 20227) -> (5991, 20340) -> (5991, 20424)'
* filename = vertical75.txt
- number of entries in student solution: 1
- number of entries in reference solution: 75
- 74 missing entries in student solution, including: '(13780, 16365) -> (13780, 17494) -> (13780, 18253) -> (13780, 18908)'
* filename = vertical100.txt
- number of entries in student solution: 3
- number of entries in reference solution: 100
- 3 extra entries in student solution, including: '(14423, 8984) -> (17124, 10369)'
- 100 missing entries in student solution, including: '(15135, 15588) -> (15135, 17398) -> (15135, 19476) -> (15135, 20439)'
==> FAILED
Test 3b: random vertical line segments
* 1 random vertical line segment
- number of entries in student solution: 0
- number of entries in reference solution: 1
- 1 missing entry in student solution: '(16495, 1326) -> (16495, 3531) -> (16495, 6618) -> (16495, 17914)'
- failed on trial 1 of 500
4
16495 6618
16495 3531
16495 1326
16495 17914
* 5 random vertical line segments
- number of entries in student solution: 0
- number of entries in reference solution: 5
- 5 missing entries in student solution, including: '(5398, 3875) -> (5398, 3930) -> (5398, 11042) -> (5398, 14075)'
- failed on trial 1 of 250
20
16849 10545
19791 14036
16849 8622
19791 16004
5398 11042
4090 17299
3472 4277
19791 9375
4090 3362
3472 9496
3472 3255
4090 20493
19791 2117
16849 10100
5398 14075
3472 2555
5398 3930
4090 4386
5398 3875
16849 3122
* 10 random vertical line segments
- number of entries in student solution: 0
- number of entries in reference solution: 10
- 10 missing entries in student solution, including: '(1856, 8977) -> (1856, 13297) -> (1856, 19935) -> (1856, 19949)'
- failed on trial 1 of 50
* 15 random vertical line segments
- number of entries in student solution: 0
- number of entries in reference solution: 15
- 15 missing entries in student solution, including: '(16183, 12167) -> (16183, 17950) -> (16183, 18400) -> (16183, 19232)'
- failed on trial 1 of 5
==> FAILED
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
- number of entries in student solution: 0
- number of entries in reference solution: 1
- 1 missing entry in student solution: '(1000, 1000) -> (2000, 2000) -> (3000, 3000) -> (4000, 4000) -> (5000, 5000) -> (6000, 6000) -> (7000, 7000) -> (8000, 8000) -> (9000, 9000)'
* filename = input10.txt
- number of entries in student solution: 0
- number of entries in reference solution: 2
- 2 missing entries in student solution, including: '(1000, 18000) -> (2000, 22000) -> (3000, 26000) -> (3500, 28000) -> (4000, 30000)'
* filename = input20.txt
- number of entries in student solution: 5
- number of entries in reference solution: 5
- 3 extra entries in student solution, including: '(7168, 20992) -> (8192, 29184)'
- 3 missing entries in student solution, including: '(4160, 29184) -> (5120, 29184) -> (6144, 29184) -> (7168, 29184) -> (8192, 29184)'
* filename = input50.txt
- segments() contains a subsegment of a segment in reference solution
- student segment 18: (9000, 1000) -> (15000, 19000)
- reference segment 4: (9000, 1000) -> (12000, 10000) -> (15000, 19000) -> (16000, 22000)
- number of entries in student solution: 23
- number of entries in reference solution: 7
- 23 extra entries in student solution, including: '(3000, 23000) -> (11000, 26000)'
- 7 missing entries in student solution, including: '(1000, 26000) -> (9000, 26000) -> (11000, 26000) -> (18000, 26000)'
* filename = input80.txt
- segments() contains a subsegment of a segment in reference solution
- student segment 12: (12000, 10000) -> (17000, 5000)
- reference segment 2: (17000, 5000) -> (16000, 6000) -> (12000, 10000) -> (9000, 13000) -> (1000, 21000)
- number of entries in student solution: 42
- number of entries in reference solution: 31
- 41 extra entries in student solution, including: '(21000, 23000) -> (24000, 22000)'
- 30 missing entries in student solution, including: '(13000, 29000) -> (19000, 29000) -> (25000, 29000) -> (28000, 29000)'
* filename = input300.txt
- number of entries in student solution: 42
- number of entries in reference solution: 6
- 42 extra entries in student solution, including: '(18750, 18250) -> (19200, 17850)'
- 6 missing entries in student solution, including: '(3250, 17450) -> (8500, 17450) -> (13400, 17450) -> (17250, 17450)'
* filename = inarow.txt
- number of entries in student solution: 2
- number of entries in reference solution: 5
- 2 extra entries in student solution, including: '(5000, 0) -> (20000, 25000)'
- 5 missing entries in student solution, including: '(30000, 0) -> (27000, 7500) -> (26000, 10000) -> (20000, 25000) -> (19000, 27500) -> (18000, 30000)'
==> FAILED
Test 5b: points from a file with 5 or more on some line segments
* filename = kw1260.txt
- segments() contains the same segment more than once
- segment 154: (17094, 13433) -> (15229, 19769)
- segment 184: (17094, 13433) -> (15229, 19769)
- number of entries in student solution: 1143
- number of entries in reference solution: 288
- 1143 extra entries in student solution, including: '(16753, 22704) -> (15966, 19981)'
- 288 missing entries in student solution, including: '(12652, 30395) -> (13180, 30413) -> (13708, 30431) -> (14236, 30449) -> (14764, 30467)'
* filename = rs1423.txt
- number of entries in student solution: 82
- number of entries in reference solution: 443
- 82 extra entries in student solution, including: '(15722, 17579) -> (16668, 21759)'
- 443 missing entries in student solution, including: '(12273, 27915) -> (12663, 27972) -> (13053, 28029) -> (13443, 28086)'
==> FAILED
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
- number of entries in student solution: 0
- number of entries in reference solution: 4
- 4 missing entries in student solution, including: '(30000, 0) -> (20000, 10000) -> (10000, 20000) -> (0, 30000)'
* filename = input40.txt
- number of entries in student solution: 0
- number of entries in reference solution: 4
- 4 missing entries in student solution, including: '(2000, 29000) -> (4000, 29000) -> (22000, 29000) -> (28000, 29000)'
* filename = input48.txt
- number of entries in student solution: 0
- number of entries in reference solution: 6
- 6 missing entries in student solution, including: '(1000, 26000) -> (9000, 26000) -> (11000, 26000) -> (18000, 26000)'
* filename = input299.txt
- number of entries in student solution: 0
- number of entries in reference solution: 6
- 6 missing entries in student solution, including: '(3250, 17450) -> (8500, 17450) -> (13400, 17450) -> (17250, 17450)'
==> FAILED
Test 8: check for fragile dependence on return value of toString()
* filename = equidistant.txt
- number of entries in student solution: 3
- number of entries in reference solution: 4
- 2 extra entries in student solution, including: '(9000, 6000) -> (30000, 0)'
- 3 missing entries in student solution, including: '(30000, 0) -> (20000, 10000) -> (10000, 20000) -> (0, 30000)'
* filename = input40.txt
- segments() contains the same segment more than once
- segment 3: (18000, 5000) -> (31000, 16000)
- segment 6: (18000, 5000) -> (31000, 16000)
- segments() contains a subsegment of a segment in reference solution
- student segment 10: (29000, 17000) -> (13000, 17000)
- reference segment 0: (1000, 17000) -> (13000, 17000) -> (17000, 17000) -> (29000, 17000)
- number of entries in student solution: 24
- number of entries in reference solution: 4
- 24 extra entries in student solution, including: '(29000, 17000) -> (13000, 17000)'
- 4 missing entries in student solution, including: '(2000, 29000) -> (4000, 29000) -> (22000, 29000) -> (28000, 29000)'
* filename = input48.txt
- segments() contains a subsegment of a segment in reference solution
- student segment 25: (15000, 19000) -> (9000, 1000)
- reference segment 3: (9000, 1000) -> (12000, 10000) -> (15000, 19000) -> (16000, 22000)
- number of entries in student solution: 27
- number of entries in reference solution: 6
- 27 extra entries in student solution, including: '(10000, 25000) -> (11000, 26000)'
- 6 missing entries in student solution, including: '(1000, 26000) -> (9000, 26000) -> (11000, 26000) -> (18000, 26000)'
It is bad style to write code that depends on the particular format of
the output from the toString() method, especially if your reason for
doing so is to circumvent the public API (which intentionally does not
provide access to the x- and y-coordinates).
==> FAILED
Test 9: random line segments, none vertical or horizontal
* 1 random line segment
- number of entries in student solution: 0
- number of entries in reference solution: 1
- 1 missing entry in student solution: '(8108, 2486) -> (13028, 6041) -> (14996, 7463) -> (22868, 13151)'
- failed on trial 1 of 500
4
22868 13151
14996 7463
13028 6041
8108 2486
* 5 random line segments
- number of entries in student solution: 0
- number of entries in reference solution: 5
- 5 missing entries in student solution, including: '(953, 9069) -> (9033, 13939) -> (13073, 16374) -> (13881, 16861)'
- failed on trial 1 of 500
20
9554 7056
9033 13939
5816 6188
11173 12516
5323 4758
9020 6932
13073 16374
17968 17362
953 9069
6374 2334
9223 9930
7676 3870
4673 3896
11830 9406
8356 7502
9376 12950
13881 16861
19332 19130
16496 8668
6996 238
* 25 random line segments
- number of entries in student solution: 0
- number of entries in reference solution: 25
- 25 missing entries in student solution, including: '(2882, 12992) -> (7514, 13982) -> (10602, 14642) -> (11374, 14807)'
- failed on trial 1 of 100
* 50 random line segments
- number of entries in student solution: 0
- number of entries in reference solution: 50
- 50 missing entries in student solution, including: '(12373, 14010) -> (13289, 14675) -> (15121, 16005) -> (21533, 20660)'
- failed on trial 1 of 15
* 100 random line segments
- number of entries in student solution: 1
- number of entries in reference solution: 100
- 1 extra entry in student solution: '(7497, 8129) -> (2051, 3560)'
- 100 missing entries in student solution, including: '(11017, 14777) -> (12683, 16447) -> (15182, 18952) -> (17681, 21457)'
- failed on trial 1 of 2
==> FAILED
Test 10: random line segments
* 1 random line segment
- number of entries in student solution: 0
- number of entries in reference solution: 1
- 1 missing entry in student solution: '(10007, 4983) -> (10722, 5346) -> (12412, 6204) -> (12477, 6237)'
- failed on trial 1 of 500
4
12477 6237
12412 6204
10722 5346
10007 4983
* 5 random line segments
- number of entries in student solution: 1
- number of entries in reference solution: 5
- 1 extra entry in student solution: '(6099, 5376) -> (8813, 6865)'
- 5 missing entries in student solution, including: '(406, 9732) -> (1114, 10332) -> (2766, 11732) -> (5952, 14432)'
- failed on trial 1 of 500
20
1114 10332
6141 5471
5842 4701
4965 2811
12766 6865
6099 5376
5964 4785
7611 5919
8411 6865
6792 4686
8813 6865
12726 5514
5952 14432
4083 816
11780 5382
6940 5457
5846 4554
2766 11732
406 9732
11761 6865
* 25 random line segments
- number of entries in student solution: 11
- number of entries in reference solution: 25
- 11 extra entries in student solution, including: '(12911, 9017) -> (12023, 8503)'
- 25 missing entries in student solution, including: '(12669, 14546) -> (12669, 14684) -> (12669, 14696) -> (12669, 14924)'
- failed on trial 1 of 100
* 50 random line segments
- number of entries in student solution: 15
- number of entries in reference solution: 50
- 15 extra entries in student solution, including: '(9474, 6965) -> (5620, 13130)'
- 50 missing entries in student solution, including: '(7365, 13260) -> (7785, 13260) -> (8401, 13260) -> (8513, 13260)'
- failed on trial 1 of 15
* 100 random line segments
- number of entries in student solution: 25
- number of entries in reference solution: 100
- 25 extra entries in student solution, including: '(9167, 11579) -> (6940, 14253)'
- 100 missing entries in student solution, including: '(10667, 14651) -> (10957, 14681) -> (12030, 14792) -> (12088, 14798)'
- failed on trial 1 of 2
==> FAILED
Test 11: random distinct points in a given range
* 5 random points in a 10-by-10 grid
- number of entries in student solution: 1
- number of entries in reference solution: 0
- 1 extra entry in student solution: '(8, 5) -> (0, 5)'
- failed on trial 12 of 500
5
0 5
3 9
8 5
5 6
6 5
* 10 random points in a 10-by-10 grid
- number of entries in student solution: 1
- number of entries in reference solution: 0
- 1 extra entry in student solution: '(1, 3) -> (1, 4)'
- failed on trial 1 of 500
10
1 4
3 4
8 9
4 2
1 3
0 3
4 3
6 4
9 0
5 7
* 50 random points in a 10-by-10 grid
- segments() contains the same segment more than once
- segment 32: (6, 4) -> (5, 3)
- segment 53: (6, 4) -> (5, 3)
- segments() contains a subsegment of a segment in reference solution
- student segment 4: (3, 0) -> (5, 3)
- reference segment 38: (3, 0) -> (5, 3) -> (7, 6) -> (9, 9)
- number of entries in student solution: 81
- number of entries in reference solution: 50
- 80 extra entries in student solution, including: '(9, 4) -> (9, 5)'
- 49 missing entries in student solution, including: '(0, 8) -> (1, 8) -> (2, 8) -> (3, 8) -> (4, 8)'
- failed on trial 1 of 100
* 90 random points in a 10-by-10 grid
- segments() contains the same segment more than once
- segment 20: (3, 5) -> (2, 0)
- segment 65: (3, 5) -> (2, 0)
- segments() contains a subsegment of a segment in reference solution
- student segment 8: (1, 2) -> (7, 5)
- reference segment 69: (1, 2) -> (3, 3) -> (5, 4) -> (7, 5) -> (9, 6)
- number of entries in student solution: 269
- number of entries in reference solution: 130
- 263 extra entries in student solution, including: '(6, 6) -> (9, 8)'
- 124 missing entries in student solution, including: '(2, 9) -> (3, 9) -> (4, 9) -> (5, 9) -> (6, 9) -> (7, 9) -> (8, 9) -> (9, 9)'
- failed on trial 1 of 50
* 200 random points in a 50-by-50 grid
- segments() contains the same segment more than once
- segment 0: (11, 12) -> (40, 42)
- segment 3: (11, 12) -> (40, 42)
- segments() contains a subsegment of a segment in reference solution
- student segment 25: (13, 10) -> (21, 15)
- reference segment 130: (5, 5) -> (13, 10) -> (21, 15) -> (29, 20)
- number of entries in student solution: 248
- number of entries in reference solution: 208
- 245 extra entries in student solution, including: '(10, 42) -> (18, 40)'
- 205 missing entries in student solution, including: '(1, 49) -> (12, 49) -> (35, 49) -> (38, 49) -> (43, 49)'
- failed on trial 1 of 10
==> FAILED
Test 12: m*n points on an m-by-n grid
* 3-by-3 grid
- segments() contains the same segment more than once
- segment 0: (1, 1) -> (2, 1)
- segment 1: (1, 1) -> (2, 1)
- number of entries in student solution: 4
- number of entries in reference solution: 0
- 4 extra entries in student solution, including: '(1, 1) -> (2, 1)'
* 4-by-4 grid
- segments() contains the same segment more than once
- segment 6: (2, 1) -> (3, 1)
- segment 7: (2, 1) -> (3, 1)
- segments() contains a subsegment of a segment in reference solution
- student segment 1: (1, 1) -> (0, 0)
- reference segment 5: (0, 0) -> (1, 1) -> (2, 2) -> (3, 3)
- number of entries in student solution: 12
- number of entries in reference solution: 10
- 10 extra entries in student solution, including: '(2, 1) -> (3, 2)'
- 8 missing entries in student solution, including: '(0, 3) -> (1, 3) -> (2, 3) -> (3, 3)'
* 5-by-5 grid
- segments() contains the same segment more than once
- segment 0: (1, 0) -> (3, 4)
- segment 14: (1, 0) -> (3, 4)
- segments() contains a subsegment of a segment in reference solution
- student segment 3: (2, 0) -> (2, 2)
- reference segment 13: (2, 0) -> (2, 1) -> (2, 2) -> (2, 3) -> (2, 4)
- number of entries in student solution: 23
- number of entries in reference solution: 16
- 21 extra entries in student solution, including: '(3, 2) -> (4, 4)'
- 14 missing entries in student solution, including: '(0, 4) -> (1, 4) -> (2, 4) -> (3, 4) -> (4, 4)'
* 10-by-10 grid
- segments() contains the same segment more than once
- segment 13: (3, 7) -> (1, 2)
- segment 117: (3, 7) -> (1, 2)
- segments() contains a subsegment of a segment in reference solution
- student segment 10: (1, 2) -> (6, 7)
- reference segment 111: (0, 1) -> (1, 2) -> (2, 3) -> (3, 4) -> (4, 5) -> (5, 6) -> (6, 7) -> (7, 8) -> (8, 9)
- number of entries in student solution: 337
- number of entries in reference solution: 154
- 318 extra entries in student solution, including: '(6, 7) -> (9, 6)'
- 135 missing entries in student solution, including: '(0, 9) -> (1, 9) -> (2, 9) -> (3, 9) -> (4, 9) -> (5, 9) -> (6, 9) -> (7, 9) -> (8, 9) -> (9, 9)'
* 20-by-20 grid
- segments() contains the same segment more than once
- segment 131: (13, 9) -> (4, 1)
- segment 492: (13, 9) -> (4, 1)
- segments() contains a subsegment of a segment in reference solution
- student segment 20: (1, 2) -> (16, 17)
- reference segment 1825: (0, 1) -> (1, 2) -> (2, 3) -> (3, 4) -> (4, 5) -> (5, 6) -> (6, 7) -> (7, 8) -> (8, 9) -> (9, 10) -> (10, 11) -> (11, 12) -> (12, 13) -> (13, 14) -> (14, 15) -> (15, 16) -> (16, 17) -> (17, 18) -> (18, 19)
- number of entries in student solution: 3449
- number of entries in reference solution: 2446
- 3333 extra entries in student solution, including: '(9, 17) -> (18, 19)'
- 2330 missing entries in student solution, including: '(0, 19) -> (1, 19) -> (2, 19) -> (3, 19) -> (4, 19) -> (5, 19) -> (6, 19) -> (7, 19) -> (8, 19) -> (9, 19) -> (10, 19) -> (11, 19) -> (12, 19) -> (13, 19) -> (14, 19) -> (15, 19) -> (16, 19) -> (17, 19) -> (18, 19) -> (19, 19)'
* 5-by-4 grid
- segments() contains the same segment more than once
- segment 9: (2, 1) -> (3, 1)
- segment 10: (2, 1) -> (3, 1)
- segments() contains a subsegment of a segment in reference solution
- student segment 2: (1, 1) -> (0, 0)
- reference segment 7: (0, 0) -> (1, 1) -> (2, 2) -> (3, 3)
- number of entries in student solution: 22
- number of entries in reference solution: 13
- 18 extra entries in student solution, including: '(2, 1) -> (4, 2)'
- 9 missing entries in student solution, including: '(0, 3) -> (1, 3) -> (2, 3) -> (3, 3) -> (4, 3)'
* 6-by-4 grid
- segments() contains a subsegment of a segment in reference solution
- student segment 3: (1, 1) -> (0, 0)
- reference segment 9: (0, 0) -> (1, 1) -> (2, 2) -> (3, 3)
- number of entries in student solution: 28
- number of entries in reference solution: 16
- 24 extra entries in student solution, including: '(5, 1) -> (5, 2)'
- 12 missing entries in student solution, including: '(0, 3) -> (1, 3) -> (2, 3) -> (3, 3) -> (4, 3) -> (5, 3)'
* 10-by-4 grid
- segments() contains the same segment more than once
- segment 9: (2, 1) -> (5, 2)
- segment 44: (2, 1) -> (5, 2)
- segments() contains a subsegment of a segment in reference solution
- student segment 4: (1, 1) -> (0, 0)
- reference segment 27: (0, 0) -> (1, 1) -> (2, 2) -> (3, 3)
- number of entries in student solution: 79
- number of entries in reference solution: 38
- 69 extra entries in student solution, including: '(9, 1) -> (9, 2)'
- 28 missing entries in student solution, including: '(0, 3) -> (1, 3) -> (2, 3) -> (3, 3) -> (4, 3) -> (5, 3) -> (6, 3) -> (7, 3) -> (8, 3) -> (9, 3)'
* 15-by-4 grid
- segments() contains the same segment more than once
- segment 48: (11, 0) -> (8, 3)
- segment 74: (11, 0) -> (8, 3)
- segments() contains a subsegment of a segment in reference solution
- student segment 6: (1, 1) -> (0, 0)
- reference segment 63: (0, 0) -> (1, 1) -> (2, 2) -> (3, 3)
- number of entries in student solution: 196
- number of entries in reference solution: 79
- 177 extra entries in student solution, including: '(5, 3) -> (0, 2)'
- 60 missing entries in student solution, including: '(0, 3) -> (1, 3) -> (2, 3) -> (3, 3) -> (4, 3) -> (5, 3) -> (6, 3) -> (7, 3) -> (8, 3) -> (9, 3) -> (10, 3) -> (11, 3) -> (12, 3) -> (13, 3) -> (14, 3)'
* 25-by-4 grid
- segments() contains the same segment more than once
- segment 40: (8, 2) -> (4, 0)
- segment 121: (8, 2) -> (4, 0)
- segments() contains a subsegment of a segment in reference solution
- student segment 9: (1, 1) -> (0, 0)
- reference segment 187: (0, 0) -> (1, 1) -> (2, 2) -> (3, 3)
- number of entries in student solution: 565
- number of entries in reference solution: 213
- 497 extra entries in student solution, including: '(5, 3) -> (0, 2)'
- 145 missing entries in student solution, including: '(0, 3) -> (1, 3) -> (2, 3) -> (3, 3) -> (4, 3) -> (5, 3) -> (6, 3) -> (7, 3) -> (8, 3) -> (9, 3) -> (10, 3) -> (11, 3) -> (12, 3) -> (13, 3) -> (14, 3) -> (15, 3) -> (16, 3) -> (17, 3) -> (18, 3) -> (19, 3) -> (20, 3) -> (21, 3) -> (22, 3) -> (23, 3) -> (24, 3)'
==> FAILED
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
- data type mutated the points[] array
- data type should have no side effects unless documented in API
* equidistant.txt
- data type mutated the points[] array
- data type should have no side effects unless documented in API
==> FAILED
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
- constructor throws wrong exception
- constructor throws a java.lang.NullPointerException
- constructor should throw a java.lang.IllegalArgumentException
0
* Point[] of length 10, number of null entries = 1
- constructor throws wrong exception
- constructor throws a java.lang.NullPointerException
- constructor should throw a java.lang.IllegalArgumentException
10
10381 27494
17506 15027
7452 13562
21760 6418
25079 31607
28937 30333
9872 23778
29494 21238
832 14160
null
* Point[] of length 10, number of null entries = 10
- constructor throws wrong exception
- constructor throws a java.lang.NullPointerException
- constructor should throw a java.lang.IllegalArgumentException
10
null
null
null
null
null
null
null
null
null
null
* Point[] of length 4, number of null entries = 1
- constructor throws wrong exception
- constructor throws a java.lang.NullPointerException
- constructor should throw a java.lang.IllegalArgumentException
4
null
13248 18050
11346 17835
16562 31497
* Point[] of length 3, number of null entries = 1
- constructor throws wrong exception
- constructor throws a java.lang.NullPointerException
- constructor should throw a java.lang.IllegalArgumentException
3
31253 5814
null
28401 273
* Point[] of length 2, number of null entries = 1
- constructor throws wrong exception
- constructor throws a java.lang.NullPointerException
- constructor should throw a java.lang.IllegalArgumentException
2
null
1137 3914
* Point[] of length 1, number of null entries = 1
==> FAILED
Test 17: check that the constructor throws an exception if duplicate points
* 50 points
- failed on trial 1 of 5
- constructor fails to throw a java.lang.IllegalArgumentException when passed duplicate points
* 25 points
- failed on trial 1 of 10
- constructor fails to throw a java.lang.IllegalArgumentException when passed duplicate points
* 5 points
- failed on trial 1 of 100
- constructor fails to throw a java.lang.IllegalArgumentException when passed duplicate points
5
15466 20869
27392 5269
29102 9279
17088 23569
27392 5269
* 4 points
- failed on trial 1 of 100
- constructor fails to throw a java.lang.IllegalArgumentException when passed duplicate points
4
28963 17473
25718 11422
236 17142
28963 17473
* 3 points
- failed on trial 1 of 100
- constructor fails to throw a java.lang.IllegalArgumentException when passed duplicate points
3
29932 9863
29932 9863
12601 6845
* 2 points
- failed on trial 1 of 100
- constructor fails to throw a java.lang.IllegalArgumentException when passed duplicate points
2
21974 5553
21974 5553
==> FAILED
Total: 5/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 0 455 910 47
=> passed 32 0.00 0 4495 8990 120
=> passed 64 0.00 0 39711 79422 304
=> passed 128 0.01 0 333375 666750 734
=> passed 256 0.04 0 2731135 5462270 1739
==> 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 0 544 1088 45
=> passed 32 0.00 0 4872 9744 119
=> passed 64 0.00 0 41340 82680 307
=> passed 128 0.02 0 339992 679984 735
=> passed 256 0.04 0 2757984 5515968 1723
==> 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 4096 18878 41852 295
=> passed 128 0.01 16388 89788 195964 732
=> passed 256 0.02 65542 413712 892966 1739
=> passed 512 0.20 262146 1898194 4058534 4001
=> passed 1024 0.31 1048605 8591025 18230655 8977
=> passed 2048 0.94 4194440 38092387 80379214 20076
==> 6/6 tests passed
lg ratio(slopeTo() + 2*compare()) = lg (80379214 / 18230655) = 2.14
=> 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 8128 4764 17656 311
=> passed 128 0.00 32640 17796 68232 732
=> passed 256 0.00 130816 68717 268250 1739
=> passed 512 0.01 523776 269399 1062574 3976
=> passed 1024 0.03 2096128 1065026 4226180 8956
=> passed 2048 0.07 8386560 4231214 16848988 19951
=> passed 4096 0.25 33550336 16859163 67268662 44047
==> 7/7 tests passed
lg ratio(slopeTo() + 2*compare()) = lg (67268662 / 16848988) = 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 5056 17309 39674 673
=> passed 128 0.00 20352 73090 166532 2365
=> passed 256 0.01 81664 281323 644310 8277
=> passed 512 0.03 327168 1095711 2518590 30792
=> passed 1024 0.09 1309696 4305441 9920578 115695
=> passed 2048 0.32 5240832 17121062 39482956 450211
=> passed 4096 1.21 20967424 68097182 157161788 1759214
==> 7/7 tests passed
lg ratio(slopeTo() + 2*compare()) = lg (157161788 / 39482956) = 1.99
=> 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() compar
...
WARNING: the grading output was truncated due to excessive length.
Typically, this is because you have a method that has an unanticipated side effect
(such as printing to standard output or throwing an exception). A large amount of output
can also arise from failing many tests.