diff --git a/.travis.yml b/.travis.yml index 1eba40123..c2ac363d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,9 @@ install: script: # - xcodebuild test -project ./All-Pairs\ Shortest\ Paths/APSP/APSP.xcodeproj -scheme APSPTests - - xcodebuild test -project ./Array2D/Tests/Tests.xcodeproj -scheme Tests - - xcodebuild test -project ./AVL\ Tree/Tests/Tests.xcodeproj -scheme Tests - - xcodebuild test -project ./Binary\ Search/Tests/Tests.xcodeproj -scheme Tests +- xcodebuild test -project ./Array2D/Tests/Tests.xcodeproj -scheme Tests +- xcodebuild test -project ./AVL\ Tree/Tests/Tests.xcodeproj -scheme Tests +- xcodebuild test -project ./Binary\ Search/Tests/Tests.xcodeproj -scheme Tests # - xcodebuild test -project ./Binary\ Search\ Tree/Solution\ 1/Tests/Tests.xcodeproj -scheme Tests # - xcodebuild test -project ./Bloom\ Filter/Tests/Tests.xcodeproj -scheme Tests # - xcodebuild test -project ./Bounded\ Priority\ Queue/Tests/Tests.xcodeproj -scheme Tests @@ -29,7 +29,7 @@ script: # - xcodebuild test -project ./Longest\ Common\ Subsequence/Tests/Tests.xcodeproj -scheme Tests # - xcodebuild test -project ./Minimum\ Spanning\ Tree\ \(Unweighted\)/Tests/Tests.xcodeproj -scheme Tests # - xcodebuild test -project ./Priority\ Queue/Tests/Tests.xcodeproj -scheme Tests -# - xcodebuild test -project ./Queue/Tests/Tests.xcodeproj -scheme Tests + - xcodebuild test -project ./Queue/Tests/Tests.xcodeproj -scheme Tests # - xcodebuild test -project ./Quicksort/Tests/Tests.xcodeproj -scheme Tests # - xcodebuild test -project ./Run-Length\ Encoding/Tests/Tests.xcodeproj -scheme Tests # - xcodebuild test -project ./Select\ Minimum\ Maximum/Tests/Tests.xcodeproj -scheme Tests @@ -37,5 +37,5 @@ script: # - xcodebuild test -project ./Shell\ Sort/Tests/Tests.xcodeproj -scheme Tests # - xcodebuild test -project ./Shortest\ Path\ \(Unweighted\)/Tests/Tests.xcodeproj -scheme Tests # - xcodebuild test -project ./Single-Source\ Shortest\ Paths\ \(Weighted\)/SSSP.xcodeproj -scheme SSSPTests -# - xcodebuild test -project ./Stack/Tests/Tests.xcodeproj -scheme Tests + - xcodebuild test -project ./Stack/Tests/Tests.xcodeproj -scheme Tests # - xcodebuild test -project ./Topological\ Sort/Tests/Tests.xcodeproj -scheme Tests diff --git a/Queue/Queue-Optimized.swift b/Queue/Queue-Optimized.swift index 5a9d04394..ad6999295 100644 --- a/Queue/Queue-Optimized.swift +++ b/Queue/Queue-Optimized.swift @@ -7,8 +7,8 @@ Enqueuing and dequeuing are O(1) operations. */ public struct Queue { - private var array = [T?]() - private var head = 0 + fileprivate var array = [T?]() + fileprivate var head = 0 public var isEmpty: Bool { return count == 0 @@ -18,7 +18,7 @@ public struct Queue { return array.count - head } - public mutating func enqueue(element: T) { + public mutating func enqueue(_ element: T) { array.append(element) } diff --git a/Queue/Queue-Simple.swift b/Queue/Queue-Simple.swift index 6d3c197ee..27fbdee4d 100644 --- a/Queue/Queue-Simple.swift +++ b/Queue/Queue-Simple.swift @@ -8,7 +8,7 @@ implemented with a linked list, then both would be O(1). */ public struct Queue { - private var array = [T]() + fileprivate var array = [T]() public var count: Int { return array.count @@ -18,7 +18,7 @@ public struct Queue { return array.isEmpty } - public mutating func enqueue(element: T) { + public mutating func enqueue(_ element: T) { array.append(element) } diff --git a/Queue/Queue.playground/Contents.swift b/Queue/Queue.playground/Contents.swift index 0c48afd5b..6b771ccd1 100644 --- a/Queue/Queue.playground/Contents.swift +++ b/Queue/Queue.playground/Contents.swift @@ -12,7 +12,7 @@ */ public struct Queue { - private var array = [T]() + fileprivate var array = [T]() public var isEmpty: Bool { return array.isEmpty @@ -22,7 +22,7 @@ public struct Queue { return array.count } - public mutating func enqueue(element: T) { + public mutating func enqueue(_ element: T) { array.append(element) } diff --git a/Queue/README.markdown b/Queue/README.markdown index 92118d37b..f7779aa69 100644 --- a/Queue/README.markdown +++ b/Queue/README.markdown @@ -46,7 +46,7 @@ Here is a very simplistic implementation of a queue in Swift. It's just a wrappe ```swift public struct Queue { - private var array = [T]() + fileprivate var array = [T]() public var isEmpty: Bool { return array.isEmpty @@ -56,7 +56,7 @@ public struct Queue { return array.count } - public mutating func enqueue(element: T) { + public mutating func enqueue(_ element: T) { array.append(element) } @@ -136,8 +136,8 @@ Here is how you could implement this version of `Queue`: ```swift public struct Queue { - private var array = [T?]() - private var head = 0 + fileprivate var array = [T?]() + fileprivate var head = 0 public var isEmpty: Bool { return count == 0 @@ -147,7 +147,7 @@ public struct Queue { return array.count - head } - public mutating func enqueue(element: T) { + public mutating func enqueue(_ element: T) { array.append(element) } diff --git a/Queue/Tests/Tests.xcodeproj/project.pbxproj b/Queue/Tests/Tests.xcodeproj/project.pbxproj index ac23063a5..a554fd16e 100644 --- a/Queue/Tests/Tests.xcodeproj/project.pbxproj +++ b/Queue/Tests/Tests.xcodeproj/project.pbxproj @@ -83,11 +83,12 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0720; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "Swift Algorithm Club"; TargetAttributes = { 7B2BBC7F1C779D720067B71D = { CreatedOnToolsVersion = 7.2; + LastSwiftMigration = 0800; }; }; }; @@ -145,8 +146,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "-"; @@ -189,8 +192,10 @@ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "-"; @@ -209,6 +214,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.11; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; @@ -220,6 +226,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = swift.algorithm.club.Tests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -231,6 +238,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = swift.algorithm.club.Tests; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 3.0; }; name = Release; }; diff --git a/Queue/Tests/Tests.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme b/Queue/Tests/Tests.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme index 8ef8d8581..14f27f777 100644 --- a/Queue/Tests/Tests.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme +++ b/Queue/Tests/Tests.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme @@ -1,6 +1,6 @@