Skip to content

Commit f0e83bd

Browse files
committed
Added Comb Sort test.
1 parent bf46bb5 commit f0e83bd

File tree

6 files changed

+436
-0
lines changed

6 files changed

+436
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ script:
1919
# - xcodebuild test -project ./Breadth-First\ Search/Tests/Tests.xcodeproj -scheme Tests
2020
- xcodebuild test -project ./Bucket\ Sort/Tests/Tests.xcodeproj -scheme Tests
2121
- xcodebuild test -project ./B-Tree/Tests/Tests.xcodeproj -scheme Tests
22+
- xcodebuild test -project ./Comb\ Sort/Tests/Tests.xcodeproj -scheme Tests
2223
# - xcodebuild test -project ./Counting\ Sort/Tests/Tests.xcodeproj -scheme Tests
2324
# - xcodebuild test -project ./Depth-First\ Search/Tests/Tests.xcodeproj -scheme Tests
2425
# - xcodebuild test -project ./Graph/Graph.xcodeproj -scheme GraphTests

Comb Sort/Tests/CombSortTests.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// CombSortTests.swift
3+
// Tests
4+
//
5+
// Created by theng on 2017-01-09.
6+
// Copyright © 2017 Swift Algorithm Club. All rights reserved.
7+
//
8+
9+
import XCTest
10+
11+
class CombSortTests: XCTestCase {
12+
var sequence: [Int]!
13+
let expectedSequence: [Int] = [-12, -10, -1, 2, 9, 32, 55, 67, 89, 101]
14+
15+
override func setUp() {
16+
super.setUp()
17+
sequence = [2, 32, 9, -1, 89, 101, 55, -10, -12, 67]
18+
}
19+
20+
override func tearDown() {
21+
super.tearDown()
22+
}
23+
24+
func testCombSort() {
25+
let sortedSequence = combSort(sequence)
26+
XCTAssertEqual(sortedSequence, expectedSequence)
27+
}
28+
}

Comb Sort/Tests/Info.plist

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>BNDL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>1</string>
21+
</dict>
22+
</plist>
Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 46;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
056E927E1E24852900B30F52 /* CombSortTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 056E927D1E24852900B30F52 /* CombSortTests.swift */; };
11+
056E92841E248A4000B30F52 /* Comb Sort.swift in Sources */ = {isa = PBXBuildFile; fileRef = 056E92831E248A4000B30F52 /* Comb Sort.swift */; };
12+
/* End PBXBuildFile section */
13+
14+
/* Begin PBXFileReference section */
15+
056E92751E2483D300B30F52 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
16+
056E92791E2483D300B30F52 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
17+
056E927D1E24852900B30F52 /* CombSortTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CombSortTests.swift; sourceTree = "<group>"; };
18+
056E92831E248A4000B30F52 /* Comb Sort.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Comb Sort.swift"; path = "../Comb Sort.swift"; sourceTree = "<group>"; };
19+
/* End PBXFileReference section */
20+
21+
/* Begin PBXFrameworksBuildPhase section */
22+
056E92721E2483D300B30F52 /* Frameworks */ = {
23+
isa = PBXFrameworksBuildPhase;
24+
buildActionMask = 2147483647;
25+
files = (
26+
);
27+
runOnlyForDeploymentPostprocessing = 0;
28+
};
29+
/* End PBXFrameworksBuildPhase section */
30+
31+
/* Begin PBXGroup section */
32+
056E92581E24836C00B30F52 = {
33+
isa = PBXGroup;
34+
children = (
35+
056E92761E2483D300B30F52 /* Tests */,
36+
056E92621E24836C00B30F52 /* Products */,
37+
);
38+
sourceTree = "<group>";
39+
};
40+
056E92621E24836C00B30F52 /* Products */ = {
41+
isa = PBXGroup;
42+
children = (
43+
056E92751E2483D300B30F52 /* Tests.xctest */,
44+
);
45+
name = Products;
46+
sourceTree = "<group>";
47+
};
48+
056E92761E2483D300B30F52 /* Tests */ = {
49+
isa = PBXGroup;
50+
children = (
51+
056E92831E248A4000B30F52 /* Comb Sort.swift */,
52+
056E92791E2483D300B30F52 /* Info.plist */,
53+
056E927D1E24852900B30F52 /* CombSortTests.swift */,
54+
);
55+
name = Tests;
56+
sourceTree = SOURCE_ROOT;
57+
};
58+
/* End PBXGroup section */
59+
60+
/* Begin PBXNativeTarget section */
61+
056E92741E2483D300B30F52 /* Tests */ = {
62+
isa = PBXNativeTarget;
63+
buildConfigurationList = 056E927A1E2483D300B30F52 /* Build configuration list for PBXNativeTarget "Tests" */;
64+
buildPhases = (
65+
056E92711E2483D300B30F52 /* Sources */,
66+
056E92721E2483D300B30F52 /* Frameworks */,
67+
056E92731E2483D300B30F52 /* Resources */,
68+
);
69+
buildRules = (
70+
);
71+
dependencies = (
72+
);
73+
name = Tests;
74+
productName = Tests;
75+
productReference = 056E92751E2483D300B30F52 /* Tests.xctest */;
76+
productType = "com.apple.product-type.bundle.unit-test";
77+
};
78+
/* End PBXNativeTarget section */
79+
80+
/* Begin PBXProject section */
81+
056E92591E24836C00B30F52 /* Project object */ = {
82+
isa = PBXProject;
83+
attributes = {
84+
LastSwiftUpdateCheck = 0820;
85+
LastUpgradeCheck = 0820;
86+
ORGANIZATIONNAME = "Swift Algorithm Club";
87+
TargetAttributes = {
88+
056E92741E2483D300B30F52 = {
89+
CreatedOnToolsVersion = 8.2;
90+
LastSwiftMigration = 0820;
91+
ProvisioningStyle = Automatic;
92+
};
93+
};
94+
};
95+
buildConfigurationList = 056E925C1E24836C00B30F52 /* Build configuration list for PBXProject "Tests" */;
96+
compatibilityVersion = "Xcode 3.2";
97+
developmentRegion = English;
98+
hasScannedForEncodings = 0;
99+
knownRegions = (
100+
en,
101+
Base,
102+
);
103+
mainGroup = 056E92581E24836C00B30F52;
104+
productRefGroup = 056E92621E24836C00B30F52 /* Products */;
105+
projectDirPath = "";
106+
projectRoot = "";
107+
targets = (
108+
056E92741E2483D300B30F52 /* Tests */,
109+
);
110+
};
111+
/* End PBXProject section */
112+
113+
/* Begin PBXResourcesBuildPhase section */
114+
056E92731E2483D300B30F52 /* Resources */ = {
115+
isa = PBXResourcesBuildPhase;
116+
buildActionMask = 2147483647;
117+
files = (
118+
);
119+
runOnlyForDeploymentPostprocessing = 0;
120+
};
121+
/* End PBXResourcesBuildPhase section */
122+
123+
/* Begin PBXSourcesBuildPhase section */
124+
056E92711E2483D300B30F52 /* Sources */ = {
125+
isa = PBXSourcesBuildPhase;
126+
buildActionMask = 2147483647;
127+
files = (
128+
056E927E1E24852900B30F52 /* CombSortTests.swift in Sources */,
129+
056E92841E248A4000B30F52 /* Comb Sort.swift in Sources */,
130+
);
131+
runOnlyForDeploymentPostprocessing = 0;
132+
};
133+
/* End PBXSourcesBuildPhase section */
134+
135+
/* Begin XCBuildConfiguration section */
136+
056E926C1E24836C00B30F52 /* Debug */ = {
137+
isa = XCBuildConfiguration;
138+
buildSettings = {
139+
ALWAYS_SEARCH_USER_PATHS = NO;
140+
CLANG_ANALYZER_NONNULL = YES;
141+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
142+
CLANG_CXX_LIBRARY = "libc++";
143+
CLANG_ENABLE_MODULES = YES;
144+
CLANG_ENABLE_OBJC_ARC = YES;
145+
CLANG_WARN_BOOL_CONVERSION = YES;
146+
CLANG_WARN_CONSTANT_CONVERSION = YES;
147+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
148+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
149+
CLANG_WARN_EMPTY_BODY = YES;
150+
CLANG_WARN_ENUM_CONVERSION = YES;
151+
CLANG_WARN_INFINITE_RECURSION = YES;
152+
CLANG_WARN_INT_CONVERSION = YES;
153+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
154+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
155+
CLANG_WARN_UNREACHABLE_CODE = YES;
156+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
157+
CODE_SIGN_IDENTITY = "-";
158+
COPY_PHASE_STRIP = NO;
159+
DEBUG_INFORMATION_FORMAT = dwarf;
160+
ENABLE_STRICT_OBJC_MSGSEND = YES;
161+
ENABLE_TESTABILITY = YES;
162+
GCC_C_LANGUAGE_STANDARD = gnu99;
163+
GCC_DYNAMIC_NO_PIC = NO;
164+
GCC_NO_COMMON_BLOCKS = YES;
165+
GCC_OPTIMIZATION_LEVEL = 0;
166+
GCC_PREPROCESSOR_DEFINITIONS = (
167+
"DEBUG=1",
168+
"$(inherited)",
169+
);
170+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
171+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
172+
GCC_WARN_UNDECLARED_SELECTOR = YES;
173+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
174+
GCC_WARN_UNUSED_FUNCTION = YES;
175+
GCC_WARN_UNUSED_VARIABLE = YES;
176+
MACOSX_DEPLOYMENT_TARGET = 10.12;
177+
MTL_ENABLE_DEBUG_INFO = YES;
178+
ONLY_ACTIVE_ARCH = YES;
179+
SDKROOT = macosx;
180+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
181+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
182+
};
183+
name = Debug;
184+
};
185+
056E926D1E24836C00B30F52 /* Release */ = {
186+
isa = XCBuildConfiguration;
187+
buildSettings = {
188+
ALWAYS_SEARCH_USER_PATHS = NO;
189+
CLANG_ANALYZER_NONNULL = YES;
190+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
191+
CLANG_CXX_LIBRARY = "libc++";
192+
CLANG_ENABLE_MODULES = YES;
193+
CLANG_ENABLE_OBJC_ARC = YES;
194+
CLANG_WARN_BOOL_CONVERSION = YES;
195+
CLANG_WARN_CONSTANT_CONVERSION = YES;
196+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
197+
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
198+
CLANG_WARN_EMPTY_BODY = YES;
199+
CLANG_WARN_ENUM_CONVERSION = YES;
200+
CLANG_WARN_INFINITE_RECURSION = YES;
201+
CLANG_WARN_INT_CONVERSION = YES;
202+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
203+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
204+
CLANG_WARN_UNREACHABLE_CODE = YES;
205+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
206+
CODE_SIGN_IDENTITY = "-";
207+
COPY_PHASE_STRIP = NO;
208+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
209+
ENABLE_NS_ASSERTIONS = NO;
210+
ENABLE_STRICT_OBJC_MSGSEND = YES;
211+
GCC_C_LANGUAGE_STANDARD = gnu99;
212+
GCC_NO_COMMON_BLOCKS = YES;
213+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
214+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
215+
GCC_WARN_UNDECLARED_SELECTOR = YES;
216+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
217+
GCC_WARN_UNUSED_FUNCTION = YES;
218+
GCC_WARN_UNUSED_VARIABLE = YES;
219+
MACOSX_DEPLOYMENT_TARGET = 10.12;
220+
MTL_ENABLE_DEBUG_INFO = NO;
221+
SDKROOT = macosx;
222+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
223+
};
224+
name = Release;
225+
};
226+
056E927B1E2483D300B30F52 /* Debug */ = {
227+
isa = XCBuildConfiguration;
228+
buildSettings = {
229+
CLANG_ENABLE_MODULES = YES;
230+
COMBINE_HIDPI_IMAGES = YES;
231+
INFOPLIST_FILE = Info.plist;
232+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
233+
PRODUCT_BUNDLE_IDENTIFIER = "Swift-Algorithm-Club.Tests";
234+
PRODUCT_NAME = "$(TARGET_NAME)";
235+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
236+
SWIFT_VERSION = 3.0;
237+
};
238+
name = Debug;
239+
};
240+
056E927C1E2483D300B30F52 /* Release */ = {
241+
isa = XCBuildConfiguration;
242+
buildSettings = {
243+
CLANG_ENABLE_MODULES = YES;
244+
COMBINE_HIDPI_IMAGES = YES;
245+
INFOPLIST_FILE = Info.plist;
246+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
247+
PRODUCT_BUNDLE_IDENTIFIER = "Swift-Algorithm-Club.Tests";
248+
PRODUCT_NAME = "$(TARGET_NAME)";
249+
SWIFT_VERSION = 3.0;
250+
};
251+
name = Release;
252+
};
253+
/* End XCBuildConfiguration section */
254+
255+
/* Begin XCConfigurationList section */
256+
056E925C1E24836C00B30F52 /* Build configuration list for PBXProject "Tests" */ = {
257+
isa = XCConfigurationList;
258+
buildConfigurations = (
259+
056E926C1E24836C00B30F52 /* Debug */,
260+
056E926D1E24836C00B30F52 /* Release */,
261+
);
262+
defaultConfigurationIsVisible = 0;
263+
defaultConfigurationName = Release;
264+
};
265+
056E927A1E2483D300B30F52 /* Build configuration list for PBXNativeTarget "Tests" */ = {
266+
isa = XCConfigurationList;
267+
buildConfigurations = (
268+
056E927B1E2483D300B30F52 /* Debug */,
269+
056E927C1E2483D300B30F52 /* Release */,
270+
);
271+
defaultConfigurationIsVisible = 0;
272+
defaultConfigurationName = Release;
273+
};
274+
/* End XCConfigurationList section */
275+
};
276+
rootObject = 056E92591E24836C00B30F52 /* Project object */;
277+
}

Comb Sort/Tests/Tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)