Last active
August 29, 2015 13:57
-
-
Save pscollins/9769149 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* In util.pml: *) | |
structure PArrayPair = struct | |
type ('a, 'b) t = ('a * 'b) parray | |
fun fromPairPArray (xs : ('a * 'b) parray) : ('a, 'b) t = | |
xs | |
... | |
end | |
(* In unittest.pml: *) | |
... | |
val pairOfOnes = (1, 1) | |
val pairOfTwos = (2, 2) | |
val parrayOfPairsOfOnes = [| pairOfOnes | x in [| 0 to 10 |] |] | |
val parrayPairOfOnes = PArrayPair.fromPairPArray parrayOfPairsOfOnes (* line 66 *) | |
fun testPArrayPairCompare (value : int, value' : int) = | |
let | |
val LENGTH = 10 | |
val toMap = [| 0 to LENGTH |] | |
val pairs = PArrayPair.fromPairPArray [| (value, value) | x in toMap |] (* line 73 *) | |
val pairs' = PArrayPair.fromPairPArray [| (value', value') | x in toMap |] (* line 74 *) | |
val expected = Int.compare (value, value') | |
val msg = String.concat ["testPArrayCompareEq: ", | |
Int.toString value, ", ", | |
Int.toString value', "\n "] | |
in | |
assertPairsOrd (pairs, pairs', expected, msg) | |
end | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment