|
|
Line 39: |
Line 39: |
| | | |
| ==SML== | | ==SML== |
− | {{SMLUnitTest|sum_distances_to_origin|warmup_sum_distances_to_origin}} | + | {{SMLUnitTesting|run_sum_distances_to_origin_testing|warmup_sum_distances_to_origin}} |
Revision as of 14:18, 31 August 2022
Group Warmup
Background
Pythagorean theorem
a^2 + b^2 = c^2
SML
Math.sqrt(x)
Java
Math.sqrt(x)
Code To Implement
Java
class: |
SumDistancesToOrigin.java |
![Java.png](/cse425s/images/thumb/2/26/Java.png/32px-Java.png) |
methods: |
sumDistancesToOrigin |
package: |
distance.warmup |
source folder: |
src/main/java |
Math.sqrt(v)
public static double sumDistancesToOrigin(ImList<ImTuple2<Double, Double>> xys)
SML
file: |
src/main/sml/warmup_sum_distances_to_origin/sum_distances_to_origin.sml |
![Smlnj-logo.png](/cse425s/images/thumb/a/ad/Smlnj-logo.png/32px-Smlnj-logo.png) |
functions: |
sum_distances_to_origin |
Math.sqrt(v)
fun sum_distances_to_origin(xys)
Test
Java
class: |
SumDistancesToOriginTestSuite.java |
![Junit.png](/cse425s/images/thumb/6/64/Junit.png/48px-Junit.png) |
package: |
distance.warmup |
source folder: |
src/test/java |
SML
source folder: |
src/test/sml/warmup_sum_distances_to_origin |
how to run with CM.make verbosity off: |
sml -Ccm.verbose=false run_sum_distances_to_origin_testing.sml |
how to run with CM.make verbosity on: |
sml run_sum_distances_to_origin_testing.sml |
note: ensure that you have removed all printing to receive credit for any assignment.
SML Error Messages