diff --git a/.travis.yml b/.travis.yml index 9a4806998..3a2bcb7b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,3 +22,4 @@ script: - xcodebuild test -project ./Selection\ Sort/Tests/Tests.xcodeproj -scheme Tests - xcodebuild test -project ./Shell\ Sort/Tests/Tests.xcodeproj -scheme Tests - xcodebuild test -project ./Stack/Tests/Tests.xcodeproj -scheme Tests +- xcodebuild test -project ./Longest\ Common\ Subsequence/Tests/Tests.xcodeproj -scheme Tests diff --git a/Longest Common Subsequence/LongestCommonSubsequence.playground/Contents.swift b/Longest Common Subsequence/LongestCommonSubsequence.playground/Contents.swift new file mode 100644 index 000000000..8f49b45fb --- /dev/null +++ b/Longest Common Subsequence/LongestCommonSubsequence.playground/Contents.swift @@ -0,0 +1,62 @@ +extension String { + func longestCommonSubsequence(other:String) -> String { + + func lcsLength(other: String) -> [[Int]] { + var matrix = [[Int]](count:self.characters.count+1, repeatedValue:[Int](count:other.characters.count+1, repeatedValue:0)) + + for (i, selfChar) in self.characters.enumerate() { + for (j, otherChar) in other.characters.enumerate() { + if (otherChar == selfChar) { + matrix[i+1][j+1] = (matrix[i][j]) + 1 + } + else { + matrix[i+1][j+1] = max(matrix[i][j+1], matrix[i+1][j]) + } + } + } + + return matrix; + } + + func backtrack(matrix: [[Int]]) -> String { + var i = self.characters.count + var j = other.characters.count + var charInSequence = self.endIndex + + var lcs = String() + + while (i>= 1 && j>= 1) { + if (matrix[i][j] == matrix[i][j - 1]) { + j = j - 1 + } + else if (matrix[i][j] == matrix[i - 1][j]) { + i = i - 1 + charInSequence = charInSequence.predecessor() + } + else { + i = i - 1 + j = j - 1 + charInSequence = charInSequence.predecessor() + + lcs.append(self[charInSequence]) + } + } + + return String(lcs.characters.reverse()); + } + + return backtrack(lcsLength(other)) + } +} + +// Examples + +let a = "ABCBX" +let b = "ABDCAB" +let c = "KLMK" + +a.longestCommonSubsequence(c) //"" +a.longestCommonSubsequence("") //"" +a.longestCommonSubsequence(b) //"ABCB" +b.longestCommonSubsequence(a) //"ABCB" +a.longestCommonSubsequence(a) // "ABCBX" diff --git a/Longest Common Subsequence/LongestCommonSubsequence.playground/contents.xcplayground b/Longest Common Subsequence/LongestCommonSubsequence.playground/contents.xcplayground new file mode 100644 index 000000000..5da2641c9 --- /dev/null +++ b/Longest Common Subsequence/LongestCommonSubsequence.playground/contents.xcplayground @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Longest Common Subsequence/LongestCommonSubsequence.playground/timeline.xctimeline b/Longest Common Subsequence/LongestCommonSubsequence.playground/timeline.xctimeline new file mode 100644 index 000000000..bf468afec --- /dev/null +++ b/Longest Common Subsequence/LongestCommonSubsequence.playground/timeline.xctimeline @@ -0,0 +1,6 @@ + + + + + diff --git a/Longest Common Subsequence/LongestCommonSubsequence.swift b/Longest Common Subsequence/LongestCommonSubsequence.swift new file mode 100644 index 000000000..a6225bb74 --- /dev/null +++ b/Longest Common Subsequence/LongestCommonSubsequence.swift @@ -0,0 +1,68 @@ +extension String { + func longestCommonSubsequence(other:String) -> String { + + // Computes the length of the lcs using dynamic programming + // Output is a matrix of size (n+1)x(m+1), where matrix[x][y] indicates the length + // of lcs between substring (0, x-1) of self and substring (0, y-1) of other. + func lcsLength(other: String) -> [[Int]] { + + //Matrix of size (n+1)x(m+1), algorithm needs first row and first column to be filled with 0 + var matrix = [[Int]](count:self.characters.count+1, repeatedValue:[Int](count:other.characters.count+1, repeatedValue:0)) + + for (i, selfChar) in self.characters.enumerate() { + for (j, otherChar) in other.characters.enumerate() { + if (otherChar == selfChar) { + //Common char found, add 1 to highest lcs found so far + matrix[i+1][j+1] = (matrix[i][j]) + 1 + } + else { + //Not a match, propagates highest lcs length found so far + matrix[i+1][j+1] = max(matrix[i][j+1], matrix[i+1][j]) + } + } + } + + //Due to propagation, lcs length is at matrix[n][m] + return matrix; + } + + //Backtracks from matrix[n][m] to matrix[1][1] looking for chars that are common to both strings + func backtrack(matrix: [[Int]]) -> String { + var i = self.characters.count + var j = other.characters.count + + //charInSequence is in sync with i so we can get self[i] + var charInSequence = self.endIndex + + var lcs = String() + + while (i>= 1 && j>= 1) { + //Indicates propagation without change, i.e. no new char was added to lcs + if (matrix[i][j] == matrix[i][j - 1]) { + j = j - 1 + } + //Indicates propagation without change, i.e. no new char was added to lcs + else if (matrix[i][j] == matrix[i - 1][j]) { + i = i - 1 + //As i was subtracted, move back charInSequence + charInSequence = charInSequence.predecessor() + } + //Value on the left and above are different than current cell. This means 1 was added to lcs length (line 16) + else { + i = i - 1 + j = j - 1 + charInSequence = charInSequence.predecessor() + + lcs.append(self[charInSequence]) + } + } + + //Due to backtrack, chars were added in reverse order: reverse it back. + //Append and reverse is faster than inserting at index 0 + return String(lcs.characters.reverse()); + } + + //Combine dynamic programming approach with backtrack to find the lcs + return backtrack(lcsLength(other)) + } +} \ No newline at end of file diff --git a/Longest Common Subsequence/README.markdown b/Longest Common Subsequence/README.markdown new file mode 100644 index 000000000..719135a54 --- /dev/null +++ b/Longest Common Subsequence/README.markdown @@ -0,0 +1,211 @@ +# Longest Common Subsequence + + +The Longest Common Subsequence (LCS) of two strings is the longest sequence of characters that appear in the same order in both strings. Should not be confused with the Longest Common Substring problem, where characters **must** be a substring of both strings (i.e they have to be immediate neighbours). + +One way to find what's the LCS of two strings `a` and `b` is using Dynamic Programming and a backtracking strategy. During the explanation, remember that `n` is the length of `a` and `m` the length of `b`. + +## Length of LCS - Dynamic Programming + +Dynamic programming is used to determine the length of LCS between all combinations of substrings of `a` and `b`. + + +```swift + // Computes the length of the lcs using dynamic programming + // Output is a matrix of size (n+1)x(m+1), where matrix[x][y] indicates the length + // of lcs between substring (0, x-1) of self and substring (0, y-1) of other. + func lcsLength(other: String) -> [[Int]] { + + //Matrix of size (n+1)x(m+1), algorithm needs first row and first line to be filled with 0 + var matrix = [[Int]](count:self.characters.count+1, repeatedValue:[Int](count:other.characters.count+1, repeatedValue:0)) + + for (i, selfChar) in self.characters.enumerate() { + for (j, otherChar) in other.characters.enumerate() { + if (otherChar == selfChar) { + //Common char found, add 1 to highest lcs found so far + matrix[i+1][j+1] = (matrix[i][j]) + 1 + } + else { + //Not a match, propagates highest lcs length found so far + matrix[i+1][j+1] = max(matrix[i][j+1], matrix[i+1][j]) + } + } + } + + //Due to propagation, lcs length is at matrix[n][m] + return matrix; + } +``` + +Given strings `"ABCBX"` and `"ABDCAB"` the output matrix of `lcsLength` is the following: + +*First row and column added for easier understanding, actual matrix starts on zeros* + +``` +| | Ø | A | B | D | C | A | B | +| Ø | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| A | 0 | 1 | 1 | 1 | 1 | 1 | 1 | +| B | 0 | 1 | 2 | 2 | 2 | 2 | 2 | +| C | 0 | 1 | 2 | 2 | 3 | 3 | 3 | +| B | 0 | 1 | 2 | 2 | 3 | 3 | 4 | +| X | 0 | 1 | 2 | 2 | 3 | 3 | 4 | +``` + +The content of the matrix indicates that position `(i, j)` contains the length of the LCS between substring `(0, i - 1)` of `a` and substring `(0, j - 1)` of `b`. + +Example: `(2, 3)` says that the LCS for `"AB"` and `"ABD"` is 2 + + +## Actual LCS - Backtrack + +Having the length of every combination makes it possible to determine *which* characters are part of the LCS itself by using a backtracking strategy. + +Backtrack starts at matrix[n + 1][m + 1] and *walks* up and left (in this priority) looking for changes that do not indicate a simple propagation. If the number on the left and above are different than the number in the current cell, no propagation happened, it means that `(i, j)` indicates a common char between `a` and `b`, so char at `a[i - 1]` and `b[j - 1]` are part of the LCS and should be stored in the returned value (`self[i - 1]` was used in the code but could be `other[j - 1]`). + +``` +| | Ø| A| B| D| C| A| B| +| Ø | 0| 0| 0| 0| 0| 0| 0| +| A | 0|↖ 1| 1| 1| 1| 1| 1| +| B | 0| 1|↖ 2|← 2| 2| 2| 2| +| C | 0| 1| 2| 2|↖ 3|← 3| 3| +| B | 0| 1| 2| 2| 3| 3|↖ 4| +| X | 0| 1| 2| 2| 3| 3|↑ 4| +``` +Each `↖` move indicates a character (in row/column header) that is part of the LCS. + +One thing to notice is, as it's running backwards, the LCS is built in reverse order. Before returning, the result is reversed to reflect the actual LCS. + + + +```swift + //Backtracks from matrix[n][m] to matrix[1][1] looking for chars that are common to both strings + func backtrack(matrix: [[Int]]) -> String { + var i = self.characters.count + var j = other.characters.count + + //charInSequence is in sync with i so we can get self[i] + var charInSequence = self.endIndex + + var lcs = String() + + while (i>= 1 && j>= 1) { + //Indicates propagation without change, i.e. no new char was added to lcs + if (matrix[i][j] == matrix[i][j - 1]) { + j = j - 1 + } + //Indicates propagation without change, i.e. no new char was added to lcs + else if (matrix[i][j] == matrix[i - 1][j]) { + i = i - 1 + //As i was subtracted, move back charInSequence + charInSequence = charInSequence.predecessor() + } + //Value on the left and above are different than current cell. This means 1 was added to lcs length (line 16) + else { + i = i - 1 + j = j - 1 + charInSequence = charInSequence.predecessor() + + lcs.append(self[charInSequence]) + } + } + + //Due to backtrack, chars were added in reverse order: reverse it back. + //Append and reverse is faster than inserting at index 0 + return String(lcs.characters.reverse()); + } + +``` + + + + +## Putting it all together + + +```swift +extension String { + func longestCommonSubsequence(other:String) -> String { + + // Computes the same of the lcs using dynamic programming + // Output is a matrix of size (n+1)x(m+1), where matrix[x][y] indicates the length + // of lcs between substring (0, x-1) of self and substring (0, y-1) of other. + func lcsLength(other: String) -> [[Int]] { + + //Matrix of size (n+1)x(m+1), algorithm needs first row and first line to be filled with 0 + var matrix = [[Int]](count:self.characters.count+1, repeatedValue:[Int](count:other.characters.count+1, repeatedValue:0)) + + for (i, selfChar) in self.characters.enumerate() { + for (j, otherChar) in other.characters.enumerate() { + if (otherChar == selfChar) { + //Common char found, add 1 to highest lcs found so far + matrix[i+1][j+1] = (matrix[i][j]) + 1 + } + else { + //Not a match, propagates highest lcs length found so far + matrix[i+1][j+1] = max(matrix[i][j+1], matrix[i+1][j]) + } + } + } + + //Due to propagation, lcs length is at matrix[n][m] + return matrix; + } + + //Backtracks from matrix[n][m] to matrix[1][1] looking for chars that are common to both strings + func backtrack(matrix: [[Int]]) -> String { + var i = self.characters.count + var j = other.characters.count + + //charInSequence is in sync with i so we can get self[i] + var charInSequence = self.endIndex + + var lcs = String() + + while (i>= 1 && j>= 1) { + //Indicates propagation without change, i.e. no new char was added to lcs + if (matrix[i][j] == matrix[i][j - 1]) { + j = j - 1 + } + //Indicates propagation without change, i.e. no new char was added to lcs + else if (matrix[i][j] == matrix[i - 1][j]) { + i = i - 1 + //As i was subtracted, move back charInSequence + charInSequence = charInSequence.predecessor() + } + //Value on the left and above are different than current cell. This means 1 was added to lcs length (line 16) + else { + i = i - 1 + j = j - 1 + charInSequence = charInSequence.predecessor() + + lcs.append(self[charInSequence]) + } + } + + //Due to backtrack, chars were added in reverse order: reverse it back. + //Append and reverse is faster than inserting at index 0 + return String(lcs.characters.reverse()); + } + + //Combine dynamic programming approach with backtrack to find the lcs + return backtrack(lcsLength(other)) + } +} +``` + +**Examples:** + +```swift +let a = "ABCBX" +let b = "ABDCAB" +let c = "KLMK" + +a.longestCommonSubsequence(c) //"" +a.longestCommonSubsequence("") //"" +a.longestCommonSubsequence(b) //"ABCB" +b.longestCommonSubsequence(a) //"ABCB" +a.longestCommonSubsequence(a) // "ABCBX" +``` + + +*Written for Swift Algorithm Club by Pedro Vereza* \ No newline at end of file diff --git a/Longest Common Subsequence/Tests/LongestCommonSubsquenceTests.swift b/Longest Common Subsequence/Tests/LongestCommonSubsquenceTests.swift new file mode 100644 index 000000000..75859ca1a --- /dev/null +++ b/Longest Common Subsequence/Tests/LongestCommonSubsquenceTests.swift @@ -0,0 +1,32 @@ +import Foundation +import XCTest + +class LongestCommonSubsquenceTests: XCTestCase { + + func testLCSwithSelfIsSelf() { + let a = "ABCDE" + + XCTAssertEqual(a, a.longestCommonSubsequence(a)) + } + + func testLCSWithEmptyStringIsEmptyString() { + let a = "ABCDE" + + XCTAssertEqual("", a.longestCommonSubsequence("")) + } + + func testLCSIsEmptyWhenNoCharMatches() { + let a = "ABCDE" + let b = "WXYZ" + + XCTAssertEqual("", a.longestCommonSubsequence(b)) + } + + func testLCSIsNotCommutative() { + let a = "ABCDEF" + let b = "XAWDMVBEKD" + + XCTAssertEqual("ADE", a.longestCommonSubsequence(b)) + XCTAssertEqual("ABD", b.longestCommonSubsequence(a)) + } +} diff --git a/Longest Common Subsequence/Tests/Tests.xcodeproj/project.pbxproj b/Longest Common Subsequence/Tests/Tests.xcodeproj/project.pbxproj new file mode 100644 index 000000000..39422654f --- /dev/null +++ b/Longest Common Subsequence/Tests/Tests.xcodeproj/project.pbxproj @@ -0,0 +1,257 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 4716C7AF1C93751E00F6C1C0 /* LongestCommonSubsquenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4716C7891C936E0E00F6C1C0 /* LongestCommonSubsquenceTests.swift */; }; + 4716C7B01C93751E00F6C1C0 /* LongestCommonSubsequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4716C7881C936DDD00F6C1C0 /* LongestCommonSubsequence.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 4716C7881C936DDD00F6C1C0 /* LongestCommonSubsequence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = LongestCommonSubsequence.swift; path = ../../LongestCommonSubsequence.swift; sourceTree = ""; }; + 4716C7891C936E0E00F6C1C0 /* LongestCommonSubsquenceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = LongestCommonSubsquenceTests.swift; path = ../LongestCommonSubsquenceTests.swift; sourceTree = ""; }; + 4716C7A71C93750500F6C1C0 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 4716C7AB1C93750500F6C1C0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 4716C7A41C93750500F6C1C0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 4716C7811C936DCB00F6C1C0 = { + isa = PBXGroup; + children = ( + 4716C7A81C93750500F6C1C0 /* Tests */, + 4716C78F1C93746D00F6C1C0 /* Products */, + ); + sourceTree = ""; + }; + 4716C78F1C93746D00F6C1C0 /* Products */ = { + isa = PBXGroup; + children = ( + 4716C7A71C93750500F6C1C0 /* Tests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 4716C7A81C93750500F6C1C0 /* Tests */ = { + isa = PBXGroup; + children = ( + 4716C7891C936E0E00F6C1C0 /* LongestCommonSubsquenceTests.swift */, + 4716C7881C936DDD00F6C1C0 /* LongestCommonSubsequence.swift */, + 4716C7AB1C93750500F6C1C0 /* Info.plist */, + ); + path = Tests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 4716C7A61C93750500F6C1C0 /* Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4716C7AC1C93750500F6C1C0 /* Build configuration list for PBXNativeTarget "Tests" */; + buildPhases = ( + 4716C7A31C93750500F6C1C0 /* Sources */, + 4716C7A41C93750500F6C1C0 /* Frameworks */, + 4716C7A51C93750500F6C1C0 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Tests; + productName = Tests; + productReference = 4716C7A71C93750500F6C1C0 /* Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 4716C7821C936DCB00F6C1C0 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0720; + LastUpgradeCheck = 0720; + TargetAttributes = { + 4716C7A61C93750500F6C1C0 = { + CreatedOnToolsVersion = 7.2.1; + }; + }; + }; + buildConfigurationList = 4716C7851C936DCB00F6C1C0 /* Build configuration list for PBXProject "Tests" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 4716C7811C936DCB00F6C1C0; + productRefGroup = 4716C78F1C93746D00F6C1C0 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 4716C7A61C93750500F6C1C0 /* Tests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 4716C7A51C93750500F6C1C0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 4716C7A31C93750500F6C1C0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4716C7AF1C93751E00F6C1C0 /* LongestCommonSubsquenceTests.swift in Sources */, + 4716C7B01C93751E00F6C1C0 /* LongestCommonSubsequence.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 4716C7861C936DCB00F6C1C0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + }; + name = Debug; + }; + 4716C7871C936DCB00F6C1C0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + }; + name = Release; + }; + 4716C7AD1C93750500F6C1C0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = me.pedrovereza.Tests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 4716C7AE1C93750500F6C1C0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = me.pedrovereza.Tests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 4716C7851C936DCB00F6C1C0 /* Build configuration list for PBXProject "Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4716C7861C936DCB00F6C1C0 /* Debug */, + 4716C7871C936DCB00F6C1C0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4716C7AC1C93750500F6C1C0 /* Build configuration list for PBXNativeTarget "Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4716C7AD1C93750500F6C1C0 /* Debug */, + 4716C7AE1C93750500F6C1C0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 4716C7821C936DCB00F6C1C0 /* Project object */; +} diff --git a/Longest Common Subsequence/Tests/Tests.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme b/Longest Common Subsequence/Tests/Tests.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme new file mode 100644 index 000000000..19caeb2ad --- /dev/null +++ b/Longest Common Subsequence/Tests/Tests.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Longest Common Subsequence/Tests/Tests/Info.plist b/Longest Common Subsequence/Tests/Tests/Info.plist new file mode 100644 index 000000000..ba72822e8 --- /dev/null +++ b/Longest Common Subsequence/Tests/Tests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + +

AltStyle によって変換されたページ (->オリジナル) /