├── .travis.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.md ├── MyPlayground.playground ├── Contents.swift ├── contents.xcplayground ├── playground.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── seivan.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── timeline.xctimeline ├── README.md ├── ScalarArithmetic ├── ScalarArithmetic.swift └── ScalarArithmeticExperimental.swift └── TestsAndSample ├── Tests ├── SuperTestsScalarArithmetic.swift ├── SuperTestsScalarComparable.swift ├── TestsCGFloatArithmeticTesting.swift ├── TestsCGFloatComparable.swift ├── TestsDoubleArithmeticTesting.swift ├── TestsDoubleComparable.swift ├── TestsIntArithmeticTesting.swift ├── TestsIntComparable.swift └── TestsMathFunctions.swift ├── Tests32 ├── Info.plist └── Tests32.swift ├── Tests64 └── Info.plist └── TestsAndSample.xcodeproj ├── project.pbxproj ├── project.xcworkspace ├── contents.xcworkspacedata ├── xcshareddata │ └── TestsAndSample.xccheckout └── xcuserdata │ └── seivan.xcuserdatad │ └── UserInterfaceState.xcuserstate ├── xcshareddata └── xcschemes │ ├── Tests32.xcscheme │ └── Tests64.xcscheme └── xcuserdata └── seivan.xcuserdatad └── xcschemes └── xcschememanagement.plist /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode7.3 3 | script: 4 | - xctool -project TestsAndSample/TestsAndSample.xcodeproj -scheme Tests64 test 5 | - xctool -project TestsAndSample/TestsAndSample.xcodeproj -scheme Tests32 test 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seivan-archives/ScalarArithmetic/4604471f9ee50b9156023c8e81bdaea6fb8e1f28/CHANGELOG.md -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seivan-archives/ScalarArithmetic/4604471f9ee50b9156023c8e81bdaea6fb8e1f28/CONTRIBUTING.md -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Seivan Heidari. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /MyPlayground.playground/Contents.swift: -------------------------------------------------------------------------------- 1 | //: Playground - noun: a place where people can play 2 | 3 | import Cocoa 4 | import CoreGraphics 5 | 6 | -------------------------------------------------------------------------------- /MyPlayground.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /MyPlayground.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MyPlayground.playground/playground.xcworkspace/xcuserdata/seivan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seivan-archives/ScalarArithmetic/4604471f9ee50b9156023c8e81bdaea6fb8e1f28/MyPlayground.playground/playground.xcworkspace/xcuserdata/seivan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /MyPlayground.playground/timeline.xctimeline: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #ScalarArithmetic 2 | [![Build Status](https://travis-ci.org/seivan/ScalarArithmetic.svg?branch=master)](https://travis-ci.org/seivan/ScalarArithmetic) 3 | 4 | ### Why? 5 | * Because I don't need explicit casts to ```Double``` if I am expecting a ```Double```. 6 | * ```5 + 5.0 ``` should return a ```Double``` 7 | ```swift 8 | //You can now compare or do mathematical operations between the following types: 9 | var doubleValue:Double = 5.0 10 | var cgFloatValue:CGFloat = 5.0 11 | var intValue:Int = 5 12 | var int16Value:Int16 = 5 13 | var int32Value:Int32 = 5 14 | var int64Value:Int64 = 5 15 | var uInt16Value:UInt16 = 5 16 | var uInt32Value:UInt32 = 5 17 | var uInt64Value:UInt64 = 5 18 | ```` 19 | 20 | To see what is fully possible. Run the test suite, then comment out ScalarArithmetic and try to run the test suite again. 21 | 22 | 23 | ### Overview 24 | 25 | Takes care of operators for interacting between different types of scalars. 26 | This library makes it easier to compare to ```Int```, ```Float``` and ```CGFloat``` regardless of architecture. 27 | 28 | This also makes implicit casts to Double or CGFloat for arguments or variables that takes either types. 29 | 30 | ``var myDouble = 2.0`` will give you a ```Double``` and you'd want to use that with other types. 31 | 32 | Works on both Mac OS and iOS. 33 | 34 | 35 | 36 | ### Math Functions 37 | 38 | ```swift 39 | protocol FloatingPointMathType { 40 | var acos:Self {get} 41 | var asin:Self {get} 42 | var atan:Self {get} 43 | func atan2(x:Self) -> Self 44 | var cos:Self {get} 45 | var sin:Self {get} 46 | var tan:Self {get} 47 | var exp:Self {get} 48 | var exp2:Self {get} 49 | var log:Self {get} 50 | var log10:Self {get} 51 | var log2:Self {get} 52 | func pow(exponent:Self) -> Self 53 | var sqrt:Self {get} 54 | } 55 | 56 | ``` 57 | 58 | ### Sample 59 | 60 | ```swift 61 | cgFloatValue = doubleValue 62 | 63 | doubleValue = intValue 64 | doubleValue = cgFloatValue 65 | 66 | doubleValue = doubleValue + intValue 67 | doubleValue = doubleValue + cgFloatValue 68 | doubleValue = doubleValue + floatValue 69 | 70 | doubleValue = intValue + doubleValue 71 | doubleValue = cgFloatValue + doubleValue 72 | doubleValue = floatValue + doubleValue 73 | 74 | 75 | doubleValue = intValue + cgFloatValue 76 | doubleValue = intValue + floatValue 77 | doubleValue = floatValue + cgFloatValue 78 | doubleValue = floatValue + intValue 79 | doubleValue = cgFloatValue + floatValue 80 | doubleValue = cgFloatValue + intValue 81 | 82 | doubleValue += intValue 83 | doubleValue += cgFloatValue 84 | doubleValue += floatValue 85 | 86 | ///////////////////// 87 | 88 | cgFloatValue = cgFloatValue + doubleValue 89 | cgFloatValue = cgFloatValue + intValue 90 | cgFloatValue = cgFloatValue + floatValue 91 | 92 | 93 | cgFloatValue = doubleValue + cgFloatValue 94 | cgFloatValue = intValue + cgFloatValue 95 | cgFloatValue = floatValue + cgFloatValue 96 | 97 | cgFloatValue = intValue + doubleValue 98 | cgFloatValue = intValue + floatValue 99 | cgFloatValue = floatValue + doubleValue 100 | cgFloatValue = floatValue + intValue 101 | cgFloatValue = doubleValue + floatValue 102 | cgFloatValue = doubleValue + intValue 103 | 104 | 105 | cgFloatValue += doubleValue 106 | cgFloatValue += intValue 107 | cgFloatValue += floatValue 108 | 109 | 110 | ///////////////////// 111 | 112 | doubleValue == doubleValue 113 | doubleValue == cgFloatValue 114 | doubleValue == intValue 115 | 116 | cgFloatValue == doubleValue 117 | cgFloatValue == intValue 118 | intValue == doubleValue 119 | intValue == cgFloatValue 120 | 121 | 122 | doubleValue != doubleValue 123 | doubleValue != cgFloatValue 124 | doubleValue != intValue 125 | 126 | cgFloatValue != doubleValue 127 | cgFloatValue != intValue 128 | intValue != doubleValue 129 | intValue != cgFloatValue 130 | 131 | 132 | doubleValue >= doubleValue 133 | doubleValue >= cgFloatValue 134 | doubleValue >= intValue 135 | 136 | cgFloatValue >= doubleValue 137 | cgFloatValue >= intValue 138 | intValue >= doubleValue 139 | intValue >= cgFloatValue 140 | 141 | doubleValue > doubleValue 142 | doubleValue > cgFloatValue 143 | doubleValue > intValue 144 | 145 | cgFloatValue > doubleValue 146 | cgFloatValue > intValue 147 | intValue > doubleValue 148 | intValue > cgFloatValue 149 | 150 | 151 | doubleValue <= doubleValue 152 | doubleValue <= cgFloatValue 153 | doubleValue <= intValue 154 | 155 | cgFloatValue <= doubleValue 156 | cgFloatValue <= intValue 157 | intValue <= doubleValue 158 | intValue <= cgFloatValue 159 | 160 | 161 | doubleValue < doubleValue 162 | doubleValue < cgFloatValue 163 | doubleValue < intValue 164 | 165 | cgFloatValue < doubleValue 166 | cgFloatValue < intValue 167 | intValue < doubleValue 168 | intValue < cgFloatValue 169 | 170 | doubleValue = doubleValue + int16Value 171 | doubleValue = doubleValue + int32Value 172 | doubleValue = doubleValue + int64Value 173 | 174 | doubleValue = doubleValue + uInt16Value 175 | doubleValue = doubleValue + uInt32Value 176 | doubleValue = doubleValue + uInt64Value 177 | 178 | cgFloatValue = cgFloatValue + int16Value 179 | cgFloatValue = cgFloatValue + int32Value 180 | cgFloatValue = cgFloatValue + int64Value 181 | 182 | cgFloatValue = cgFloatValue + uInt16Value 183 | cgFloatValue = cgFloatValue + uInt32Value 184 | cgFloatValue = cgFloatValue + uInt64Value 185 | 186 | ``` 187 | 188 | ###Contact 189 | 190 | 191 | If you end up using ScalarArithmetic in a project, I'd love to hear about it. 192 | 193 | email: [seivan.heidari@icloud.com](mailto:seivan.heidari@icloud.com) 194 | twitter: [@seivanheidari](https://twitter.com/seivanheidari) 195 | 196 | *** 197 | 198 | ### License 199 | 200 | ScalarArithmetic is © 2014 [Seivan](http://www.github.com/seivan) and may be freely 201 | distributed under the [MIT license](http://opensource.org/licenses/MIT). 202 | See the [`LICENSE.md`](https://github.com/seivan/ScalarArithmetic/blob/master/LICENSE.md) file. 203 | 204 | *** 205 | -------------------------------------------------------------------------------- /ScalarArithmetic/ScalarArithmetic.swift: -------------------------------------------------------------------------------- 1 | 2 | 3 | import Darwin 4 | import CoreGraphics 5 | 6 | 7 | public protocol ScalarFloatingPointType: Comparable { 8 | var toDouble:Double { get } 9 | init(_ value:Double) 10 | } 11 | 12 | extension CGFloat : ScalarFloatingPointType { 13 | public var toDouble:Double { return Double(self) } 14 | } 15 | 16 | extension Float : ScalarFloatingPointType { 17 | public var toDouble:Double { return Double(self) } 18 | } 19 | extension Double { 20 | public var toCGFloat:CGFloat { return CGFloat(self) } 21 | } 22 | 23 | 24 | public protocol FloatingPointOperating { 25 | associatedtype Main : FloatingPointType 26 | associatedtype Alternative : FloatingPointType 27 | associatedtype Avoid : FloatingPointType 28 | 29 | var abs:Main {get} 30 | var acos:Main {get} 31 | var asin:Main {get} 32 | var atan:Main {get} 33 | func atan2(rhs:Main) -> Main 34 | func atan2(rhs:Alternative) -> Main 35 | var cos:Main {get} 36 | var sin:Main {get} 37 | var tan:Main {get} 38 | var exp:Main {get} 39 | var exp2:Main {get} 40 | var log:Main {get} 41 | var log10:Main {get} 42 | var log2:Main {get} 43 | func pow(rhs:Main) -> Main 44 | func pow(rhs:Alternative) -> Main 45 | var sqrt:Main {get} 46 | } 47 | 48 | 49 | 50 | extension Double : FloatingPointOperating { 51 | public typealias Main = Double 52 | public typealias Alternative = CGFloat 53 | public typealias Avoid = Float 54 | 55 | 56 | public var abs:Main { return Main.abs(self) } 57 | public var acos:Main { return Darwin.acos(self) } 58 | public var asin:Main { return Darwin.asin(self) } 59 | public var atan:Main { return Darwin.atan(self) } 60 | public func atan2(x:Main) -> Main { return Darwin.atan2(self,x) } 61 | public func atan2(x:Alternative) -> Main { return Darwin.atan2(self, Main(x)) } 62 | public var cos:Main { return Darwin.cos(self) } 63 | public var sin:Main { return Darwin.sin(self) } 64 | public var tan:Main { return Darwin.tan(self) } 65 | public var exp:Main { return Darwin.exp(self) } 66 | public var exp2:Main { return Darwin.exp2(self) } 67 | public var log:Main { return Darwin.log(self) } 68 | public var log10:Main{ return Darwin.log10(self) } 69 | public var log2:Main { return Darwin.log2(self) } 70 | public func pow(rhs:Main)-> Main { return Darwin.pow(self, rhs) } 71 | public func pow(rhs:Alternative)-> Main { return Darwin.pow(self, Main(rhs)) } 72 | public var sqrt:Main { return Darwin.sqrt(self) } 73 | 74 | } 75 | 76 | 77 | extension CGFloat : FloatingPointOperating { 78 | public typealias Main = CGFloat 79 | public typealias Alternative = Double 80 | public typealias Avoid = Float 81 | 82 | public var abs:Main { return Main.abs(self) } 83 | public var acos:Main { return Main(Darwin.acos(self.native)) } 84 | public var asin:Main { return Main(Darwin.asin(self.native)) } 85 | public var atan:Main { return Main(Darwin.atan(self.native)) } 86 | public func atan2(rhs:Main) -> Main { return Main(Darwin.atan2(self.native, rhs.native)) } 87 | public func atan2(rhs:Alternative) -> Main { return Main(Darwin.atan2(self.native, Main(rhs).native)) } 88 | public var cos:Main { return Main(Darwin.cos(self.native)) } 89 | public var sin:Main { return Main(Darwin.sin(self.native)) } 90 | public var tan:Main { return Main(Darwin.tan(self.native)) } 91 | public var exp:Main { return Main(Darwin.exp(self.native)) } 92 | public var exp2:Main { return Main(Darwin.exp2(self.native)) } 93 | public var log:Main { return Main(Darwin.log(self.native)) } 94 | public var log10:Main { return Main(Darwin.log10(self.native)) } 95 | public var log2:Main { return Main(Darwin.log2(self.native)) } 96 | public func pow(rhs:Main)-> Main { return Main(Darwin.pow(self.native, rhs.native)) } 97 | public func pow(rhs:Alternative)-> Main { return Main(Darwin.pow(self.native, Alternative(rhs))) } 98 | public var sqrt:Main { return Main(Darwin.sqrt(self.native)) } 99 | 100 | } 101 | 102 | extension Float : FloatingPointOperating { 103 | public typealias Main = Double 104 | public typealias Alternative = CGFloat 105 | public typealias Avoid = Float 106 | 107 | 108 | public var abs:Main { return Main.abs(Main(self)) } 109 | public var acos:Main { return Darwin.acos(Main(self)) } 110 | public var asin:Main { return Darwin.asin(Main(self)) } 111 | public var atan:Main { return Darwin.atan(Main(self)) } 112 | public func atan2(x:Main) -> Main { return Darwin.atan2(Main(self), x) } 113 | public func atan2(x:Alternative) -> Main { return Darwin.atan2(Main(self), Main(x)) } 114 | public var cos:Main { return Darwin.cos(Main(self)) } 115 | public var sin:Main { return Darwin.sin(Main(self)) } 116 | public var tan:Main { return Darwin.tan(Main(self)) } 117 | public var exp:Main { return Darwin.exp(Main(self)) } 118 | public var exp2:Main { return Darwin.exp2(Main(self)) } 119 | public var log:Main { return Darwin.log(Main(self)) } 120 | public var log10:Main{ return Darwin.log10(Main(self)) } 121 | public var log2:Main { return Darwin.log2(Main(self)) } 122 | public func pow(rhs:Main)-> Main { return Darwin.pow(Main(self), rhs) } 123 | public func pow(rhs:Alternative)-> Main { return Darwin.pow(Main(self), Main(rhs)) } 124 | public var sqrt:Main { return Darwin.sqrt(Main(self)) } 125 | 126 | } 127 | 128 | public protocol ScalarIntegerType : ScalarFloatingPointType { 129 | var toInt:Int { get } 130 | } 131 | 132 | extension Int : ScalarIntegerType { 133 | public var toDouble:Double { return Double(self) } 134 | public var toInt:Int { return Int(self) } 135 | 136 | } 137 | extension Int16 : ScalarIntegerType { 138 | public var toDouble:Double { return Double(self) } 139 | public var toInt:Int { return Int(self) } 140 | 141 | } 142 | extension Int32 : ScalarIntegerType { 143 | public var toDouble:Double { return Double(self) } 144 | public var toInt:Int { return Int(self) } 145 | 146 | } 147 | extension Int64 : ScalarIntegerType { 148 | public var toDouble:Double { return Double(self) } 149 | public var toInt:Int { return Int(self) } 150 | 151 | } 152 | extension UInt : ScalarFloatingPointType { 153 | public var toDouble:Double { return Double(self) } 154 | 155 | } 156 | extension UInt16 : ScalarFloatingPointType { 157 | public var toDouble:Double { return Double(self) } 158 | 159 | } 160 | extension UInt32 : ScalarFloatingPointType { 161 | public var toDouble:Double { return Double(self) } 162 | } 163 | extension UInt64 : ScalarFloatingPointType { 164 | public var toDouble:Double { return Double(self) } 165 | 166 | } 167 | 168 | 169 | 170 | 171 | 172 | 173 | ////Equality T<===>T 174 | func == (lhs:U,rhs:T) -> Bool { return (lhs.toDouble == rhs.toDouble) } 175 | func == (lhs:Double,rhs:T) -> Bool { return (lhs == rhs.toDouble) } 176 | func == (lhs:T,rhs:Double) -> Bool { return (lhs.toDouble == rhs) } 177 | 178 | func != (lhs:U,rhs:T) -> Bool { return (lhs.toDouble == rhs.toDouble) == false } 179 | func != (lhs:Double,rhs:T) -> Bool { return (lhs == rhs.toDouble) == false } 180 | func != (lhs:T,rhs:Double) -> Bool { return (lhs.toDouble == rhs) == false } 181 | 182 | func <= (lhs:T,rhs:U) -> Bool { return (lhs.toDouble <= rhs.toDouble) } 183 | func <= (lhs:Double, rhs:T) -> Bool { return (lhs <= rhs.toDouble) } 184 | func <= (lhs:T,rhs:Double) -> Bool { return (lhs.toDouble <= rhs) } 185 | 186 | func < (lhs:T,rhs:U) -> Bool { return (lhs.toDouble < rhs.toDouble) } 187 | func < (lhs:Double, rhs:T) -> Bool { return (lhs < rhs.toDouble) } 188 | func < (lhs:T,rhs:Double) -> Bool { return (lhs.toDouble < rhs) } 189 | 190 | func > (lhs:T,rhs:U) -> Bool { return (lhs <= rhs) == false } 191 | func > (lhs:Double, rhs:T) -> Bool { return (lhs <= rhs) == false} 192 | func > (lhs:T,rhs:Double) -> Bool { return (lhs <= rhs) == false } 193 | 194 | func >= (lhs:T,rhs:U) -> Bool { return (lhs < rhs) == false } 195 | func >= (lhs:Double, rhs:T) -> Bool { return (lhs < rhs) == false } 196 | func >= (lhs:T,rhs:Double) -> Bool { return (lhs < rhs) == false } 197 | // 198 | // 199 | // 200 | ////SUBTRACTION 201 | func - (lhs:T, rhs:U) -> T {return T(lhs.toDouble - rhs.toDouble) } 202 | func - (lhs:U, rhs:T) -> T {return T(lhs.toDouble - rhs.toDouble) } 203 | func - (lhs:Double, rhs:T) -> T { return T(lhs - rhs.toDouble) } 204 | func - (lhs:T, rhs:Double) -> T { return T(lhs.toDouble - rhs) } 205 | func - (lhs:Double, rhs:T) -> Double { return lhs - rhs.toDouble } 206 | func - (lhs:T, rhs:Double) -> Double { return lhs.toDouble - rhs } 207 | 208 | func -= (inout lhs:T, rhs:U) { lhs = T(lhs - rhs.toDouble) } 209 | func -= (inout lhs:Double, rhs:T) { lhs = lhs - rhs.toDouble } 210 | func -= (inout lhs:CGFloat, rhs:Double) { lhs = lhs - rhs } 211 | func -= (inout lhs:CGFloat, rhs:T) { lhs = CGFloat(lhs - rhs.toDouble) } 212 | 213 | ////ADDITION 214 | // 215 | 216 | func + (lhs:T, rhs:U) -> T {return T(lhs.toDouble + rhs.toDouble) } 217 | func + (lhs:U, rhs:T) -> T {return T(lhs.toDouble + rhs.toDouble) } 218 | func + (lhs:Double, rhs:T) -> T { return T(lhs + rhs.toDouble) } 219 | func + (lhs:T, rhs:Double) -> T { return T(lhs.toDouble + rhs) } 220 | func + (lhs:Double, rhs:T) -> Double { return lhs + rhs.toDouble } 221 | func + (lhs:T, rhs:Double) -> Double { return lhs.toDouble + rhs } 222 | 223 | func += (inout lhs:T, rhs:U) { lhs = T(lhs + rhs.toDouble) } 224 | func += (inout lhs:Double, rhs:T) { lhs = lhs + rhs.toDouble } 225 | func += (inout lhs:CGFloat, rhs:Double) { lhs = lhs + rhs } 226 | func += (inout lhs:CGFloat, rhs:T) { lhs = CGFloat(lhs + rhs.toDouble) } 227 | 228 | ////MULTIPLICATION 229 | func * (lhs:T, rhs:U) -> T {return T(lhs.toDouble * rhs.toDouble) } 230 | func * (lhs:U, rhs:T) -> T {return T(lhs.toDouble * rhs.toDouble) } 231 | func * (lhs:Double, rhs:T) -> T { return T(lhs * rhs.toDouble) } 232 | func * (lhs:T, rhs:Double) -> T { return T(lhs.toDouble * rhs) } 233 | func * (lhs:Double, rhs:T) -> Double { return lhs * rhs.toDouble } 234 | func * (lhs:T, rhs:Double) -> Double { return lhs.toDouble * rhs } 235 | 236 | func *= (inout lhs:T, rhs:U) { lhs = T(lhs * rhs.toDouble) } 237 | func *= (inout lhs:Double, rhs:T) { lhs = lhs * rhs.toDouble } 238 | func *= (inout lhs:CGFloat, rhs:Double) { lhs = lhs * rhs } 239 | func *= (inout lhs:CGFloat, rhs:T) { lhs = CGFloat(lhs * rhs.toDouble) } 240 | // 241 | ////DIVISION 242 | func / (lhs:T, rhs:U) -> T {return T(lhs.toDouble / rhs.toDouble) } 243 | func / (lhs:U, rhs:T) -> T {return T(lhs.toDouble / rhs.toDouble) } 244 | func / (lhs:Double, rhs:T) -> T { return T(lhs / rhs.toDouble) } 245 | func / (lhs:T, rhs:Double) -> T { return T(lhs.toDouble / rhs) } 246 | func / (lhs:Double, rhs:T) -> Double { return lhs / rhs.toDouble } 247 | func / (lhs:T, rhs:Double) -> Double { return lhs.toDouble / rhs } 248 | 249 | func /= (inout lhs:T, rhs:U) { lhs = T(lhs / rhs.toDouble) } 250 | func /= (inout lhs:Double, rhs:T) { lhs = lhs / rhs.toDouble } 251 | func /= (inout lhs:CGFloat, rhs:Double) { lhs = lhs / rhs } 252 | func /= (inout lhs:CGFloat, rhs:T) { lhs = CGFloat(lhs / rhs.toDouble) } 253 | // 254 | // 255 | -------------------------------------------------------------------------------- /ScalarArithmetic/ScalarArithmeticExperimental.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ScalarArithmeticExperimental.swift 3 | // TestsAndSample 4 | // 5 | // Created by Seivan Heidari on 03/02/16. 6 | // Copyright © 2016 Seivan Heidari. All rights reserved. 7 | // 8 | 9 | 10 | 11 | import Darwin 12 | import CoreGraphics 13 | import Foundation 14 | 15 | 16 | private protocol InternalFloatingPointMathTyping { 17 | typealias Main 18 | typealias Alternative 19 | typealias Avoid 20 | 21 | } 22 | 23 | extension InternalFloatingPointMathTyping { 24 | private var __castToMain:Main { return self as! Main } 25 | private var __castToAlternative:Alternative { return self as! Alternative } 26 | 27 | } 28 | 29 | extension InternalFloatingPointMathTyping where Main == Double, Alternative == CGFloat, Avoid == Float { 30 | private var __abs:Main {return Main.abs(self.__castToMain) } 31 | private var __acos:Main {return Darwin.acos(self.__castToMain) } 32 | private var __asin:Main { return Darwin.asin(self.__castToMain) } 33 | private var __atan:Main { return Darwin.atan(self.__castToMain) } 34 | private func __atan2(rhs:Main) -> Main { return Darwin.atan2(self.__castToMain, rhs) } 35 | private func __atan2(rhs:Alternative) -> Main { return Darwin.atan2(self.__castToMain, Main(rhs) )} 36 | private var __cos:Main { return Darwin.cos(self.__castToMain) } 37 | private var __sin:Main { return Darwin.sin(self.__castToMain) } 38 | private var __tan:Main { return Darwin.tan(self.__castToMain) } 39 | private var __exp:Main { return Darwin.exp(self.__castToMain) } 40 | private var __exp2:Main { return Darwin.exp2(self.__castToMain) } 41 | private var __log:Main { return Darwin.log(self.__castToMain) } 42 | private var __log10:Main{ return Darwin.log10(self.__castToMain) } 43 | private var __log2:Main { return Darwin.log2(self.__castToMain) } 44 | private func __pow(rhs:Main)-> Main { return Darwin.pow(self.__castToMain, rhs) } 45 | private func __pow(rhs:Alternative)-> Main { return Darwin.pow(self.__castToMain, rhs.toDouble) } 46 | private var __sqrt:Main { return Darwin.sqrt(self.__castToMain) } 47 | 48 | } 49 | 50 | extension InternalFloatingPointMathTyping where Main == Float, Alternative == Double, Avoid == CGFloat { 51 | private var __abs:Main {return Main.abs(self.__castToMain) } 52 | private var __acos:Main {return Darwin.acos(self.__castToMain) } 53 | private var __asin:Main { return Darwin.asin(self.__castToMain) } 54 | private var __atan:Main { return Darwin.atan(self.__castToMain) } 55 | private func __atan2(rhs:Main) -> Main { return Darwin.atan2(self.__castToMain, rhs) } 56 | private func __atan2(rhs:Alternative) -> Main { return Darwin.atan2(self.__castToMain, Main(rhs) )} 57 | private func __atan2(rhs:Avoid) -> Main { return Darwin.atan2(self.__castToMain, Main(rhs) )} 58 | private var __cos:Main { return Darwin.cos(self.__castToMain) } 59 | private var __sin:Main { return Darwin.sin(self.__castToMain) } 60 | private var __tan:Main { return Darwin.tan(self.__castToMain) } 61 | private var __exp:Main { return Darwin.exp(self.__castToMain) } 62 | private var __exp2:Main { return Darwin.exp2(self.__castToMain) } 63 | private var __log:Main { return Darwin.log(self.__castToMain) } 64 | private var __log10:Main{ return Darwin.log10(self.__castToMain) } 65 | private var __log2:Main { return Darwin.log2(self.__castToMain) } 66 | private func __pow(rhs:Main)-> Main { return Darwin.pow(self.__castToMain, rhs) } 67 | private func __pow(rhs:Alternative)-> Main { return Darwin.pow(self.__castToMain, Main(rhs)) } 68 | private func __pow(rhs:Avoid)-> Main { return Darwin.pow(self.__castToMain, Main(rhs)) } 69 | private var __sqrt:Main { return Darwin.sqrt(self.__castToMain) } 70 | 71 | 72 | } 73 | 74 | 75 | 76 | public protocol FloatingPointOperating { 77 | 78 | typealias Main 79 | typealias Alternative 80 | typealias Avoid 81 | 82 | 83 | var abs:Main {get} 84 | var acos:Main {get} 85 | var asin:Main {get} 86 | var atan:Main {get} 87 | func atan2(x:Main) -> Main 88 | func atan2(x:Alternative) -> Main 89 | var cos:Main {get} 90 | var sin:Main {get} 91 | var tan:Main {get} 92 | var exp:Main {get} 93 | var exp2:Main {get} 94 | var log:Main {get} 95 | var log10:Main {get} 96 | var log2:Main {get} 97 | func pow(rhs:Main) -> Main 98 | func pow(rhs:Alternative) -> Main 99 | var sqrt:Main {get} 100 | } 101 | 102 | public protocol zample { 103 | 104 | } 105 | 106 | 107 | 108 | extension Double : InternalFloatingPointMathTyping { 109 | public typealias Main = Double 110 | public typealias Alternative = CGFloat 111 | public typealias Avoid = Float 112 | public var toCGFloat:Alternative { return Alternative(self) } 113 | 114 | } 115 | 116 | extension Float : InternalFloatingPointMathTyping { 117 | public typealias Main = Float 118 | public typealias Alternative = Double 119 | public typealias Avoid = CGFloat 120 | public var toDouble:Alternative { return Alternative(self) } 121 | public var toCGFloat:Avoid { return Avoid(self) } 122 | } 123 | 124 | 125 | 126 | public extension CGFloat { 127 | public typealias Main = CGFloat 128 | public typealias Alternative = Double 129 | public typealias Avoid = Float 130 | public var toDouble:Alternative { return Alternative(self) } 131 | } 132 | 133 | 134 | 135 | 136 | private extension FloatingPointOperating { 137 | var castToMain:Main { return self as! Main } 138 | var castToAlternative:Alternative { return self as! Alternative } 139 | } 140 | 141 | 142 | 143 | public extension FloatingPointOperating where Main == Double, Alternative == CGFloat, Avoid == Float { 144 | public var toCGFloat:Alternative { return Alternative(self.castToMain) } 145 | 146 | public var abs:Main { return self.castToMain.__abs } 147 | public var acos:Main { return self.castToMain.__acos } 148 | public var asin:Main { return self.castToMain.__asin } 149 | public var atan:Main { return self.castToMain.__atan } 150 | public func atan2(rhs:Main) -> Main { return self.castToMain.__atan2(rhs) } 151 | public func atan2(rhs:Alternative) -> Main { return Darwin.atan2(self.castToMain, Main(rhs) )} 152 | public var cos:Main { return self.castToMain.__cos } 153 | public var sin:Main { return self.castToMain.__sin } 154 | public var tan:Main { return self.castToMain.__tan } 155 | public var exp:Main { return self.castToMain.__exp } 156 | public var exp2:Main { return self.castToMain.__exp2 } 157 | public var log:Main { return self.castToMain.__log } 158 | public var log10:Main{ return self.castToMain.__log10 } 159 | public var log2:Main { return self.castToMain.__log2 } 160 | public func pow(rhs:Main)-> Main { return self.castToMain.__pow(rhs) } 161 | public func pow(rhs:Alternative)-> Main { return self.castToMain.__pow(rhs) } 162 | public var sqrt:Main { return self.castToMain.__sqrt } 163 | 164 | } 165 | 166 | public extension FloatingPointOperating where Main == Float, Alternative == Double, Avoid == CGFloat { 167 | public var toDouble:Alternative { return Alternative(self.castToMain) } 168 | 169 | public var abs:Main { return self.castToMain.__abs } 170 | public var acos:Main { return self.castToMain.__acos } 171 | public var asin:Main { return self.castToMain.__asin } 172 | public var atan:Main { return self.castToMain.__atan } 173 | public func atan2(rhs:Main) -> Main { return self.castToMain.__atan2(rhs) } 174 | public func atan2(rhs:Alternative) -> Main { return self.castToMain.__atan2(Main(rhs)) } 175 | public var cos:Main { return self.castToMain.__cos } 176 | public var sin:Main { return self.castToMain.__sin } 177 | public var tan:Main { return self.castToMain.__tan } 178 | public var exp:Main { return self.castToMain.__exp } 179 | public var exp2:Main { return self.castToMain.__exp2 } 180 | public var log:Main { return self.castToMain.__log } 181 | public var log10:Main{ return self.castToMain.__log10 } 182 | public var log2:Main { return self.castToMain.__log2 } 183 | public func pow(rhs:Main)-> Main { return self.castToMain.__pow(rhs) } 184 | public func pow(rhs:Alternative)-> Main { return self.castToMain.__pow(rhs) } 185 | public func pow(rhs:Avoid)-> Main { return self.castToMain.__pow(rhs) } 186 | public var sqrt:Main { return self.castToMain.__sqrt } 187 | 188 | } 189 | 190 | 191 | public extension FloatingPointOperating where Main == CGFloat, Alternative == Double, Avoid == Float { 192 | public var toDouble:Alternative { return Alternative(self.castToMain) } 193 | 194 | public var abs:Main { return self.castToMain.native.__abs.toCGFloat } 195 | public var acos:Main { return self.castToMain.native.__acos.toCGFloat } 196 | public var asin:Main { return self.castToMain.native.__asin.toCGFloat } 197 | public var atan:Main { return self.castToMain.native.__atan.toCGFloat } 198 | public func atan2(rhs:Main) -> Main { return self.castToMain.native.__atan2(rhs).toCGFloat } 199 | public func atan2(rhs:Alternative) -> Main { return self.castToMain.native.__atan2(Main(rhs)).toCGFloat } 200 | public var cos:Main { return self.castToMain.native.__cos.toCGFloat } 201 | public var sin:Main { return self.castToMain.native.__sin.toCGFloat } 202 | public var tan:Main { return self.castToMain.native.__tan.toCGFloat } 203 | public var exp:Main { return self.castToMain.native.__exp.toCGFloat } 204 | public var exp2:Main { return self.castToMain.native.__exp2.toCGFloat } 205 | public var log:Main { return self.castToMain.native.__log.toCGFloat } 206 | public var log10:Main{ return self.castToMain.native.__log10.toCGFloat } 207 | public var log2:Main { return self.castToMain.native.__log2.toCGFloat } 208 | public func pow(rhs:Main)-> Main { return self.castToMain.native.__pow(rhs).toCGFloat } 209 | public func pow(rhs:Alternative)-> Main { return self.castToMain.native.__pow(rhs).toCGFloat } 210 | public var sqrt:Main { return self.castToMain.native.__sqrt.toCGFloat } 211 | 212 | } 213 | 214 | 215 | 216 | public protocol IntegerToFloatTypeConvertible { 217 | var toDouble:Double { get } 218 | } 219 | 220 | public protocol SignedIntegerToIntConvertible { 221 | var toInt:Int { get } 222 | } 223 | 224 | 225 | extension Int : IntegerToFloatTypeConvertible { public var toDouble:Double { return Double(self) } } 226 | extension Int8 : IntegerToFloatTypeConvertible { public var toDouble:Double { return Double(self) } } 227 | extension Int16 : IntegerToFloatTypeConvertible { public var toDouble:Double { return Double(self) } } 228 | extension Int32 : IntegerToFloatTypeConvertible { public var toDouble:Double { return Double(self) } } 229 | extension Int64 : IntegerToFloatTypeConvertible { public var toDouble:Double { return Double(self) } } 230 | 231 | extension UInt : IntegerToFloatTypeConvertible { public var toDouble:Double { return Double(self) } } 232 | extension UInt8 : IntegerToFloatTypeConvertible { public var toDouble:Double { return Double(self) } } 233 | extension UInt16 : IntegerToFloatTypeConvertible { public var toDouble:Double { return Double(self) } } 234 | extension UInt32 : IntegerToFloatTypeConvertible { public var toDouble:Double { return Double(self) } } 235 | extension UInt64 : IntegerToFloatTypeConvertible { public var toDouble:Double { return Double(self) } } 236 | 237 | extension Int : SignedIntegerToIntConvertible { public var toInt:Int { return Int(self) } } 238 | extension Int8 : SignedIntegerToIntConvertible { public var toInt:Int { return Int(self) } } 239 | extension Int16 : SignedIntegerToIntConvertible { public var toInt:Int { return Int(self) } } 240 | extension Int32 : SignedIntegerToIntConvertible { public var toInt:Int { return Int(self) } } 241 | extension Int64 : SignedIntegerToIntConvertible { public var toInt:Int { return Int(self) } } 242 | 243 | 244 | // 245 | //func + (lhs:T, rhs:Int) -> Int { return lhs + rhs } 246 | //func + (lhs:Int, rhs:T) -> Int { return lhs + rhs.toInt } 247 | // 248 | //func - (lhs:T, rhs:Int) -> Int { return lhs.toInt - rhs } 249 | //func - (lhs:Int, rhs:T) -> Int { return lhs - rhs.toInt } 250 | // 251 | //func * (lhs:T, rhs:Int) -> Int { return lhs.toInt * rhs } 252 | //func * (lhs:Int, rhs:T) -> Int { return lhs * rhs.toInt } 253 | // 254 | //func / (lhs:T, rhs:Int) -> Int { return lhs.toInt / rhs } 255 | //func / (lhs:Int, rhs:T) -> Int { return lhs / rhs.toInt } 256 | // 257 | // 258 | // 259 | ////Equality T<===>T 260 | //func == (lhs:U,rhs:T) -> Bool { return (lhs.toDouble == rhs.toDouble) } 261 | //func == (lhs:Double,rhs:T) -> Bool { return (lhs == rhs.toDouble) } 262 | //func == (lhs:T,rhs:Double) -> Bool { return (lhs.toDouble == rhs) } 263 | // 264 | //func != (lhs:U,rhs:T) -> Bool { return (lhs.toDouble == rhs.toDouble) == false } 265 | //func != (lhs:Double,rhs:T) -> Bool { return (lhs == rhs.toDouble) == false } 266 | //func != (lhs:T,rhs:Double) -> Bool { return (lhs.toDouble == rhs) == false } 267 | // 268 | //func <= (lhs:T,rhs:U) -> Bool { return (lhs.toDouble <= rhs.toDouble) } 269 | //func <= (lhs:Double, rhs:T) -> Bool { return (lhs <= rhs.toDouble) } 270 | //func <= (lhs:T,rhs:Double) -> Bool { return (lhs.toDouble <= rhs) } 271 | // 272 | //func < (lhs:T,rhs:U) -> Bool { return (lhs.toDouble < rhs.toDouble) } 273 | //func < (lhs:Double, rhs:T) -> Bool { return (lhs < rhs.toDouble) } 274 | //func < (lhs:T,rhs:Double) -> Bool { return (lhs.toDouble < rhs) } 275 | // 276 | //func > (lhs:T,rhs:U) -> Bool { return (lhs <= rhs) == false } 277 | //func > (lhs:Double, rhs:T) -> Bool { return (lhs <= rhs) == false} 278 | //func > (lhs:T,rhs:Double) -> Bool { return (lhs <= rhs) == false } 279 | // 280 | //func >= (lhs:T,rhs:U) -> Bool { return (lhs < rhs) == false } 281 | //func >= (lhs:Double, rhs:T) -> Bool { return (lhs < rhs) == false } 282 | //func >= (lhs:T,rhs:Double) -> Bool { return (lhs < rhs) == false } 283 | // 284 | // 285 | // 286 | ////SUBTRACTION 287 | //func - (lhs:U, rhs:T) -> Double {return (lhs.toDouble - rhs.toDouble) } 288 | //func - (lhs:Double, rhs:T) -> T { return T(lhs - rhs.toDouble) } 289 | //func - (lhs:T, rhs:Double) -> T { return T(lhs.toDouble - rhs) } 290 | //func - (lhs:Double, rhs:T) -> Double { return (lhs - rhs.toDouble) } 291 | //func - (lhs:T, rhs:Double) -> Double { return (lhs.toDouble - rhs) } 292 | //func -= (inout lhs:T, rhs:U) { lhs = T(lhs.toDouble - rhs.toDouble) } 293 | //func -= (inout lhs:Double, rhs:T) { lhs = lhs - rhs.toDouble } 294 | // 295 | ////ADDITION 296 | 297 | func + 301 | (lhs:LHS, rhs:RHS) -> LHS.Main {return lhs.castToMain + rhs.toDouble } 302 | 303 | func + 307 | (lhs:LHS, rhs:RHS) -> LHS.Main {return lhs.castToMain + rhs.toCGFloat } 308 | 309 | 310 | func + 313 | (lhs:LHS, rhs:RHS) -> LHS.Main {return lhs.castToMain + rhs.toDouble } 314 | 315 | func + 318 | (lhs:LHS, rhs:RHS) -> RHS.Main {return lhs.toDouble + rhs.castToMain } 319 | 320 | func + 323 | (lhs:LHS, rhs:RHS) -> LHS.Main {return lhs.castToMain + rhs.toDouble.toCGFloat } 324 | 325 | func + 328 | (lhs:LHS, rhs:RHS) -> RHS.Main {return lhs.toDouble.toCGFloat + rhs.castToMain } 329 | 330 | func + 331 | (lhs:LHS, rhs:RHS) -> Int {return lhs.toInt + rhs.toInt } 332 | 333 | 334 | 335 | func += 339 | (inout lhs:LHS.Main, rhs:RHS) { lhs = lhs + rhs.toDouble } 340 | 341 | //func + 345 | // (lhs:LHS, rhs:RHS) -> LHS.Main {return lhs.castToMain + rhs.toCGFloat } 346 | 347 | //func += (inout lhs:T, rhs:U) { lhs = T(lhs.toDouble + rhs.toDouble) } 348 | //func += (inout lhs:Double, rhs:T) { lhs = lhs + rhs.toDouble } 349 | // 350 | ////MULTIPLICATION 351 | //func * (lhs:U, rhs:T) -> Double {return (lhs.toDouble * rhs.toDouble) } 352 | //func * (lhs:Double, rhs:T) -> T { return T(lhs * rhs.toDouble) } 353 | //func * (lhs:T, rhs:Double) -> T { return T(lhs.toDouble * rhs) } 354 | //func * (lhs:Double, rhs:T) -> Double { return (lhs * rhs.toDouble) } 355 | //func * (lhs:T, rhs:Double) -> Double { return (lhs.toDouble * rhs) } 356 | //func *= (inout lhs:T, rhs:U) { lhs = T(lhs.toDouble * rhs.toDouble) } 357 | //func *= (inout lhs:Double, rhs:T) { lhs = lhs * rhs.toDouble } 358 | // 359 | ////DIVISION 360 | //func / (lhs:U, rhs:T) -> Double {return (lhs.toDouble / rhs.toDouble) } 361 | //func / (lhs:Double, rhs:T) -> T { return T(lhs / rhs.toDouble) } 362 | //func / (lhs:T, rhs:Double) -> T { return T(lhs.toDouble / rhs) } 363 | //func / (lhs:Double, rhs:T) -> Double { return (lhs / rhs.toDouble) } 364 | //func / (lhs:T, rhs:Double) -> Double { return (lhs.toDouble / rhs) } 365 | //func /= (inout lhs:T, rhs:U) { lhs = T(lhs.toDouble / rhs.toDouble) } 366 | //func /= (inout lhs:Double, rhs:T) { lhs = lhs / rhs.toDouble } 367 | 368 | 369 | -------------------------------------------------------------------------------- /TestsAndSample/Tests/SuperTestsScalarArithmetic.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestsScalarFloatingPointType.swift 3 | // TestsAndSample 4 | // 5 | // Created by Seivan Heidari on 29/06/14. 6 | // Copyright (c) 2014 Seivan Heidari. All rights reserved. 7 | // 8 | 9 | import CoreGraphics 10 | import XCTest 11 | 12 | 13 | protocol ScalarFloatingPointTypeTesting { 14 | func testAddition() 15 | func testAdditionAssignment() 16 | func testSubtraction() 17 | func testSubtractionAssignment() 18 | func testMultiplication() 19 | func testMultiplicationAssignment() 20 | func testDivision() 21 | 22 | } 23 | public class SuperTestsScalarFloatingPointType: XCTestCase { 24 | let doubleValue:Double = 5.0 25 | let cgFloatValue:CGFloat = 5.0 26 | let intValue:Int = 5 27 | let int16Value:Int16 = 5 28 | let int32Value:Int32 = 5 29 | let int64Value:Int64 = 5 30 | let uInt16Value:UInt16 = 5 31 | let uInt32Value:UInt32 = 5 32 | let uInt64Value:UInt64 = 5 33 | 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /TestsAndSample/Tests/SuperTestsScalarComparable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestsScalarComparable.swift 3 | // TestsAndSample 4 | // 5 | // Created by Seivan Heidari on 29/06/14. 6 | // Copyright (c) 2014 Seivan Heidari. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | import CoreGraphics 11 | 12 | protocol ScalarComparableTesting { 13 | func testEqual() 14 | func testNotEqual() 15 | func testLessThanOrEqual() 16 | func testLessThan() 17 | func testGreaterThanOrEqual() 18 | func testGreaterThan() 19 | } 20 | 21 | class SuperTestsScalarComparable: XCTestCase { 22 | var cgFloatValue = CGFloat(2.0) 23 | var doubleValue = Double(2.0) 24 | var intValue = 2 25 | let int16Value:Int16 = 2 26 | let int32Value:Int32 = 2 27 | let int64Value:Int64 = 2 28 | let uInt16Value:UInt16 = 2 29 | let uInt32Value:UInt32 = 2 30 | let uInt64Value:UInt64 = 2 31 | 32 | } 33 | -------------------------------------------------------------------------------- /TestsAndSample/Tests/TestsCGFloatArithmeticTesting.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestsCGFloatArithmeticTesting.swift 3 | // TestsAndSample 4 | // 5 | // Created by Seivan Heidari on 01/07/14. 6 | // Copyright (c) 2014 Seivan Heidari. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class TestsCGFloatArithmeticTesting: SuperTestsScalarFloatingPointType, ScalarFloatingPointTypeTesting { 12 | var expectedValue:CGFloat? 13 | var assignmentValue:CGFloat = 0.0 14 | 15 | func testAddition() { 16 | self.expectedValue = 10.0 17 | 18 | self.assignmentValue = self.cgFloatValue + self.doubleValue 19 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 20 | 21 | self.assignmentValue = self.cgFloatValue + self.intValue 22 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 23 | 24 | self.assignmentValue = self.cgFloatValue + self.int16Value 25 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 26 | 27 | self.assignmentValue = self.cgFloatValue + self.int32Value 28 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 29 | 30 | self.assignmentValue = self.cgFloatValue + self.int64Value 31 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 32 | 33 | self.assignmentValue = self.cgFloatValue + self.uInt16Value 34 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 35 | 36 | self.assignmentValue = self.cgFloatValue + self.uInt32Value 37 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 38 | 39 | self.assignmentValue = self.cgFloatValue + self.uInt64Value 40 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 41 | } 42 | 43 | func testAdditionAssignment() { 44 | self.expectedValue = 6.0 45 | 46 | self.assignmentValue = 1.0 47 | self.assignmentValue += self.doubleValue 48 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 49 | 50 | self.assignmentValue = 1.0 51 | self.assignmentValue += self.intValue 52 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 53 | 54 | self.assignmentValue = 1.0 55 | self.assignmentValue += self.int16Value 56 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 57 | 58 | self.assignmentValue = 1.0 59 | self.assignmentValue += self.int32Value 60 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 61 | 62 | self.assignmentValue = 1.0 63 | self.assignmentValue += self.int64Value 64 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 65 | 66 | self.assignmentValue = 1.0 67 | self.assignmentValue += self.uInt16Value 68 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 69 | 70 | self.assignmentValue = 1.0 71 | self.assignmentValue += self.uInt32Value 72 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 73 | 74 | self.assignmentValue = 1.0 75 | self.assignmentValue += self.uInt64Value 76 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 77 | 78 | } 79 | 80 | func testSubtraction() { 81 | self.expectedValue = 0.0 82 | 83 | self.assignmentValue = self.cgFloatValue - self.doubleValue 84 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 85 | 86 | self.assignmentValue = self.cgFloatValue - self.intValue 87 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 88 | 89 | self.assignmentValue = self.cgFloatValue - self.int16Value 90 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 91 | 92 | self.assignmentValue = self.cgFloatValue - self.int32Value 93 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 94 | 95 | self.assignmentValue = self.cgFloatValue - self.int64Value 96 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 97 | 98 | self.assignmentValue = self.cgFloatValue - self.uInt16Value 99 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 100 | 101 | self.assignmentValue = self.cgFloatValue - self.uInt32Value 102 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 103 | 104 | self.assignmentValue = self.cgFloatValue - self.uInt64Value 105 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 106 | } 107 | 108 | 109 | func testSubtractionAssignment() { 110 | self.expectedValue = -4.0 111 | 112 | self.assignmentValue = 1.0 113 | self.assignmentValue -= self.cgFloatValue 114 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 115 | 116 | 117 | self.assignmentValue = 1.0 118 | self.assignmentValue -= self.int16Value 119 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 120 | 121 | self.assignmentValue = 1.0 122 | self.assignmentValue -= self.int32Value 123 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 124 | 125 | self.assignmentValue = 1.0 126 | self.assignmentValue -= self.int64Value 127 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 128 | 129 | self.assignmentValue = 1.0 130 | self.assignmentValue -= self.uInt16Value 131 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 132 | 133 | self.assignmentValue = 1.0 134 | self.assignmentValue -= self.uInt32Value 135 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 136 | 137 | self.assignmentValue = 1.0 138 | self.assignmentValue -= self.uInt64Value 139 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 140 | 141 | 142 | 143 | } 144 | 145 | func testMultiplication() { 146 | self.expectedValue = 25.0 147 | 148 | self.assignmentValue = self.cgFloatValue * self.doubleValue 149 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 150 | 151 | self.assignmentValue = self.cgFloatValue * self.intValue 152 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 153 | 154 | self.assignmentValue = self.cgFloatValue * self.int16Value 155 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 156 | 157 | self.assignmentValue = self.cgFloatValue * self.int32Value 158 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 159 | 160 | self.assignmentValue = self.cgFloatValue * self.int64Value 161 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 162 | 163 | self.assignmentValue = self.cgFloatValue * self.uInt16Value 164 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 165 | 166 | self.assignmentValue = self.cgFloatValue * self.uInt32Value 167 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 168 | 169 | self.assignmentValue = self.cgFloatValue * self.uInt64Value 170 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 171 | 172 | } 173 | 174 | func testMultiplicationAssignment() { 175 | self.expectedValue = 10.0 176 | 177 | self.assignmentValue = 2.0 178 | self.assignmentValue *= self.cgFloatValue 179 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 180 | 181 | 182 | self.assignmentValue = 2.0 183 | self.assignmentValue *= self.int16Value 184 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 185 | 186 | self.assignmentValue = 2.0 187 | self.assignmentValue *= self.int32Value 188 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 189 | 190 | self.assignmentValue = 2.0 191 | self.assignmentValue *= self.int64Value 192 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 193 | 194 | self.assignmentValue = 2.0 195 | self.assignmentValue *= self.uInt16Value 196 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 197 | 198 | self.assignmentValue = 2.0 199 | self.assignmentValue *= self.uInt32Value 200 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 201 | 202 | self.assignmentValue = 2.0 203 | self.assignmentValue *= self.uInt64Value 204 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 205 | 206 | 207 | } 208 | func testDivision() { 209 | self.expectedValue = 1.0 210 | 211 | self.assignmentValue = self.cgFloatValue / self.doubleValue 212 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 213 | 214 | self.assignmentValue = self.cgFloatValue / self.intValue 215 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 216 | 217 | self.assignmentValue = self.cgFloatValue / self.int16Value 218 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 219 | 220 | self.assignmentValue = self.cgFloatValue / self.int32Value 221 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 222 | 223 | self.assignmentValue = self.cgFloatValue / self.int64Value 224 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 225 | 226 | self.assignmentValue = self.cgFloatValue / self.uInt16Value 227 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 228 | 229 | self.assignmentValue = self.cgFloatValue / self.uInt32Value 230 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 231 | 232 | self.assignmentValue = self.cgFloatValue / self.uInt64Value 233 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 234 | 235 | } 236 | 237 | func testDivisionAssignment() { 238 | self.expectedValue = 2.0 239 | 240 | self.assignmentValue = 10.0 241 | self.assignmentValue /= self.cgFloatValue 242 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 243 | 244 | self.assignmentValue = 10.0 245 | self.assignmentValue /= self.int16Value 246 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 247 | 248 | self.assignmentValue = 10.0 249 | self.assignmentValue /= self.int32Value 250 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 251 | 252 | self.assignmentValue = 10.0 253 | self.assignmentValue /= self.int64Value 254 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 255 | 256 | self.assignmentValue = 10.0 257 | self.assignmentValue /= self.uInt16Value 258 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 259 | 260 | self.assignmentValue = 10.0 261 | self.assignmentValue /= self.uInt32Value 262 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 263 | 264 | self.assignmentValue = 10.0 265 | self.assignmentValue /= self.uInt64Value 266 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 267 | 268 | 269 | } 270 | 271 | } 272 | -------------------------------------------------------------------------------- /TestsAndSample/Tests/TestsCGFloatComparable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestsCGFloatComparable.swift 3 | // TestsAndSample 4 | // 5 | // Created by Seivan Heidari on 01/07/14. 6 | // Copyright (c) 2014 Seivan Heidari. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class TestsCGFloatComparable: SuperTestsScalarComparable, ScalarComparableTesting { 12 | 13 | func testEqual() { 14 | XCTAssert(self.cgFloatValue == self.doubleValue); 15 | XCTAssert(self.cgFloatValue == self.intValue); 16 | XCTAssert(self.cgFloatValue == self.int16Value); 17 | XCTAssert(self.cgFloatValue == self.int32Value); 18 | XCTAssert(self.cgFloatValue == self.int64Value); 19 | XCTAssert(self.cgFloatValue == self.uInt16Value); 20 | XCTAssert(self.cgFloatValue == self.uInt16Value); 21 | XCTAssert(self.cgFloatValue == self.uInt16Value); 22 | } 23 | 24 | func testNotEqual() { 25 | XCTAssertFalse(self.cgFloatValue != self.doubleValue); 26 | XCTAssertFalse(self.cgFloatValue != self.intValue); 27 | XCTAssertFalse(self.cgFloatValue != self.int16Value); 28 | XCTAssertFalse(self.cgFloatValue != self.int32Value); 29 | XCTAssertFalse(self.cgFloatValue != self.int64Value); 30 | XCTAssertFalse(self.cgFloatValue != self.uInt16Value); 31 | XCTAssertFalse(self.cgFloatValue != self.uInt16Value); 32 | XCTAssertFalse(self.cgFloatValue != self.uInt16Value); 33 | 34 | 35 | } 36 | func testLessThanOrEqual() { 37 | XCTAssert(self.cgFloatValue <= self.doubleValue); 38 | XCTAssert(self.cgFloatValue <= self.intValue); 39 | XCTAssert(self.cgFloatValue <= self.int16Value); 40 | XCTAssert(self.cgFloatValue <= self.int32Value); 41 | XCTAssert(self.cgFloatValue <= self.int64Value); 42 | XCTAssert(self.cgFloatValue <= self.uInt16Value); 43 | XCTAssert(self.cgFloatValue <= self.uInt16Value); 44 | XCTAssert(self.cgFloatValue <= self.uInt16Value); 45 | 46 | self.cgFloatValue = -1 47 | XCTAssert(self.cgFloatValue <= self.doubleValue); 48 | XCTAssert(self.cgFloatValue <= self.intValue); 49 | XCTAssert(self.cgFloatValue <= self.int16Value); 50 | XCTAssert(self.cgFloatValue <= self.int32Value); 51 | XCTAssert(self.cgFloatValue <= self.int64Value); 52 | XCTAssert(self.cgFloatValue <= self.uInt16Value); 53 | XCTAssert(self.cgFloatValue <= self.uInt16Value); 54 | XCTAssert(self.cgFloatValue <= self.uInt16Value); 55 | 56 | 57 | 58 | } 59 | func testLessThan() { 60 | self.cgFloatValue = -1 61 | XCTAssert(self.cgFloatValue < self.doubleValue); 62 | XCTAssert(self.cgFloatValue < self.intValue); 63 | XCTAssert(self.cgFloatValue < self.int16Value); 64 | XCTAssert(self.cgFloatValue < self.int32Value); 65 | XCTAssert(self.cgFloatValue < self.int64Value); 66 | XCTAssert(self.cgFloatValue < self.uInt16Value); 67 | XCTAssert(self.cgFloatValue < self.uInt16Value); 68 | XCTAssert(self.cgFloatValue < self.uInt16Value); 69 | 70 | 71 | } 72 | 73 | func testGreaterThanOrEqual() { 74 | 75 | XCTAssert(self.cgFloatValue >= self.doubleValue); 76 | XCTAssert(self.cgFloatValue >= self.intValue); 77 | XCTAssert(self.cgFloatValue >= self.int16Value); 78 | XCTAssert(self.cgFloatValue >= self.int32Value); 79 | XCTAssert(self.cgFloatValue >= self.int64Value); 80 | XCTAssert(self.cgFloatValue >= self.uInt16Value); 81 | XCTAssert(self.cgFloatValue >= self.uInt16Value); 82 | XCTAssert(self.cgFloatValue >= self.uInt16Value); 83 | 84 | 85 | self.cgFloatValue = -1 86 | XCTAssertFalse(self.cgFloatValue >= self.doubleValue); 87 | XCTAssertFalse(self.cgFloatValue >= self.intValue); 88 | XCTAssertFalse(self.cgFloatValue >= self.int16Value); 89 | XCTAssertFalse(self.cgFloatValue >= self.int32Value); 90 | XCTAssertFalse(self.cgFloatValue >= self.int64Value); 91 | XCTAssertFalse(self.cgFloatValue >= self.uInt16Value); 92 | XCTAssertFalse(self.cgFloatValue >= self.uInt16Value); 93 | XCTAssertFalse(self.cgFloatValue >= self.uInt16Value); 94 | 95 | 96 | 97 | } 98 | 99 | func testGreaterThan() { 100 | self.cgFloatValue = -1 101 | XCTAssertFalse(self.cgFloatValue > self.doubleValue); 102 | XCTAssertFalse(self.cgFloatValue > self.intValue); 103 | XCTAssertFalse(self.cgFloatValue > self.int16Value); 104 | XCTAssertFalse(self.cgFloatValue > self.int32Value); 105 | XCTAssertFalse(self.cgFloatValue > self.int64Value); 106 | XCTAssertFalse(self.cgFloatValue > self.uInt16Value); 107 | XCTAssertFalse(self.cgFloatValue > self.uInt16Value); 108 | XCTAssertFalse(self.cgFloatValue > self.uInt16Value); 109 | 110 | 111 | 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /TestsAndSample/Tests/TestsDoubleArithmeticTesting.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestsDoubleArithmeticTesting.swift 3 | // TestsAndSample 4 | // 5 | // Created by Seivan Heidari on 01/07/14. 6 | // Copyright (c) 2014 Seivan Heidari. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | func lol(arg:Double) { 12 | 13 | } 14 | 15 | class TestsDoubleArithmeticTesting: SuperTestsScalarFloatingPointType, ScalarFloatingPointTypeTesting { 16 | 17 | var expectedValue:Double? 18 | var assignmentValue:Double = 0.0 19 | 20 | func testAddition() { 21 | self.expectedValue = 10.0 22 | 23 | 24 | 25 | self.assignmentValue = self.doubleValue + self.cgFloatValue 26 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 27 | 28 | self.assignmentValue = self.doubleValue + self.intValue 29 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 30 | 31 | self.assignmentValue = self.doubleValue + self.int16Value 32 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 33 | 34 | self.assignmentValue = self.doubleValue + self.int32Value 35 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 36 | 37 | self.assignmentValue = self.doubleValue + self.int64Value 38 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 39 | 40 | self.assignmentValue = self.doubleValue + self.uInt16Value 41 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 42 | 43 | self.assignmentValue = self.doubleValue + self.uInt32Value 44 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 45 | 46 | self.assignmentValue = self.doubleValue + self.uInt64Value 47 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 48 | 49 | } 50 | 51 | func testAdditionAssignment() { 52 | self.expectedValue = 6.0 53 | 54 | self.assignmentValue = 1.0 55 | self.assignmentValue += self.cgFloatValue 56 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 57 | 58 | self.assignmentValue = 1.0 59 | self.assignmentValue += self.intValue 60 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 61 | 62 | self.assignmentValue = 1.0 63 | self.assignmentValue += self.int16Value 64 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 65 | 66 | self.assignmentValue = 1.0 67 | self.assignmentValue += self.int32Value 68 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 69 | 70 | self.assignmentValue = 1.0 71 | self.assignmentValue += self.int64Value 72 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 73 | 74 | self.assignmentValue = 1.0 75 | self.assignmentValue += self.uInt16Value 76 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 77 | 78 | self.assignmentValue = 1.0 79 | self.assignmentValue += self.uInt32Value 80 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 81 | 82 | self.assignmentValue = 1.0 83 | self.assignmentValue += self.uInt64Value 84 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 85 | 86 | 87 | 88 | } 89 | 90 | func testSubtraction() { 91 | self.expectedValue = 0.0 92 | 93 | self.assignmentValue = self.doubleValue - self.cgFloatValue 94 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 95 | 96 | self.assignmentValue = self.doubleValue - self.intValue 97 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 98 | 99 | self.assignmentValue = self.doubleValue - self.int16Value 100 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 101 | 102 | self.assignmentValue = self.doubleValue - self.int32Value 103 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 104 | 105 | self.assignmentValue = self.doubleValue - self.int64Value 106 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 107 | 108 | self.assignmentValue = self.doubleValue - self.uInt16Value 109 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 110 | 111 | self.assignmentValue = self.doubleValue - self.uInt32Value 112 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 113 | 114 | self.assignmentValue = self.doubleValue - self.uInt64Value 115 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 116 | 117 | 118 | } 119 | func testSubtractionAssignment() { 120 | self.expectedValue = -4.0 121 | 122 | self.assignmentValue = 1.0 123 | self.assignmentValue -= self.cgFloatValue 124 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 125 | 126 | self.assignmentValue = 1.0 127 | self.assignmentValue -= self.int16Value 128 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 129 | 130 | self.assignmentValue = 1.0 131 | self.assignmentValue -= self.int32Value 132 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 133 | 134 | self.assignmentValue = 1.0 135 | self.assignmentValue -= self.int64Value 136 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 137 | 138 | self.assignmentValue = 1.0 139 | self.assignmentValue -= self.uInt16Value 140 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 141 | 142 | self.assignmentValue = 1.0 143 | self.assignmentValue -= self.uInt32Value 144 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 145 | 146 | self.assignmentValue = 1.0 147 | self.assignmentValue -= self.uInt64Value 148 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 149 | 150 | } 151 | 152 | func testMultiplication() { 153 | self.expectedValue = 25.0 154 | 155 | self.assignmentValue = self.doubleValue * self.cgFloatValue 156 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 157 | 158 | self.assignmentValue = self.doubleValue * self.intValue 159 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 160 | 161 | 162 | self.assignmentValue = self.doubleValue * self.int16Value 163 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 164 | 165 | self.assignmentValue = self.doubleValue * self.int32Value 166 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 167 | 168 | self.assignmentValue = self.doubleValue * self.int64Value 169 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 170 | 171 | self.assignmentValue = self.doubleValue * self.uInt16Value 172 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 173 | 174 | self.assignmentValue = self.doubleValue * self.uInt32Value 175 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 176 | 177 | self.assignmentValue = self.doubleValue * self.uInt64Value 178 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 179 | 180 | } 181 | 182 | func testMultiplicationAssignment() { 183 | self.expectedValue = 10.0 184 | 185 | self.assignmentValue = 2.0 186 | self.assignmentValue *= self.cgFloatValue 187 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 188 | 189 | self.assignmentValue = 2.0 190 | self.assignmentValue *= self.intValue 191 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 192 | 193 | self.assignmentValue = 2.0 194 | self.assignmentValue *= self.int16Value 195 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 196 | 197 | self.assignmentValue = 2.0 198 | self.assignmentValue *= self.int32Value 199 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 200 | 201 | self.assignmentValue = 2.0 202 | self.assignmentValue *= self.int64Value 203 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 204 | 205 | self.assignmentValue = 2.0 206 | self.assignmentValue *= self.uInt16Value 207 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 208 | 209 | self.assignmentValue = 2.0 210 | self.assignmentValue *= self.uInt32Value 211 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 212 | 213 | self.assignmentValue = 2.0 214 | self.assignmentValue *= self.uInt64Value 215 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 216 | 217 | } 218 | func testDivision() { 219 | self.expectedValue = 1.0 220 | 221 | self.assignmentValue = self.doubleValue / self.cgFloatValue 222 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 223 | 224 | self.assignmentValue = self.doubleValue / self.intValue 225 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 226 | 227 | self.assignmentValue = self.doubleValue / self.int16Value 228 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 229 | 230 | self.assignmentValue = self.doubleValue / self.int32Value 231 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 232 | 233 | self.assignmentValue = self.doubleValue / self.int64Value 234 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 235 | 236 | self.assignmentValue = self.doubleValue / self.uInt16Value 237 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 238 | 239 | self.assignmentValue = self.doubleValue / self.uInt32Value 240 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 241 | 242 | self.assignmentValue = self.doubleValue / self.uInt64Value 243 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 244 | 245 | 246 | } 247 | func testDivisionAssignment() { 248 | self.expectedValue = 2.0 249 | 250 | self.assignmentValue = 10.0 251 | self.assignmentValue /= self.cgFloatValue 252 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 253 | 254 | self.assignmentValue = 10.0 255 | self.assignmentValue /= self.intValue 256 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 257 | 258 | self.assignmentValue = 10.0 259 | self.assignmentValue /= self.int16Value 260 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 261 | 262 | self.assignmentValue = 10.0 263 | self.assignmentValue /= self.int32Value 264 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 265 | 266 | self.assignmentValue = 10.0 267 | self.assignmentValue /= self.int64Value 268 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 269 | 270 | self.assignmentValue = 10.0 271 | self.assignmentValue /= self.uInt16Value 272 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 273 | 274 | self.assignmentValue = 10.0 275 | self.assignmentValue /= self.uInt32Value 276 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 277 | 278 | self.assignmentValue = 10.0 279 | self.assignmentValue /= self.uInt64Value 280 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 281 | 282 | 283 | 284 | } 285 | 286 | 287 | } 288 | -------------------------------------------------------------------------------- /TestsAndSample/Tests/TestsDoubleComparable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestsDoubleComparable.swift 3 | // TestsAndSample 4 | // 5 | // Created by Seivan Heidari on 01/07/14. 6 | // Copyright (c) 2014 Seivan Heidari. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class TestsDoubleComparable: SuperTestsScalarComparable, ScalarComparableTesting { 12 | 13 | func testEqual() { 14 | XCTAssert(self.doubleValue == self.intValue); 15 | XCTAssert(self.doubleValue == self.cgFloatValue); 16 | XCTAssert(self.doubleValue == self.int16Value); 17 | XCTAssert(self.doubleValue == self.int32Value); 18 | XCTAssert(self.doubleValue == self.int64Value); 19 | XCTAssert(self.doubleValue == self.uInt16Value); 20 | XCTAssert(self.doubleValue == self.uInt16Value); 21 | XCTAssert(self.doubleValue == self.uInt16Value); 22 | 23 | 24 | } 25 | func testNotEqual() { 26 | XCTAssertFalse(self.doubleValue != self.intValue); 27 | XCTAssertFalse(self.doubleValue != self.cgFloatValue); 28 | XCTAssertFalse(self.doubleValue != self.int16Value); 29 | XCTAssertFalse(self.doubleValue != self.int32Value); 30 | XCTAssertFalse(self.doubleValue != self.int64Value); 31 | XCTAssertFalse(self.doubleValue != self.uInt16Value); 32 | XCTAssertFalse(self.doubleValue != self.uInt16Value); 33 | XCTAssertFalse(self.doubleValue != self.uInt16Value); 34 | 35 | 36 | } 37 | func testLessThanOrEqual() { 38 | XCTAssert(self.doubleValue <= self.intValue); 39 | XCTAssert(self.doubleValue <= self.cgFloatValue); 40 | XCTAssert(self.doubleValue <= self.int16Value); 41 | XCTAssert(self.doubleValue <= self.int32Value); 42 | XCTAssert(self.doubleValue <= self.int64Value); 43 | XCTAssert(self.doubleValue <= self.uInt16Value); 44 | XCTAssert(self.doubleValue <= self.uInt16Value); 45 | XCTAssert(self.doubleValue <= self.uInt16Value); 46 | 47 | self.doubleValue = -1 48 | XCTAssert(self.doubleValue <= self.intValue); 49 | XCTAssert(self.doubleValue <= self.cgFloatValue); 50 | XCTAssert(self.doubleValue <= self.int16Value); 51 | XCTAssert(self.doubleValue <= self.int32Value); 52 | XCTAssert(self.doubleValue <= self.int64Value); 53 | XCTAssert(self.doubleValue <= self.uInt16Value); 54 | XCTAssert(self.doubleValue <= self.uInt16Value); 55 | XCTAssert(self.doubleValue <= self.uInt16Value); 56 | 57 | 58 | 59 | } 60 | func testLessThan() { 61 | self.doubleValue = -1 62 | XCTAssert(self.doubleValue < self.intValue); 63 | XCTAssert(self.doubleValue < self.cgFloatValue); 64 | XCTAssert(self.doubleValue < self.int16Value); 65 | XCTAssert(self.doubleValue < self.int32Value); 66 | XCTAssert(self.doubleValue < self.int64Value); 67 | XCTAssert(self.doubleValue < self.uInt16Value); 68 | XCTAssert(self.doubleValue < self.uInt16Value); 69 | XCTAssert(self.doubleValue < self.uInt16Value); 70 | 71 | 72 | } 73 | 74 | func testGreaterThanOrEqual() { 75 | 76 | XCTAssert(self.doubleValue >= self.intValue); 77 | XCTAssert(self.doubleValue >= self.cgFloatValue); 78 | XCTAssert(self.doubleValue >= self.int16Value); 79 | XCTAssert(self.doubleValue >= self.int32Value); 80 | XCTAssert(self.doubleValue >= self.int64Value); 81 | XCTAssert(self.doubleValue >= self.uInt16Value); 82 | XCTAssert(self.doubleValue >= self.uInt16Value); 83 | XCTAssert(self.doubleValue >= self.uInt16Value); 84 | 85 | 86 | self.doubleValue = -1 87 | XCTAssertFalse(self.doubleValue >= self.intValue); 88 | XCTAssertFalse(self.doubleValue >= self.cgFloatValue); 89 | XCTAssertFalse(self.doubleValue >= self.int16Value); 90 | XCTAssertFalse(self.doubleValue >= self.int32Value); 91 | XCTAssertFalse(self.doubleValue >= self.int64Value); 92 | XCTAssertFalse(self.doubleValue >= self.uInt16Value); 93 | XCTAssertFalse(self.doubleValue >= self.uInt16Value); 94 | XCTAssertFalse(self.doubleValue >= self.uInt16Value); 95 | 96 | } 97 | 98 | func testGreaterThan() { 99 | 100 | self.doubleValue = -1 101 | XCTAssertFalse(self.doubleValue > self.intValue); 102 | XCTAssertFalse(self.doubleValue > self.cgFloatValue); 103 | XCTAssertFalse(self.doubleValue > self.int16Value); 104 | XCTAssertFalse(self.doubleValue > self.int32Value); 105 | XCTAssertFalse(self.doubleValue > self.int64Value); 106 | XCTAssertFalse(self.doubleValue > self.uInt16Value); 107 | XCTAssertFalse(self.doubleValue > self.uInt16Value); 108 | XCTAssertFalse(self.doubleValue > self.uInt16Value); 109 | 110 | 111 | 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /TestsAndSample/Tests/TestsIntArithmeticTesting.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestsIntArithmeticTesting.swift 3 | // TestsAndSample 4 | // 5 | // Created by Seivan Heidari on 01/07/14. 6 | // Copyright (c) 2014 Seivan Heidari. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | 12 | class TestsIntArithmeticTesting: SuperTestsScalarFloatingPointType, ScalarFloatingPointTypeTesting { 13 | var assignmentIntValue:Int = Int(0) 14 | var expectedIntValue:Int? 15 | 16 | var expectedValue:Double? 17 | var assignmentValue:Double = 0.0 18 | 19 | 20 | func testAddition() { 21 | self.expectedValue = 10.0 22 | 23 | 24 | self.assignmentValue = self.intValue + self.doubleValue 25 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 26 | 27 | self.assignmentValue = Double(self.intValue + self.cgFloatValue) 28 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 29 | 30 | self.expectedIntValue = 10 31 | 32 | self.assignmentIntValue = self.intValue + self.int16Value 33 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 34 | 35 | self.assignmentIntValue = self.intValue + self.int32Value 36 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 37 | 38 | self.assignmentIntValue = self.intValue + self.int64Value 39 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 40 | 41 | 42 | 43 | 44 | } 45 | 46 | func testAdditionAssignment() { 47 | self.expectedValue = 6.0 48 | 49 | 50 | self.expectedIntValue = 6 51 | 52 | self.assignmentIntValue = 1 53 | self.assignmentIntValue += self.int16Value 54 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 55 | 56 | self.assignmentIntValue = 1 57 | self.assignmentIntValue += self.int32Value 58 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 59 | 60 | self.assignmentIntValue = 1 61 | self.assignmentIntValue += self.int64Value 62 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 63 | 64 | 65 | 66 | } 67 | 68 | func testSubtraction() { 69 | self.expectedValue = 0.0 70 | 71 | self.assignmentValue = self.intValue - self.doubleValue 72 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 73 | 74 | self.assignmentValue = Double(self.intValue - self.cgFloatValue) 75 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 76 | 77 | self.expectedIntValue = 0 78 | self.assignmentIntValue = self.intValue - self.int16Value 79 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 80 | 81 | self.assignmentIntValue = self.intValue - self.int32Value 82 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 83 | 84 | self.assignmentIntValue = self.intValue - self.int64Value 85 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 86 | 87 | 88 | 89 | } 90 | 91 | func testSubtractionAssignment() { 92 | self.expectedValue = -4.0 93 | 94 | self.assignmentValue = 1.0 95 | self.assignmentValue -= self.intValue 96 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 97 | 98 | self.expectedIntValue = -4 99 | 100 | self.assignmentIntValue = 1 101 | self.assignmentIntValue -= self.int16Value 102 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 103 | 104 | self.assignmentIntValue = 1 105 | self.assignmentIntValue -= self.int32Value 106 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 107 | 108 | self.assignmentIntValue = 1 109 | self.assignmentIntValue -= self.int64Value 110 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 111 | 112 | 113 | 114 | } 115 | 116 | func testMultiplication() { 117 | self.expectedValue = 25.0 118 | 119 | self.assignmentValue = self.intValue * self.doubleValue 120 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 121 | 122 | self.assignmentValue = Double(self.intValue * self.cgFloatValue) 123 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 124 | 125 | self.expectedIntValue = 25 126 | self.assignmentIntValue = self.intValue * self.int16Value 127 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 128 | 129 | self.assignmentIntValue = self.intValue * self.int32Value 130 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 131 | 132 | self.assignmentIntValue = self.intValue * self.int64Value 133 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 134 | 135 | 136 | 137 | 138 | 139 | } 140 | 141 | func testMultiplicationAssignment() { 142 | self.expectedValue = 10.0 143 | 144 | self.assignmentValue = 2.0 145 | self.assignmentValue *= self.intValue 146 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 147 | 148 | self.expectedIntValue = 10 149 | 150 | self.assignmentIntValue = 2 151 | self.assignmentIntValue *= self.int16Value 152 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 153 | 154 | self.assignmentIntValue = 2 155 | self.assignmentIntValue *= self.int32Value 156 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 157 | 158 | self.assignmentIntValue = 2 159 | self.assignmentIntValue *= self.int64Value 160 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 161 | 162 | 163 | 164 | } 165 | func testDivision() { 166 | self.expectedValue = 1.0 167 | 168 | self.assignmentValue = self.intValue / self.doubleValue 169 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 170 | 171 | self.assignmentValue = Double(self.intValue / self.cgFloatValue) 172 | XCTAssertEqual(self.assignmentValue, self.expectedValue!) 173 | 174 | self.expectedIntValue = 1 175 | self.assignmentIntValue = self.intValue / self.int16Value 176 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 177 | 178 | self.assignmentIntValue = self.intValue / self.int32Value 179 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 180 | 181 | self.assignmentIntValue = self.intValue / self.int64Value 182 | XCTAssertEqual(self.assignmentIntValue, self.expectedIntValue!) 183 | 184 | } 185 | 186 | } 187 | -------------------------------------------------------------------------------- /TestsAndSample/Tests/TestsIntComparable.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestsIntComparable.swift 3 | // TestsAndSample 4 | // 5 | // Created by Seivan Heidari on 01/07/14. 6 | // Copyright (c) 2014 Seivan Heidari. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class TestsIntComparable: SuperTestsScalarComparable, ScalarComparableTesting { 12 | 13 | func testEqual() { 14 | XCTAssert(self.intValue == self.doubleValue); 15 | XCTAssert(self.intValue == self.cgFloatValue); 16 | XCTAssert(self.intValue == self.int16Value); 17 | XCTAssert(self.intValue == self.int32Value); 18 | XCTAssert(self.intValue == self.int64Value); 19 | XCTAssert(self.intValue == self.uInt16Value); 20 | XCTAssert(self.intValue == self.uInt16Value); 21 | XCTAssert(self.intValue == self.uInt16Value); 22 | 23 | 24 | } 25 | func testNotEqual() { 26 | XCTAssertFalse(self.intValue != self.doubleValue); 27 | XCTAssertFalse(self.intValue != self.cgFloatValue); 28 | XCTAssertFalse(self.intValue != self.int16Value); 29 | XCTAssertFalse(self.intValue != self.int32Value); 30 | XCTAssertFalse(self.intValue != self.int64Value); 31 | XCTAssertFalse(self.intValue != self.uInt16Value); 32 | XCTAssertFalse(self.intValue != self.uInt16Value); 33 | XCTAssertFalse(self.intValue != self.uInt16Value); 34 | 35 | 36 | } 37 | func testLessThanOrEqual() { 38 | XCTAssert(self.intValue <= self.doubleValue); 39 | XCTAssert(self.intValue <= self.cgFloatValue); 40 | XCTAssert(self.intValue <= self.int16Value); 41 | XCTAssert(self.intValue <= self.int32Value); 42 | XCTAssert(self.intValue <= self.int64Value); 43 | XCTAssert(self.intValue <= self.uInt16Value); 44 | XCTAssert(self.intValue <= self.uInt16Value); 45 | XCTAssert(self.intValue <= self.uInt16Value); 46 | 47 | 48 | self.intValue = -1 49 | XCTAssert(self.intValue <= self.doubleValue); 50 | XCTAssert(self.intValue <= self.cgFloatValue); 51 | XCTAssert(self.intValue <= self.int16Value); 52 | XCTAssert(self.intValue <= self.int32Value); 53 | XCTAssert(self.intValue <= self.int64Value); 54 | XCTAssert(self.intValue <= self.uInt16Value); 55 | XCTAssert(self.intValue <= self.uInt16Value); 56 | XCTAssert(self.intValue <= self.uInt16Value); 57 | 58 | 59 | 60 | } 61 | func testLessThan() { 62 | self.intValue = -1 63 | XCTAssert(self.intValue < self.doubleValue); 64 | XCTAssert(self.intValue < self.cgFloatValue); 65 | XCTAssert(self.intValue < self.int16Value); 66 | XCTAssert(self.intValue < self.int32Value); 67 | XCTAssert(self.intValue < self.int64Value); 68 | XCTAssert(self.intValue < self.uInt16Value); 69 | XCTAssert(self.intValue < self.uInt16Value); 70 | XCTAssert(self.intValue < self.uInt16Value); 71 | 72 | 73 | } 74 | 75 | func testGreaterThanOrEqual() { 76 | 77 | XCTAssert(self.intValue >= self.doubleValue); 78 | XCTAssert(self.intValue >= self.cgFloatValue); 79 | XCTAssert(self.intValue >= self.int16Value); 80 | XCTAssert(self.intValue >= self.int32Value); 81 | XCTAssert(self.intValue >= self.int64Value); 82 | XCTAssert(self.intValue >= self.uInt16Value); 83 | XCTAssert(self.intValue >= self.uInt16Value); 84 | XCTAssert(self.intValue >= self.uInt16Value); 85 | 86 | 87 | self.intValue = -1 88 | XCTAssertFalse(self.intValue >= self.doubleValue); 89 | XCTAssertFalse(self.intValue >= self.cgFloatValue); 90 | XCTAssertFalse(self.intValue >= self.int16Value); 91 | XCTAssertFalse(self.intValue >= self.int32Value); 92 | XCTAssertFalse(self.intValue >= self.int64Value); 93 | XCTAssertFalse(self.intValue >= self.uInt16Value); 94 | XCTAssertFalse(self.intValue >= self.uInt16Value); 95 | XCTAssertFalse(self.intValue >= self.uInt16Value); 96 | 97 | 98 | } 99 | 100 | func testGreaterThan() { 101 | self.intValue = -1 102 | XCTAssertFalse(self.intValue > self.doubleValue); 103 | XCTAssertFalse(self.intValue > self.cgFloatValue); 104 | XCTAssertFalse(self.intValue > self.int16Value); 105 | XCTAssertFalse(self.intValue > self.int32Value); 106 | XCTAssertFalse(self.intValue > self.int64Value); 107 | XCTAssertFalse(self.intValue > self.uInt16Value); 108 | XCTAssertFalse(self.intValue > self.uInt16Value); 109 | XCTAssertFalse(self.intValue > self.uInt16Value); 110 | 111 | 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /TestsAndSample/Tests/TestsMathFunctions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TestsAndSampleTests.swift 3 | // TestsAndSampleTests 4 | // 5 | // Created by Seivan Heidari on 29/06/14. 6 | // Copyright (c) 2014 Seivan Heidari. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | //extension Double : FloatingPointOperating {} 12 | //extension CGFloat : FloatingPointOperating {} 13 | 14 | class TestsMathFunctionsDouble: XCTestCase { 15 | typealias Main = Double; 16 | let mainType:Double = 0.5 17 | var expected:Double? 18 | let alternativeType:CGFloat = 7.7 19 | 20 | 21 | 22 | func testAcos() { 23 | self.expected = acos(self.mainType) 24 | XCTAssertEqual(self.expected!, self.mainType.acos) 25 | } 26 | func testAsin() { 27 | self.expected = asin(self.mainType) 28 | XCTAssertEqual(self.expected!, self.mainType.asin) 29 | } 30 | func testAtan() { 31 | self.expected = atan(self.mainType) 32 | XCTAssertEqual(self.expected!, self.mainType.atan) 33 | } 34 | func testAtan2() { 35 | self.expected = atan2(self.mainType, Main(self.alternativeType)) 36 | XCTAssertEqual(self.expected!, self.mainType.atan2(self.alternativeType)) 37 | } 38 | func testCos() { 39 | self.expected = cos(self.mainType) 40 | XCTAssertEqual(self.expected!, self.mainType.cos) 41 | } 42 | func testSin() { 43 | self.expected = sin(self.mainType) 44 | XCTAssertEqual(self.expected!, self.mainType.sin) 45 | } 46 | func testTan() { 47 | self.expected = tan(self.mainType) 48 | XCTAssertEqual(self.expected!, self.mainType.tan) 49 | } 50 | func testExp() { 51 | self.expected = exp(self.mainType) 52 | XCTAssertEqual(self.expected!, self.mainType.exp) 53 | } 54 | func testExp2() { 55 | self.expected = exp2(self.mainType) 56 | XCTAssertEqual(self.expected!, self.mainType.exp2) 57 | } 58 | func testLog() { 59 | self.expected = log(self.mainType) 60 | XCTAssertEqual(self.expected!, self.mainType.log) 61 | } 62 | func testLog10() { 63 | self.expected = log10(self.mainType) 64 | XCTAssertEqual(self.expected!, self.mainType.log10) 65 | } 66 | func testLog2() { 67 | self.expected = log2(self.mainType) 68 | XCTAssertEqual(self.expected!, self.mainType.log2) 69 | } 70 | func testPow() { 71 | self.expected = pow(self.mainType, Double(self.alternativeType)) 72 | XCTAssertEqual(self.expected!, self.mainType.pow(self.alternativeType)) 73 | } 74 | func testSqrt() { 75 | self.expected = sqrt(self.mainType) 76 | XCTAssertEqual(self.expected!, self.mainType.sqrt) 77 | } 78 | 79 | } 80 | 81 | 82 | // 83 | // TestsCGFloat.swift 84 | // TestsAndSample 85 | // 86 | // Created by Seivan Heidari on 29/06/14. 87 | // Copyright (c) 2014 Seivan Heidari. All rights reserved. 88 | // 89 | 90 | import XCTest 91 | import CoreGraphics 92 | 93 | class TestsMathFunctionsCGFloat: XCTestCase { 94 | typealias Main = CGFloat 95 | let mainType:CGFloat = 0.4 96 | var expected:CGFloat? 97 | let alternativeType:Double = 7.7 98 | 99 | 100 | 101 | func testAcos() { 102 | self.expected = acos(self.mainType) 103 | XCTAssertEqual(self.expected!, (self.mainType.acos)) 104 | } 105 | func testAsin() { 106 | self.expected = asin(self.mainType) 107 | XCTAssertEqual(self.expected!, self.mainType.asin) 108 | } 109 | func testAtan() { 110 | self.expected = atan(self.mainType) 111 | XCTAssertEqual(self.expected!, (self.mainType.atan)) 112 | } 113 | func testAtan2() { 114 | self.expected = atan2(self.mainType, CGFloat(self.alternativeType)) 115 | XCTAssertEqual(self.expected!, (self.mainType.atan2(self.alternativeType))) 116 | } 117 | func testCos() { 118 | self.expected = cos(self.mainType) 119 | XCTAssertEqual(self.expected!, (self.mainType.cos)) 120 | } 121 | func testSin() { 122 | self.expected = sin(self.mainType) 123 | XCTAssertEqual(self.expected!, (self.mainType.sin)) 124 | } 125 | func testTan() { 126 | self.expected = tan(self.mainType) 127 | XCTAssertEqual(self.expected!, (self.mainType.tan)) 128 | } 129 | func testExp() { 130 | self.expected = exp(self.mainType) 131 | XCTAssertEqual(self.expected!, (self.mainType.exp)) 132 | } 133 | func testExp2() { 134 | self.expected = exp2(self.mainType) 135 | XCTAssertEqual(self.expected!, (self.mainType.exp2)) 136 | } 137 | func testLog() { 138 | self.expected = log(self.mainType) 139 | XCTAssertEqual(self.expected!, (self.mainType.log)) 140 | } 141 | func testLog10() { 142 | self.expected = log10(self.mainType) 143 | XCTAssertEqual(self.expected!, (self.mainType.log10)) 144 | } 145 | func testLog2() { 146 | self.expected = log2(self.mainType) 147 | XCTAssertEqual(self.expected!, (self.mainType.log2)) 148 | } 149 | func testPow() { 150 | self.expected = pow(self.mainType, Main(self.alternativeType)) 151 | XCTAssertEqual(self.expected!, self.mainType.pow(self.alternativeType)) 152 | } 153 | func testSqrt() { 154 | self.expected = sqrt(self.mainType) 155 | XCTAssertEqual(self.expected!, (self.mainType.sqrt)) 156 | } 157 | 158 | } 159 | -------------------------------------------------------------------------------- /TestsAndSample/Tests32/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /TestsAndSample/Tests32/Tests32.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Tests32.swift 3 | // Tests32 4 | // 5 | // Created by Seivan Heidari on 10/02/16. 6 | // Copyright © 2016 Seivan Heidari. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class Tests32: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | // Use XCTAssert and related functions to verify your tests produce the correct results. 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /TestsAndSample/Tests64/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /TestsAndSample/TestsAndSample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 221D1E471C6C543800396AD3 /* ScalarArithmetic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22AFC49F19603997003572F3 /* ScalarArithmetic.swift */; }; 11 | 221D1E501C6CE41800396AD3 /* ScalarArithmetic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22AFC49F19603997003572F3 /* ScalarArithmetic.swift */; }; 12 | 221D1E651C6D021000396AD3 /* SuperTestsScalarArithmetic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E5C1C6D021000396AD3 /* SuperTestsScalarArithmetic.swift */; }; 13 | 221D1E661C6D021000396AD3 /* SuperTestsScalarArithmetic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E5C1C6D021000396AD3 /* SuperTestsScalarArithmetic.swift */; }; 14 | 221D1E671C6D021000396AD3 /* SuperTestsScalarComparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E5D1C6D021000396AD3 /* SuperTestsScalarComparable.swift */; }; 15 | 221D1E681C6D021000396AD3 /* SuperTestsScalarComparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E5D1C6D021000396AD3 /* SuperTestsScalarComparable.swift */; }; 16 | 221D1E691C6D021000396AD3 /* TestsCGFloatArithmeticTesting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E5E1C6D021000396AD3 /* TestsCGFloatArithmeticTesting.swift */; }; 17 | 221D1E6A1C6D021000396AD3 /* TestsCGFloatArithmeticTesting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E5E1C6D021000396AD3 /* TestsCGFloatArithmeticTesting.swift */; }; 18 | 221D1E6B1C6D021000396AD3 /* TestsCGFloatComparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E5F1C6D021000396AD3 /* TestsCGFloatComparable.swift */; }; 19 | 221D1E6C1C6D021000396AD3 /* TestsCGFloatComparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E5F1C6D021000396AD3 /* TestsCGFloatComparable.swift */; }; 20 | 221D1E6D1C6D021000396AD3 /* TestsDoubleArithmeticTesting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E601C6D021000396AD3 /* TestsDoubleArithmeticTesting.swift */; }; 21 | 221D1E6E1C6D021000396AD3 /* TestsDoubleArithmeticTesting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E601C6D021000396AD3 /* TestsDoubleArithmeticTesting.swift */; }; 22 | 221D1E6F1C6D021000396AD3 /* TestsDoubleComparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E611C6D021000396AD3 /* TestsDoubleComparable.swift */; }; 23 | 221D1E701C6D021000396AD3 /* TestsDoubleComparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E611C6D021000396AD3 /* TestsDoubleComparable.swift */; }; 24 | 221D1E711C6D021000396AD3 /* TestsIntArithmeticTesting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E621C6D021000396AD3 /* TestsIntArithmeticTesting.swift */; }; 25 | 221D1E721C6D021000396AD3 /* TestsIntArithmeticTesting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E621C6D021000396AD3 /* TestsIntArithmeticTesting.swift */; }; 26 | 221D1E731C6D021000396AD3 /* TestsIntComparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E631C6D021000396AD3 /* TestsIntComparable.swift */; }; 27 | 221D1E741C6D021000396AD3 /* TestsIntComparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E631C6D021000396AD3 /* TestsIntComparable.swift */; }; 28 | 221D1E751C6D021000396AD3 /* TestsMathFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E641C6D021000396AD3 /* TestsMathFunctions.swift */; }; 29 | 221D1E761C6D021000396AD3 /* TestsMathFunctions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 221D1E641C6D021000396AD3 /* TestsMathFunctions.swift */; }; 30 | 223C4D7F1C6B715400E658E6 /* Tests32.swift in Sources */ = {isa = PBXBuildFile; fileRef = 223C4D7E1C6B715400E658E6 /* Tests32.swift */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 221D1E5C1C6D021000396AD3 /* SuperTestsScalarArithmetic.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperTestsScalarArithmetic.swift; sourceTree = ""; }; 35 | 221D1E5D1C6D021000396AD3 /* SuperTestsScalarComparable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperTestsScalarComparable.swift; sourceTree = ""; }; 36 | 221D1E5E1C6D021000396AD3 /* TestsCGFloatArithmeticTesting.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestsCGFloatArithmeticTesting.swift; sourceTree = ""; }; 37 | 221D1E5F1C6D021000396AD3 /* TestsCGFloatComparable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestsCGFloatComparable.swift; sourceTree = ""; }; 38 | 221D1E601C6D021000396AD3 /* TestsDoubleArithmeticTesting.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestsDoubleArithmeticTesting.swift; sourceTree = ""; }; 39 | 221D1E611C6D021000396AD3 /* TestsDoubleComparable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestsDoubleComparable.swift; sourceTree = ""; }; 40 | 221D1E621C6D021000396AD3 /* TestsIntArithmeticTesting.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestsIntArithmeticTesting.swift; sourceTree = ""; }; 41 | 221D1E631C6D021000396AD3 /* TestsIntComparable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestsIntComparable.swift; sourceTree = ""; }; 42 | 221D1E641C6D021000396AD3 /* TestsMathFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestsMathFunctions.swift; sourceTree = ""; }; 43 | 223C4D5C1C6B709300E658E6 /* Tests64.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests64.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 223C4D601C6B709400E658E6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | 223C4D7C1C6B715400E658E6 /* Tests32.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests32.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 223C4D7E1C6B715400E658E6 /* Tests32.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests32.swift; sourceTree = ""; }; 47 | 223C4D801C6B715400E658E6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | 223C4D8B1C6B7E9700E658E6 /* MyPlayground.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; name = MyPlayground.playground; path = ../MyPlayground.playground; sourceTree = ""; }; 49 | 22AFC49F19603997003572F3 /* ScalarArithmetic.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScalarArithmetic.swift; sourceTree = ""; }; 50 | 22F2324F1C6246D30086660A /* ScalarArithmeticExperimental.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScalarArithmeticExperimental.swift; sourceTree = ""; }; 51 | /* End PBXFileReference section */ 52 | 53 | /* Begin PBXFrameworksBuildPhase section */ 54 | 223C4D591C6B709300E658E6 /* Frameworks */ = { 55 | isa = PBXFrameworksBuildPhase; 56 | buildActionMask = 2147483647; 57 | files = ( 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | 223C4D791C6B715400E658E6 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 221D1E5B1C6D021000396AD3 /* Tests */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 221D1E5C1C6D021000396AD3 /* SuperTestsScalarArithmetic.swift */, 75 | 221D1E5D1C6D021000396AD3 /* SuperTestsScalarComparable.swift */, 76 | 221D1E771C6D021400396AD3 /* Arithmetic */, 77 | 221D1E781C6D021A00396AD3 /* Operating */, 78 | 221D1E791C6D022500396AD3 /* Comparable */, 79 | ); 80 | path = Tests; 81 | sourceTree = ""; 82 | }; 83 | 221D1E771C6D021400396AD3 /* Arithmetic */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 221D1E5E1C6D021000396AD3 /* TestsCGFloatArithmeticTesting.swift */, 87 | 221D1E601C6D021000396AD3 /* TestsDoubleArithmeticTesting.swift */, 88 | 221D1E621C6D021000396AD3 /* TestsIntArithmeticTesting.swift */, 89 | ); 90 | name = Arithmetic; 91 | sourceTree = ""; 92 | }; 93 | 221D1E781C6D021A00396AD3 /* Operating */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 221D1E641C6D021000396AD3 /* TestsMathFunctions.swift */, 97 | ); 98 | name = Operating; 99 | sourceTree = ""; 100 | }; 101 | 221D1E791C6D022500396AD3 /* Comparable */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 221D1E5F1C6D021000396AD3 /* TestsCGFloatComparable.swift */, 105 | 221D1E611C6D021000396AD3 /* TestsDoubleComparable.swift */, 106 | 221D1E631C6D021000396AD3 /* TestsIntComparable.swift */, 107 | ); 108 | name = Comparable; 109 | sourceTree = ""; 110 | }; 111 | 223C4D5D1C6B709400E658E6 /* Tests64 */ = { 112 | isa = PBXGroup; 113 | children = ( 114 | 223C4D601C6B709400E658E6 /* Info.plist */, 115 | ); 116 | path = Tests64; 117 | sourceTree = ""; 118 | }; 119 | 223C4D7D1C6B715400E658E6 /* Tests32 */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 223C4D7E1C6B715400E658E6 /* Tests32.swift */, 123 | 223C4D801C6B715400E658E6 /* Info.plist */, 124 | ); 125 | path = Tests32; 126 | sourceTree = ""; 127 | }; 128 | 22AFC470195F9D02003572F3 = { 129 | isa = PBXGroup; 130 | children = ( 131 | 221D1E5B1C6D021000396AD3 /* Tests */, 132 | 223C4D8B1C6B7E9700E658E6 /* MyPlayground.playground */, 133 | 22AFC49E19603997003572F3 /* ScalarArithmetic */, 134 | 223C4D5D1C6B709400E658E6 /* Tests64 */, 135 | 223C4D7D1C6B715400E658E6 /* Tests32 */, 136 | 22AFC47A195F9D02003572F3 /* Products */, 137 | ); 138 | sourceTree = ""; 139 | }; 140 | 22AFC47A195F9D02003572F3 /* Products */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 223C4D5C1C6B709300E658E6 /* Tests64.xctest */, 144 | 223C4D7C1C6B715400E658E6 /* Tests32.xctest */, 145 | ); 146 | name = Products; 147 | sourceTree = ""; 148 | }; 149 | 22AFC49E19603997003572F3 /* ScalarArithmetic */ = { 150 | isa = PBXGroup; 151 | children = ( 152 | 22AFC49F19603997003572F3 /* ScalarArithmetic.swift */, 153 | 22F2324F1C6246D30086660A /* ScalarArithmeticExperimental.swift */, 154 | ); 155 | name = ScalarArithmetic; 156 | path = ../ScalarArithmetic; 157 | sourceTree = ""; 158 | }; 159 | /* End PBXGroup section */ 160 | 161 | /* Begin PBXNativeTarget section */ 162 | 223C4D5B1C6B709300E658E6 /* Tests64 */ = { 163 | isa = PBXNativeTarget; 164 | buildConfigurationList = 223C4D611C6B709400E658E6 /* Build configuration list for PBXNativeTarget "Tests64" */; 165 | buildPhases = ( 166 | 223C4D581C6B709300E658E6 /* Sources */, 167 | 223C4D591C6B709300E658E6 /* Frameworks */, 168 | 223C4D5A1C6B709300E658E6 /* Resources */, 169 | ); 170 | buildRules = ( 171 | ); 172 | dependencies = ( 173 | ); 174 | name = Tests64; 175 | productName = Tests64; 176 | productReference = 223C4D5C1C6B709300E658E6 /* Tests64.xctest */; 177 | productType = "com.apple.product-type.bundle.unit-test"; 178 | }; 179 | 223C4D7B1C6B715400E658E6 /* Tests32 */ = { 180 | isa = PBXNativeTarget; 181 | buildConfigurationList = 223C4D811C6B715400E658E6 /* Build configuration list for PBXNativeTarget "Tests32" */; 182 | buildPhases = ( 183 | 223C4D781C6B715400E658E6 /* Sources */, 184 | 223C4D791C6B715400E658E6 /* Frameworks */, 185 | 223C4D7A1C6B715400E658E6 /* Resources */, 186 | ); 187 | buildRules = ( 188 | ); 189 | dependencies = ( 190 | ); 191 | name = Tests32; 192 | productName = Tests32; 193 | productReference = 223C4D7C1C6B715400E658E6 /* Tests32.xctest */; 194 | productType = "com.apple.product-type.bundle.unit-test"; 195 | }; 196 | /* End PBXNativeTarget section */ 197 | 198 | /* Begin PBXProject section */ 199 | 22AFC471195F9D02003572F3 /* Project object */ = { 200 | isa = PBXProject; 201 | attributes = { 202 | LastSwiftUpdateCheck = 0720; 203 | LastUpgradeCheck = 0800; 204 | ORGANIZATIONNAME = "Seivan Heidari"; 205 | TargetAttributes = { 206 | 223C4D5B1C6B709300E658E6 = { 207 | CreatedOnToolsVersion = 7.2.1; 208 | LastSwiftMigration = 0800; 209 | }; 210 | 223C4D7B1C6B715400E658E6 = { 211 | CreatedOnToolsVersion = 7.2.1; 212 | LastSwiftMigration = 0800; 213 | }; 214 | }; 215 | }; 216 | buildConfigurationList = 22AFC474195F9D02003572F3 /* Build configuration list for PBXProject "TestsAndSample" */; 217 | compatibilityVersion = "Xcode 3.2"; 218 | developmentRegion = English; 219 | hasScannedForEncodings = 0; 220 | knownRegions = ( 221 | en, 222 | ); 223 | mainGroup = 22AFC470195F9D02003572F3; 224 | productRefGroup = 22AFC47A195F9D02003572F3 /* Products */; 225 | projectDirPath = ""; 226 | projectRoot = ""; 227 | targets = ( 228 | 223C4D5B1C6B709300E658E6 /* Tests64 */, 229 | 223C4D7B1C6B715400E658E6 /* Tests32 */, 230 | ); 231 | }; 232 | /* End PBXProject section */ 233 | 234 | /* Begin PBXResourcesBuildPhase section */ 235 | 223C4D5A1C6B709300E658E6 /* Resources */ = { 236 | isa = PBXResourcesBuildPhase; 237 | buildActionMask = 2147483647; 238 | files = ( 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | 223C4D7A1C6B715400E658E6 /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | ); 247 | runOnlyForDeploymentPostprocessing = 0; 248 | }; 249 | /* End PBXResourcesBuildPhase section */ 250 | 251 | /* Begin PBXSourcesBuildPhase section */ 252 | 223C4D581C6B709300E658E6 /* Sources */ = { 253 | isa = PBXSourcesBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | 221D1E711C6D021000396AD3 /* TestsIntArithmeticTesting.swift in Sources */, 257 | 221D1E651C6D021000396AD3 /* SuperTestsScalarArithmetic.swift in Sources */, 258 | 221D1E691C6D021000396AD3 /* TestsCGFloatArithmeticTesting.swift in Sources */, 259 | 221D1E6F1C6D021000396AD3 /* TestsDoubleComparable.swift in Sources */, 260 | 221D1E6B1C6D021000396AD3 /* TestsCGFloatComparable.swift in Sources */, 261 | 221D1E671C6D021000396AD3 /* SuperTestsScalarComparable.swift in Sources */, 262 | 221D1E731C6D021000396AD3 /* TestsIntComparable.swift in Sources */, 263 | 221D1E751C6D021000396AD3 /* TestsMathFunctions.swift in Sources */, 264 | 221D1E471C6C543800396AD3 /* ScalarArithmetic.swift in Sources */, 265 | 221D1E6D1C6D021000396AD3 /* TestsDoubleArithmeticTesting.swift in Sources */, 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | }; 269 | 223C4D781C6B715400E658E6 /* Sources */ = { 270 | isa = PBXSourcesBuildPhase; 271 | buildActionMask = 2147483647; 272 | files = ( 273 | 221D1E6C1C6D021000396AD3 /* TestsCGFloatComparable.swift in Sources */, 274 | 223C4D7F1C6B715400E658E6 /* Tests32.swift in Sources */, 275 | 221D1E701C6D021000396AD3 /* TestsDoubleComparable.swift in Sources */, 276 | 221D1E661C6D021000396AD3 /* SuperTestsScalarArithmetic.swift in Sources */, 277 | 221D1E721C6D021000396AD3 /* TestsIntArithmeticTesting.swift in Sources */, 278 | 221D1E6E1C6D021000396AD3 /* TestsDoubleArithmeticTesting.swift in Sources */, 279 | 221D1E6A1C6D021000396AD3 /* TestsCGFloatArithmeticTesting.swift in Sources */, 280 | 221D1E681C6D021000396AD3 /* SuperTestsScalarComparable.swift in Sources */, 281 | 221D1E761C6D021000396AD3 /* TestsMathFunctions.swift in Sources */, 282 | 221D1E501C6CE41800396AD3 /* ScalarArithmetic.swift in Sources */, 283 | 221D1E741C6D021000396AD3 /* TestsIntComparable.swift in Sources */, 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | /* End PBXSourcesBuildPhase section */ 288 | 289 | /* Begin XCBuildConfiguration section */ 290 | 223C4D621C6B709400E658E6 /* Debug */ = { 291 | isa = XCBuildConfiguration; 292 | buildSettings = { 293 | CLANG_ENABLE_MODULES = YES; 294 | CODE_SIGN_IDENTITY = "-"; 295 | COMBINE_HIDPI_IMAGES = YES; 296 | DEBUG_INFORMATION_FORMAT = dwarf; 297 | GCC_NO_COMMON_BLOCKS = YES; 298 | INFOPLIST_FILE = Tests64/Info.plist; 299 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 300 | MACOSX_DEPLOYMENT_TARGET = 10.10; 301 | MTL_ENABLE_DEBUG_INFO = YES; 302 | PRODUCT_BUNDLE_IDENTIFIER = com.seivanheidari.Tests64; 303 | PRODUCT_NAME = "$(TARGET_NAME)"; 304 | SDKROOT = macosx; 305 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 306 | SWIFT_VERSION = 2.3; 307 | }; 308 | name = Debug; 309 | }; 310 | 223C4D631C6B709400E658E6 /* Release */ = { 311 | isa = XCBuildConfiguration; 312 | buildSettings = { 313 | CLANG_ENABLE_MODULES = YES; 314 | CODE_SIGN_IDENTITY = "-"; 315 | COMBINE_HIDPI_IMAGES = YES; 316 | COPY_PHASE_STRIP = NO; 317 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 318 | GCC_NO_COMMON_BLOCKS = YES; 319 | INFOPLIST_FILE = Tests64/Info.plist; 320 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 321 | MACOSX_DEPLOYMENT_TARGET = 10.10; 322 | MTL_ENABLE_DEBUG_INFO = NO; 323 | PRODUCT_BUNDLE_IDENTIFIER = com.seivanheidari.Tests64; 324 | PRODUCT_NAME = "$(TARGET_NAME)"; 325 | SDKROOT = macosx; 326 | SWIFT_VERSION = 2.3; 327 | }; 328 | name = Release; 329 | }; 330 | 223C4D821C6B715400E658E6 /* Debug */ = { 331 | isa = XCBuildConfiguration; 332 | buildSettings = { 333 | CODE_SIGN_IDENTITY = "-"; 334 | COMBINE_HIDPI_IMAGES = YES; 335 | DEBUG_INFORMATION_FORMAT = dwarf; 336 | GCC_NO_COMMON_BLOCKS = YES; 337 | INFOPLIST_FILE = Tests32/Info.plist; 338 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 339 | MACOSX_DEPLOYMENT_TARGET = 10.10; 340 | MTL_ENABLE_DEBUG_INFO = YES; 341 | PRODUCT_BUNDLE_IDENTIFIER = com.seivanheidari.Tests32; 342 | PRODUCT_NAME = "$(TARGET_NAME)"; 343 | SDKROOT = macosx; 344 | SWIFT_VERSION = 2.3; 345 | VALID_ARCHS = x86_64; 346 | }; 347 | name = Debug; 348 | }; 349 | 223C4D831C6B715400E658E6 /* Release */ = { 350 | isa = XCBuildConfiguration; 351 | buildSettings = { 352 | CODE_SIGN_IDENTITY = "-"; 353 | COMBINE_HIDPI_IMAGES = YES; 354 | COPY_PHASE_STRIP = NO; 355 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 356 | GCC_NO_COMMON_BLOCKS = YES; 357 | INFOPLIST_FILE = Tests32/Info.plist; 358 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 359 | MACOSX_DEPLOYMENT_TARGET = 10.10; 360 | MTL_ENABLE_DEBUG_INFO = NO; 361 | PRODUCT_BUNDLE_IDENTIFIER = com.seivanheidari.Tests32; 362 | PRODUCT_NAME = "$(TARGET_NAME)"; 363 | SDKROOT = macosx; 364 | SWIFT_VERSION = 2.3; 365 | VALID_ARCHS = x86_64; 366 | }; 367 | name = Release; 368 | }; 369 | 22AFC48E195F9D02003572F3 /* Debug */ = { 370 | isa = XCBuildConfiguration; 371 | buildSettings = { 372 | ALWAYS_SEARCH_USER_PATHS = NO; 373 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 374 | CLANG_CXX_LIBRARY = "libc++"; 375 | CLANG_ENABLE_MODULES = YES; 376 | CLANG_ENABLE_OBJC_ARC = YES; 377 | CLANG_WARN_BOOL_CONVERSION = YES; 378 | CLANG_WARN_CONSTANT_CONVERSION = YES; 379 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 380 | CLANG_WARN_EMPTY_BODY = YES; 381 | CLANG_WARN_ENUM_CONVERSION = YES; 382 | CLANG_WARN_INFINITE_RECURSION = YES; 383 | CLANG_WARN_INT_CONVERSION = YES; 384 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 385 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 386 | CLANG_WARN_UNREACHABLE_CODE = YES; 387 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 388 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 389 | COPY_PHASE_STRIP = NO; 390 | ENABLE_STRICT_OBJC_MSGSEND = YES; 391 | ENABLE_TESTABILITY = YES; 392 | GCC_C_LANGUAGE_STANDARD = gnu99; 393 | GCC_DYNAMIC_NO_PIC = NO; 394 | GCC_NO_COMMON_BLOCKS = YES; 395 | GCC_OPTIMIZATION_LEVEL = 0; 396 | GCC_PREPROCESSOR_DEFINITIONS = ( 397 | "DEBUG=1", 398 | "$(inherited)", 399 | ); 400 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 401 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 402 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 403 | GCC_WARN_UNDECLARED_SELECTOR = YES; 404 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 405 | GCC_WARN_UNUSED_FUNCTION = YES; 406 | GCC_WARN_UNUSED_VARIABLE = YES; 407 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 408 | METAL_ENABLE_DEBUG_INFO = YES; 409 | ONLY_ACTIVE_ARCH = YES; 410 | SDKROOT = iphoneos; 411 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 412 | TARGETED_DEVICE_FAMILY = "1,2"; 413 | }; 414 | name = Debug; 415 | }; 416 | 22AFC48F195F9D02003572F3 /* Release */ = { 417 | isa = XCBuildConfiguration; 418 | buildSettings = { 419 | ALWAYS_SEARCH_USER_PATHS = NO; 420 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 421 | CLANG_CXX_LIBRARY = "libc++"; 422 | CLANG_ENABLE_MODULES = YES; 423 | CLANG_ENABLE_OBJC_ARC = YES; 424 | CLANG_WARN_BOOL_CONVERSION = YES; 425 | CLANG_WARN_CONSTANT_CONVERSION = YES; 426 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 427 | CLANG_WARN_EMPTY_BODY = YES; 428 | CLANG_WARN_ENUM_CONVERSION = YES; 429 | CLANG_WARN_INFINITE_RECURSION = YES; 430 | CLANG_WARN_INT_CONVERSION = YES; 431 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 432 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 433 | CLANG_WARN_UNREACHABLE_CODE = YES; 434 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 435 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 436 | COPY_PHASE_STRIP = YES; 437 | ENABLE_NS_ASSERTIONS = NO; 438 | ENABLE_STRICT_OBJC_MSGSEND = YES; 439 | GCC_C_LANGUAGE_STANDARD = gnu99; 440 | GCC_NO_COMMON_BLOCKS = YES; 441 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 442 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 443 | GCC_WARN_UNDECLARED_SELECTOR = YES; 444 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 445 | GCC_WARN_UNUSED_FUNCTION = YES; 446 | GCC_WARN_UNUSED_VARIABLE = YES; 447 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 448 | METAL_ENABLE_DEBUG_INFO = NO; 449 | SDKROOT = iphoneos; 450 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 451 | TARGETED_DEVICE_FAMILY = "1,2"; 452 | VALIDATE_PRODUCT = YES; 453 | }; 454 | name = Release; 455 | }; 456 | /* End XCBuildConfiguration section */ 457 | 458 | /* Begin XCConfigurationList section */ 459 | 223C4D611C6B709400E658E6 /* Build configuration list for PBXNativeTarget "Tests64" */ = { 460 | isa = XCConfigurationList; 461 | buildConfigurations = ( 462 | 223C4D621C6B709400E658E6 /* Debug */, 463 | 223C4D631C6B709400E658E6 /* Release */, 464 | ); 465 | defaultConfigurationIsVisible = 0; 466 | defaultConfigurationName = Release; 467 | }; 468 | 223C4D811C6B715400E658E6 /* Build configuration list for PBXNativeTarget "Tests32" */ = { 469 | isa = XCConfigurationList; 470 | buildConfigurations = ( 471 | 223C4D821C6B715400E658E6 /* Debug */, 472 | 223C4D831C6B715400E658E6 /* Release */, 473 | ); 474 | defaultConfigurationIsVisible = 0; 475 | defaultConfigurationName = Release; 476 | }; 477 | 22AFC474195F9D02003572F3 /* Build configuration list for PBXProject "TestsAndSample" */ = { 478 | isa = XCConfigurationList; 479 | buildConfigurations = ( 480 | 22AFC48E195F9D02003572F3 /* Debug */, 481 | 22AFC48F195F9D02003572F3 /* Release */, 482 | ); 483 | defaultConfigurationIsVisible = 0; 484 | defaultConfigurationName = Release; 485 | }; 486 | /* End XCConfigurationList section */ 487 | }; 488 | rootObject = 22AFC471195F9D02003572F3 /* Project object */; 489 | } 490 | -------------------------------------------------------------------------------- /TestsAndSample/TestsAndSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TestsAndSample/TestsAndSample.xcodeproj/project.xcworkspace/xcshareddata/TestsAndSample.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 3278BC64-4F30-43BB-B073-6A6A4038E096 9 | IDESourceControlProjectName 10 | TestsAndSample 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 52F35589-E053-4D9B-871C-7E7CAC859E0B 14 | ssh://github.com/seivan/ScalarArithmetic.git 15 | 16 | IDESourceControlProjectPath 17 | TestsAndSample/TestsAndSample.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 52F35589-E053-4D9B-871C-7E7CAC859E0B 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://github.com/seivan/ScalarArithmetic.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | 52F35589-E053-4D9B-871C-7E7CAC859E0B 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 52F35589-E053-4D9B-871C-7E7CAC859E0B 36 | IDESourceControlWCCName 37 | ScalarArithmetic 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /TestsAndSample/TestsAndSample.xcodeproj/project.xcworkspace/xcuserdata/seivan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seivan-archives/ScalarArithmetic/4604471f9ee50b9156023c8e81bdaea6fb8e1f28/TestsAndSample/TestsAndSample.xcodeproj/project.xcworkspace/xcuserdata/seivan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /TestsAndSample/TestsAndSample.xcodeproj/xcshareddata/xcschemes/Tests32.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 14 | 15 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 39 | 40 | 41 | 42 | 48 | 49 | 51 | 52 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /TestsAndSample/TestsAndSample.xcodeproj/xcshareddata/xcschemes/Tests64.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 14 | 15 | 17 | 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 44 | 45 | 46 | 47 | 53 | 54 | 56 | 57 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /TestsAndSample/TestsAndSample.xcodeproj/xcuserdata/seivan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SuppressBuildableAutocreation 6 | 7 | 223C4D5B1C6B709300E658E6 8 | 9 | primary 10 | 11 | 12 | 223C4D7B1C6B715400E658E6 13 | 14 | primary 15 | 16 | 17 | 18 | 19 | 20 | --------------------------------------------------------------------------------