mirror of
https://github.com/zhigang1992/PerspectiveTransform.git
synced 2026-01-12 22:49:33 +08:00
refactor specs
This commit is contained in:
@@ -10,7 +10,7 @@ import XCTest
|
||||
|
||||
class OpenCVPerformanceTest: XCTestCase {
|
||||
static let reasonableTestDurationMs = 100
|
||||
let repeatTimes = {OpenCVPerformanceTest.reasonableTestDurationMs * 1000}()
|
||||
let repeatTimes = OpenCVPerformanceTest.reasonableTestDurationMs * 1000
|
||||
|
||||
let destination = Quadrilateral(upperLeft: CGPoint(x: 108.315837, y: 80.1687782),
|
||||
upperRight: CGPoint(x: 377.282671, y: 41.4352201),
|
||||
|
||||
@@ -66,7 +66,6 @@ class CALayerTransformSpec: QuickSpec {
|
||||
(original, delta:0.001)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class CATransform3DMatrixPerformanceTest: XCTestCase {
|
||||
/// Shows that bitcast is 2-5 times faster
|
||||
func testInitUsingBitcast() {
|
||||
measure {
|
||||
for _ in (0...iterations) {
|
||||
iterations.times {
|
||||
_ = CATransform3D(m4x4)
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ class CATransform3DMatrixPerformanceTest: XCTestCase {
|
||||
/// Shows that designated init is slower
|
||||
func testInitUsingDesignatedInitializer() {
|
||||
measure {
|
||||
for _ in (0...iterations) {
|
||||
iterations.times {
|
||||
_ = CATransform3D(
|
||||
m11: CGFloat(m4x4[0, 0]), m12: CGFloat(m4x4[0, 1]), m13: CGFloat(m4x4[0, 2]), m14: CGFloat(m4x4[0, 3]),
|
||||
m21: CGFloat(m4x4[1, 0]), m22: CGFloat(m4x4[1, 1]), m23: CGFloat(m4x4[1, 2]), m24: CGFloat(m4x4[1, 3]),
|
||||
|
||||
@@ -30,9 +30,7 @@ extension Matrix4x3Type {
|
||||
}
|
||||
|
||||
extension Matrix3x4Type {
|
||||
static let zeroRowBeforeLast: Matrix3x4Type = {
|
||||
return Matrix4x3Type.zeroColumnBeforeLast.transpose
|
||||
}()
|
||||
static let zeroRowBeforeLast: Matrix3x4Type = Matrix4x3Type.zeroColumnBeforeLast.transpose
|
||||
|
||||
func insertColumnBeforeLast() -> Matrix4x4Type {
|
||||
return self * Matrix4x3Type.zeroColumnBeforeLast
|
||||
|
||||
Reference in New Issue
Block a user