Created
September 1, 2017 19:41
-
-
Save oluies/babe7f169fea228a5c564a9831c6ca68 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
test("interpolateColor. Above 60") { | |
assert(Visualization.interpolateColor(Color.threasholds, 60.001) === Color(255, 255, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, 60.01) === Color(255, 255, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, 60.1) === Color(255, 255, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, 61) === Color(255, 255, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, 62) === Color(255, 255, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, 63) === Color(255, 255, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, 100) === Color(255, 255, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, 1000) === Color(255, 255, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, 10000) === Color(255, 255, 255)) | |
} | |
test("interpolateColor. Between 32 and 60") { | |
assert(Visualization.interpolateColor(Color.threasholds, 32.01) === Color(255, 0, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, 32.1) === Color(255, 1, 1)) | |
assert(Visualization.interpolateColor(Color.threasholds, 39) === Color(255, 64, 64)) | |
assert(Visualization.interpolateColor(Color.threasholds, 46) === Color(255, 128, 128)) | |
assert(Visualization.interpolateColor(Color.threasholds, 53) === Color(255, 191, 191)) | |
assert(Visualization.interpolateColor(Color.threasholds, 59.9) === Color(255, 254, 254)) | |
assert(Visualization.interpolateColor(Color.threasholds, 59.99) === Color(255, 255, 255)) | |
} | |
test("interpolateColor. Between 12 and 32") { | |
assert(Visualization.interpolateColor(Color.threasholds, 12.01) === Color(255, 255, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, 12.1) === Color(255, 254, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, 17) === Color(255, 191, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, 22) === Color(255, 128, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, 27) === Color(255, 64, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, 31.9) === Color(255, 1, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, 31.99) === Color(255, 0, 0)) | |
} | |
test("interpolateColor. Between 0 and 12") { | |
assert(Visualization.interpolateColor(Color.threasholds, 0.01) === Color(0, 255, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, 0.1) === Color(2, 255, 253)) | |
assert(Visualization.interpolateColor(Color.threasholds, 3) === Color(64, 255, 191)) | |
assert(Visualization.interpolateColor(Color.threasholds, 6) === Color(128, 255, 128)) | |
assert(Visualization.interpolateColor(Color.threasholds, 9) === Color(191, 255, 64)) | |
assert(Visualization.interpolateColor(Color.threasholds, 11.9) === Color(253, 255, 2)) | |
assert(Visualization.interpolateColor(Color.threasholds, 11.99) === Color(255, 255, 0)) | |
} | |
test("interpolateColor. Between -15 and 0") { | |
assert(Visualization.interpolateColor(Color.threasholds, -14.99) === Color(0, 0, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, -14.9) === Color(0, 2, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, -12) === Color(0, 51, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, -8) === Color(0, 119, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, -4) === Color(0, 187, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, -0.1) === Color(0, 253, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, -0.01) === Color(0, 255, 255)) | |
} | |
test("interpolateColor. Between -27 and -15") { | |
assert(Visualization.interpolateColor(Color.threasholds, -26.99) === Color(255, 0, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, -26.9) === Color(253, 0, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, -24) === Color(191, 0, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, -21) === Color(128, 0, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, -18) === Color(64, 0, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, -15.1) === Color(2, 0, 255)) | |
assert(Visualization.interpolateColor(Color.threasholds, -15.01) === Color(0, 0, 255)) | |
} | |
test("interpolateColor. Between -50 and -27") { | |
assert(Visualization.interpolateColor(Color.threasholds, -49.99) === Color(33, 0, 107)) | |
assert(Visualization.interpolateColor(Color.threasholds, -49.9) === Color(34, 0, 108)) | |
assert(Visualization.interpolateColor(Color.threasholds, -44) === Color(91, 0, 146)) | |
assert(Visualization.interpolateColor(Color.threasholds, -38) === Color(149, 0, 184)) | |
assert(Visualization.interpolateColor(Color.threasholds, -32) === Color(207, 0, 223)) | |
assert(Visualization.interpolateColor(Color.threasholds, -27.1) === Color(254, 0, 254)) | |
assert(Visualization.interpolateColor(Color.threasholds, -27.01) === Color(255, 0, 255)) | |
} | |
test("interpolateColor. Between -60 and -50") { | |
assert(Visualization.interpolateColor(Color.threasholds, -59.99) === Color(0, 0, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, -59.9) === Color(0, 0, 1)) | |
assert(Visualization.interpolateColor(Color.threasholds, -57) === Color(10, 0, 32)) | |
assert(Visualization.interpolateColor(Color.threasholds, -55) === Color(17, 0, 54)) | |
assert(Visualization.interpolateColor(Color.threasholds, -52) === Color(26, 0, 86)) | |
assert(Visualization.interpolateColor(Color.threasholds, -50.1) === Color(33, 0, 106)) | |
assert(Visualization.interpolateColor(Color.threasholds, -50.01) === Color(33, 0, 107)) | |
} | |
test("interpolateColor. Below -60") { | |
assert(Visualization.interpolateColor(Color.threasholds, -60.001) === Color(0, 0, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, -60.01) === Color(0, 0, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, -60.1) === Color(0, 0, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, -61) === Color(0, 0, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, -62) === Color(0, 0, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, -63) === Color(0, 0, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, -100) === Color(0, 0, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, -1000) === Color(0, 0, 0)) | |
assert(Visualization.interpolateColor(Color.threasholds, -10000) === Color(0, 0, 0)) | |
} | |
test("predictTemperatures. Known points.") { | |
val locationTemperatures = Array((Location(0, 0), 10.0), (Location(1, 0), 10.0), (Location(1, 1), 10.0), (Location(0, 1), 10.0)) | |
assert(Visualization.predictTemperature(locationTemperatures, locationTemperatures(0)._1) === 10.0) | |
assert(Visualization.predictTemperature(locationTemperatures, locationTemperatures(1)._1) === 10.0) | |
assert(Visualization.predictTemperature(locationTemperatures, locationTemperatures(2)._1) === 10.0) | |
assert(Visualization.predictTemperature(locationTemperatures, locationTemperatures(3)._1) === 10.0) | |
} | |
test("predictTemperatures. Distance < 1") { | |
val locationTemperatures = Array((Location(0, 0), 10.0), (Location(0.001, 0.001), 10.1)) | |
val t0 = Visualization.predictTemperature(locationTemperatures, Location(0.001, 0.001)) | |
assert(t0 === 10.1) | |
} | |
test("predictTemperature") { | |
assert(Visualization.predictTemperature(List((Location(1, 2), 1.0)), Location(1, 2)) === 1.0) | |
assert(Visualization.predictTemperature(List((Location(1, 2), 1.0)), Location(1, 2.5)) === 1.0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment