Skip to content

Commit

Permalink
Swift 5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderTar committed Apr 6, 2019
1 parent d38072a commit 2ee7a7a
Show file tree
Hide file tree
Showing 19 changed files with 1,629 additions and 1,565 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
osx_image: xcode10.1
osx_image: xcode10.2
language: objective-c
cache: cocoapods
podfile: Example/Podfile
Expand Down
137 changes: 95 additions & 42 deletions Example/LASwift.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use_frameworks!
target 'LASwift-Tests' do
pod 'LASwift', :path => '../'

pod 'Quick', '~> 1.3.2'
pod 'Nimble', '~> 7.3.1'
pod 'Quick', '~> 2.0.0'
pod 'Nimble', '~> 8.0.1'

platform :osx, '10.10'
end
Expand Down
4 changes: 2 additions & 2 deletions Example/Pods/Local Podspecs/LASwift.podspec.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2,965 changes: 1,482 additions & 1,483 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Example/Pods/Target Support Files/Nimble/Nimble-Info.plist

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Example/Pods/Target Support Files/Quick/Quick-Info.plist

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 30 additions & 21 deletions Example/Tests/MatrixTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,13 @@ class MatrixSpec: QuickSpec {
let m1 = Matrix([[1.0, 2.0], [3.0, 4.0]])
let res = Matrix([[1.0, 4.0], [9.0, 16.0]])
expect(square(m1)) == res
expect(square(m1)) == m1 .^ 2
expect(m1 .^ 2.0) == res
}
it("sqrt") {
let m1 = Matrix([[1.0, 2.0], [3.0, 4.0]])
let res = Matrix([[sqrt(1.0), sqrt(2.0)], [sqrt(3.0), sqrt(4.0)]])
expect(sqrt(m1)) == res
expect(sqrt(m1)) == m1 .^ 0.5
expect(m1 .^ 0.5) == res
}
it("exp") {
let m1 = Matrix([[1.0, 2.0], [3.0, 4.0]])
Expand Down Expand Up @@ -536,8 +536,12 @@ class MatrixSpec: QuickSpec {
expect(mpower(m1, -1)) == res
expect(m1 ^ -1) == res
let m2 = Matrix([[1.0, 0.0, 2.0], [-1.0, 5.0, 0.0]])
expect { () -> Void in _ = inv(m2) }.to(throwAssertion())
expect { () -> Void in _ = inv(ones(3, 3)) }.to(throwAssertion())

#if !SWIFT_PACKAGE
expect { () -> Void in _ = inv(m2) }.to(throwAssertion())
expect { () -> Void in _ = inv(ones(3, 3)) }.to(throwAssertion())
#endif

expect(inv(m1) * m1) == eye(3, 3)
}
it("eigen") {
Expand All @@ -549,7 +553,10 @@ class MatrixSpec: QuickSpec {
expect(m1 * e1.V) == e1.V * e1.D
let m2 = Matrix([[1.0, 0.0, 2.0],
[-1.0, 5.0, 0.0]])
expect { () -> Void in _ = eig(m2) }.to(throwAssertion())

#if !SWIFT_PACKAGE
expect { () -> Void in _ = eig(m2) }.to(throwAssertion())
#endif
let m3 = Matrix([[0, 1],
[-2, -3]])
let e2 = eig(m3)
Expand Down Expand Up @@ -750,22 +757,24 @@ class MatrixSpec: QuickSpec {
expect(m1 ?? (.All, .Pos([2, 1]))) == res4
expect(m1 ?? (.PosCyc([-7, 80]), .Range(4, -2, 0))) == res5
expect(m1 ?? (.Range(3, -2, 0), .PosCyc([-7, 80]))) == res6
expect { () -> Void in _ = m1 ?? (.Range(4, -2, 0), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Range(3, -2, -1), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Range(5, -2, 0)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Range(3, -2, -1)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Range(0, -2, 4), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Range(-1, -2, 3), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Range(0, -2, 5)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Range(-1, -2, 3)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Take(5), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Take(-1), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Take(6)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Take(-1)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Drop(5), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Drop(-1), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Drop(6)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Drop(-1)) }.to(throwAssertion())
#if !SWIFT_PACKAGE
expect { () -> Void in _ = m1 ?? (.Range(4, -2, 0), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Range(3, -2, -1), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Range(5, -2, 0)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Range(3, -2, -1)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Range(0, -2, 4), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Range(-1, -2, 3), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Range(0, -2, 5)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Range(-1, -2, 3)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Take(5), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Take(-1), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Take(6)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Take(-1)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Drop(5), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.Drop(-1), .All) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Drop(6)) }.to(throwAssertion())
expect { () -> Void in _ = m1 ?? (.All, .Drop(-1)) }.to(throwAssertion())
#endif
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import PackageDescription
let package = Package(
name: "LASwift",
products: [
.library(name: "LASwift", targets: ["LASwift"])
.library(name: "LASwift", targets: ["LASwift"])
],
dependencies: [
.package(url: "https://github.com/Quick/Quick.git", from: "1.2.0"),
.package(url: "https://github.com/Quick/Nimble.git", from: "7.0.3")
.package(url: "https://github.com/Quick/Quick.git", from: "2.0.0"),
.package(url: "https://github.com/Quick/Nimble.git", from: "8.0.1")
],
targets: [
.target(
Expand Down
1 change: 0 additions & 1 deletion Sources/Operators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
infix operator .* : MultiplicationPrecedence
infix operator ./ : MultiplicationPrecedence
infix operator ./. : MultiplicationPrecedence
infix operator .^ : MultiplicationPrecedence

postfix operator

Expand Down

0 comments on commit 2ee7a7a

Please sign in to comment.