-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
은행창구 관리 앱 [Step3] Harry #101
Open
hemil0102
wants to merge
1
commit into
tasty-code:d_Harry
Choose a base branch
from
hemil0102:step3
base: d_Harry
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
235 changes: 230 additions & 5 deletions
235
BankManagerConsoleApp/BankManagerConsoleApp.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
74 changes: 74 additions & 0 deletions
74
...ankManagerConsoleApp.xcodeproj/xcshareddata/xcschemes/BankManagerConsoleAppTests.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1510" | ||
version = "2.2"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<AutocreatedTestPlanReference> | ||
</AutocreatedTestPlanReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
shouldAutocreateTestPlan = "YES"> | ||
<Testables> | ||
<TestableReference | ||
skipped = "NO" | ||
parallelizable = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "9B7373062B61325300FDB082" | ||
BuildableName = "BankManagerConsoleTests.xctest" | ||
BlueprintName = "BankManagerConsoleTests" | ||
ReferencedContainer = "container:BankManagerConsoleApp.xcodeproj"> | ||
</BuildableReference> | ||
</TestableReference> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "9B7373062B61325300FDB082" | ||
BuildableName = "BankManagerConsoleTests.xctest" | ||
BlueprintName = "BankManagerConsoleTests" | ||
ReferencedContainer = "container:BankManagerConsoleApp.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
51 changes: 51 additions & 0 deletions
51
BankManagerConsoleApp/BankManagerConsoleAppTests/BankManagerLinkedListTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
import XCTest | ||
@testable import BankManagerConsoleApp | ||
|
||
final class BankMangerLinkedListTests: XCTestCase { | ||
var sutLinkedTest: LinkedList<String>! | ||
|
||
override func setUpWithError() throws { | ||
sutLinkedTest = LinkedList() | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
sutLinkedTest = nil | ||
} | ||
|
||
func test_입력이1개일때_노드를1개추가하고삭제를1번하면_입력한노드가없을것이다() { | ||
// given | ||
let input = "A" | ||
// when | ||
sutLinkedTest.appendNodeAtRear(with: input) | ||
let _ = sutLinkedTest.removeNodeFromFront() | ||
let result = sutLinkedTest.searchNodeLocation(with: input) | ||
// then | ||
XCTAssertNil(result) | ||
} | ||
|
||
func test_입력이1개일때_노드를1개추가하고그값을조회하면_1번위치가반환된다() { | ||
// given | ||
let input = "A" | ||
let expectedResult = 1 | ||
// when | ||
sutLinkedTest.appendNodeAtRear(with: input) | ||
let result = sutLinkedTest.searchNodeLocation(with: input) | ||
// then | ||
XCTAssertEqual(expectedResult, result) | ||
} | ||
|
||
func test_입력이3개일때_노드를3개추가하고3번째값을조회하면_3번위치가반환된다() { | ||
// given | ||
let input = [ "A", "B", "C" ] | ||
let expectedResult = 3 | ||
// when | ||
for data in input { | ||
sutLinkedTest.appendNodeAtRear(with: data) | ||
} | ||
let result = sutLinkedTest.searchNodeLocation(with: input[2]) | ||
// then | ||
XCTAssertEqual(expectedResult, result) | ||
} | ||
} | ||
|
176 changes: 176 additions & 0 deletions
176
BankManagerConsoleApp/BankManagerConsoleAppTests/BankManagerQueueTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
|
||
import XCTest | ||
@testable import BankManagerConsoleApp | ||
|
||
final class BankManagerQueueTests: XCTestCase { | ||
var sut: Queue<String>! | ||
|
||
override func setUpWithError() throws { | ||
sut = Queue<String>() | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
sut = nil | ||
} | ||
|
||
func test_초기상태일때_대기열을확인하면_대기열이없을것이다() { | ||
// given | ||
// when | ||
let result = sut.isEmpty | ||
// then | ||
XCTAssertTrue(result) | ||
} | ||
|
||
func test_입력이1개있을때_enqueue를수행하면_대기열이있을것이다() { | ||
// given | ||
let input = "test" | ||
// when | ||
sut.enqueue(with: input) | ||
let result = sut.isEmpty | ||
// then | ||
XCTAssertFalse(result) | ||
} | ||
|
||
func test_입력이5개있을때_queue의길이를확인하면_길이가5일것이다() { | ||
// given | ||
let data = [ "A", "B", "C", "D", "E" ] | ||
let expectedLengthOfQueue = 5 | ||
// when | ||
for input in data { | ||
sut.enqueue(with: input) | ||
} | ||
let result = sut.totalLength() | ||
// then | ||
XCTAssertEqual(expectedLengthOfQueue, result) | ||
} | ||
|
||
func test_입력이5개일때_enqueue를5번dequeue를4번하면_queue의길이가1일것이다() { | ||
// given | ||
let data = [ "A", "B", "C", "D", "E" ] | ||
let lengthOfQueue = 1 | ||
let countOfDeque = 4 | ||
// when | ||
for input in data { | ||
sut.enqueue(with: input) | ||
} | ||
for _ in 1...countOfDeque { | ||
let _ = sut.dequeue() | ||
} | ||
let result = sut.totalLength() | ||
// then | ||
XCTAssertEqual(lengthOfQueue, result) | ||
} | ||
|
||
func test_입력이5개일때_enqueue를5번dequeue3번하면_4번째데이터를정상적으로peek한다() { | ||
// given | ||
let data = [ "A", "B", "C", "D", "E" ] | ||
let countOfDeque = 3 | ||
let expectedResult = data[countOfDeque] | ||
// when | ||
for input in data { | ||
sut.enqueue(with: input) | ||
} | ||
for _ in 1...countOfDeque { | ||
let _ = sut.dequeue() | ||
} | ||
let result = sut.peek() | ||
// then | ||
XCTAssertEqual(expectedResult, result) | ||
} | ||
|
||
func test_초기상태일때_dequeue를1번수행하면_길이가0을유지한다() { | ||
// given | ||
let expectedCount = 0 | ||
// when | ||
let _ = sut.dequeue() | ||
let result = sut.totalLength() | ||
// then | ||
XCTAssertEqual(expectedCount, result) | ||
} | ||
|
||
func test_초기상태일때_dequeue를1번수행하면_가져오는것이없을것이다() { | ||
// given | ||
// when | ||
let result = sut.dequeue() | ||
// then | ||
XCTAssertNil(result) | ||
} | ||
|
||
func test_입력이2개일때_enqueue를2번dequeue를1번수행하면_peek되는값이second일것이다() { | ||
// given | ||
let input = [ "First", "Second" ] | ||
let expectedResult = "Second" | ||
// when | ||
for data in input { | ||
sut.enqueue(with: data) | ||
} | ||
let _ = sut.dequeue() | ||
let result = sut.peek() | ||
// then | ||
XCTAssertEqual(expectedResult, result) | ||
} | ||
|
||
func test_입력이2개일때_enqueue를2번수행하면_dequeue한값이First일것이다() { | ||
// given | ||
let input = [ "First", "Second" ] | ||
let expectedResult = "First" | ||
//when | ||
for data in input { | ||
sut.enqueue(with: data) | ||
} | ||
let result = sut.dequeue() | ||
// then | ||
XCTAssertEqual(expectedResult, result) | ||
} | ||
|
||
func test_입력이2개일때_enqueue를2번하고peek를하면_반환되는값이First일것이다() { | ||
// given | ||
let input = [ "First", "Second" ] | ||
let expectedResult = "First" | ||
// when | ||
for data in input { | ||
sut.enqueue(with: data) | ||
} | ||
let result = sut.peek() | ||
// then | ||
XCTAssertEqual(expectedResult, result) | ||
} | ||
|
||
func test_입력이4개일때_enqueue를4번하고clean을하면_대기열이없을것이다() { | ||
// given | ||
let input = [ "A", "B", "C", "D" ] | ||
// when | ||
for data in input { | ||
sut.enqueue(with: data) | ||
} | ||
let _ = sut.clean() | ||
let result = sut.isEmpty | ||
// then | ||
XCTAssertTrue(result) | ||
} | ||
|
||
func test_입력이3개일때_enque를3번하면_head의다음다음노드가정상연결되고데이터를불러온다() { | ||
// given | ||
let input = [ "A", "B", "C" ] | ||
let expectedResult = "C" | ||
// when | ||
for data in input { | ||
sut.enqueue(with: data) | ||
} | ||
let result = sut.linkedList.head?.next?.next?.data | ||
// then | ||
XCTAssertEqual(expectedResult, result) | ||
} | ||
|
||
func test_입력이3개일때_enqueue를3번하면_tail의다음연결이nil이다() { | ||
// given | ||
let input = [ "A", "B", "C" ] | ||
// when | ||
for data in input { | ||
sut.enqueue(with: data) | ||
} | ||
let result = sut.linkedList.tail?.next | ||
// then | ||
XCTAssertNil(result) | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// BankManager.swift | ||
// Created by yagom. | ||
// Copyright © yagom academy. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct BankManager { | ||
private(set) var employees: [Employee] | ||
|
||
init(employees: [Employee]) { | ||
self.employees = employees | ||
} | ||
|
||
func reportDeadlineSummary(with customerNumber: Int, startTime bankingServiceStart: TimeInterval, endTime bankingServiceEnd: TimeInterval) { | ||
let totalTime = bankingServiceEnd - bankingServiceStart | ||
let convertedTotalTime = String(format: "%.2f", totalTime) | ||
print("업무가 마감되었습니다. 오늘 업무를 처리한 고객은 총 \(customerNumber)명이며, 총 업무시간은 \(convertedTotalTime) 입니다.") | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#90 (comment)
필요한 값이 아닌 인스턴스를 넘기게 되면 함수 내부에서는 인스턴스의 불필요한 정보까지 접근 가능하게 되는 측면이 있습니다.
함수의 형태를 좀 더 깔끔하게 유지시켜주기 위해 저는 필요한 값들만 따로 넘겨주도록 작성합니다 😄
(특정 인스턴스의 여러 값들에 접근해야 하는 경우는 또 생각해봐야겠죠??)