// RUN: %target-run-simple-swift // REQUIRES: executable_test // UNSUPPORTED: OS=watchos // REQUIRES: objc_interop import StdlibUnittest import Foundation import ModelIO var ModelIOTests = TestSuite("ModelIO") if #available(OSX 10.13, iOS 11.0, tvOS 11.0, *) { ModelIOTests.test("MDLSkinDeformer.jointBindTransforms()") { let jointPaths = ["Aa", "Bb", "Cc"] let count = 3 let jointTransforms = [matrix_float4x4](repeating: matrix_identity_float4x4, count: count) let meshBindTransform = matrix_identity_float4x4 let skinDeformer = MDLSkinDeformer(jointPaths: jointPaths, jointBindTransforms: jointTransforms, count: count, meshBindTransform: meshBindTransform) let jointBindTransforms = skinDeformer.jointBindTransforms() expectEqual(jointBindTransforms.count, count) for (bindIdx, jointBindTransform) in jointBindTransforms.enumerated() { for idx in 0..<4 { expectEqual(jointBindTransform[idx].x, jointTransforms[bindIdx][idx].x) expectEqual(jointBindTransform[idx].y, jointTransforms[bindIdx][idx].y) expectEqual(jointBindTransform[idx].z, jointTransforms[bindIdx][idx].z) expectEqual(jointBindTransform[idx].w, jointTransforms[bindIdx][idx].w) } } } ModelIOTests.test("MDLAnimatedScalar/accessors") { let animatedVal = MDLAnimatedScalar() let testCount = 10 let testTimeVal = 5.0 let testFloatVal:Float = 1.0 let testDoubleVal = Double(testFloatVal) let fArray = [Float](repeating: testFloatVal, count: testCount) var times = [TimeInterval](repeating: testTimeVal, count: testCount) animatedVal.reset(withFloatArray: fArray, atTimes: times, count: testCount) let floats = animatedVal.getFloatArray() let doubles = animatedVal.getDoubleArray() times = animatedVal.getTimes() expectEqual(floats.count, testCount) expectEqual(doubles.count, testCount) expectEqual(times.count, testCount) for idx in 0..