Added tests for `log10`

This commit is contained in:
Vincent Esche 2019-09-24 18:05:09 +02:00
parent ba4e250f2f
commit 3da003bf4a
1 changed files with 32 additions and 0 deletions

View File

@ -90,4 +90,36 @@ class LofarithmTests: XCTestCase {
XCTAssertEqual(actual, expected, accuracy: 1e-8)
}
// MARK: - Base-10 Logarithm
func test_log10_array_float() {
typealias Scalar = Float
let lhs: [Scalar] = (1...n).map { Scalar($0) / Scalar(n) }
var actual: [Scalar] = []
measure {
actual = Surge.log10(lhs)
}
let expected = lhs.map { log10($0) }
XCTAssertEqual(actual, expected, accuracy: 1e-4)
}
func test_log10_array_double() {
typealias Scalar = Double
let lhs: [Scalar] = (1...n).map { Scalar($0) / Scalar(n) }
var actual: [Scalar] = []
measure {
actual = Surge.log10(lhs)
}
let expected = lhs.map { log10($0) }
XCTAssertEqual(actual, expected, accuracy: 1e-8)
}
}