-
Notifications
You must be signed in to change notification settings - Fork 0
이승준 - 계산 과제 정리 #15
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
Open
Rudy-009
wants to merge
8
commits into
main
Choose a base branch
from
SeungjunLee/week07
base: main
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
이승준 - 계산 과제 정리 #15
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0682fce
add: 과제 프로젝트 추가
Rudy-009 007b813
delete: 불필요한 코드 삭제
Rudy-009 b2af2b4
new: 프로젝트 생성
Rudy-009 3d3995c
3회차 과제
Rudy-009 dc82440
4주차 동시성 테스트 코드
Rudy-009 c3beaeb
[feat] 기본 개발 환경 구현
Rudy-009 d5d9bb4
[feat] CalculatorServiceTests 테스트 코드 작성
Rudy-009 0a74309
[feat] CalculatorViewModel 및 test 코드 작성
Rudy-009 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
This file contains hidden or 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
This file contains hidden or 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,10 @@ | ||
| // | ||
| // CalcOperator.swift | ||
| // SOPT-Test-Code-Study | ||
| // | ||
| // Created by 이승준 on 12/23/25. | ||
| // | ||
|
|
||
| enum CalcOperator { | ||
| case add, subtract, multiply, divide | ||
| } |
This file contains hidden or 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,19 @@ | ||
| // | ||
| // CalculatorService.swift | ||
| // SOPT-Test-Code-Study | ||
| // | ||
| // Created by 이승준 on 12/23/25. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| protocol CalculatorServiceType { | ||
| func calculate(lhs: Double, rhs: Double, operator: CalcOperator) -> Double | ||
| } | ||
|
|
||
| class CalculatorService: CalculatorServiceType { | ||
| func calculate(lhs: Double, rhs: Double, operator: CalcOperator) -> Double { | ||
| // 실제 사칙연산 로직 구현 | ||
| return 0 | ||
| } | ||
| } |
This file contains hidden or 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,16 @@ | ||
| // | ||
| // CalculatorViewController.swift | ||
| // SOPT-Test-Code-Study | ||
| // | ||
| // Created by 이승준 on 12/23/25. | ||
| // | ||
|
|
||
| import Combine | ||
| import UIKit | ||
|
|
||
| import Then | ||
| import SnapKit | ||
|
|
||
| class CalculatorViewController: UIViewController { | ||
|
|
||
| } | ||
This file contains hidden or 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,34 @@ | ||
| // | ||
| // CalculatorViewModel.swift | ||
| // SOPT-Test-Code-Study | ||
| // | ||
| // Created by 이승준 on 12/23/25. | ||
| // | ||
|
|
||
| import Combine | ||
|
|
||
| class CalculatorViewModel { | ||
| struct Input { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 갠취지만 인풋 아웃풋 패턴 프로토콜로 만들고 뷰모델에서 채택해주면 더 좋을 것 같습니당 |
||
| let tapNumber = PassthroughSubject<Double, Never>() | ||
| let tapOperator = PassthroughSubject<CalcOperator, Never>() | ||
| let tapEqual = PassthroughSubject<Void, Never>() | ||
| } | ||
|
|
||
| struct Output { | ||
| let displayText = CurrentValueSubject<String, Never>("0") | ||
| } | ||
|
|
||
| private let service: CalculatorServiceType // DI 적용 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 과제의 의도를 명확하게 파악하셨군요 좋습니다 |
||
| private var cancellables = Set<AnyCancellable>() | ||
|
|
||
| init(service: CalculatorServiceType = CalculatorService()) { | ||
| self.service = service | ||
| // Input을 받아 로직 처리 후 Output으로 전달하는 바인딩 구현 | ||
| } | ||
|
|
||
| func transform(input: Input) -> Output { | ||
| let output = Output() | ||
| // Combine 연산자(combineLatest 등)를 활용한 로직 | ||
| return output | ||
| } | ||
| } | ||
This file contains hidden or 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,35 @@ | ||
| // | ||
| // CalculatorServiceTests.swift | ||
| // SOPT-Test-Code-StudyTests | ||
| // | ||
| // Created by 이승준 on 12/23/25. | ||
| // | ||
|
|
||
| import XCTest | ||
|
|
||
| final class CalculatorServiceTests: XCTestCase { | ||
|
|
||
| override func setUpWithError() throws { | ||
| // Put setup code here. This method is called before the invocation of each test method in the class. | ||
| } | ||
|
|
||
| override func tearDownWithError() throws { | ||
| // Put teardown code here. This method is called after the invocation of each test method in the class. | ||
| } | ||
|
|
||
| func testExample() throws { | ||
| // This is an example of a functional test case. | ||
| // Use XCTAssert and related functions to verify your tests produce the correct results. | ||
| // Any test you write for XCTest can be annotated as throws and async. | ||
| // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. | ||
| // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. | ||
| } | ||
|
|
||
| func testPerformanceExample() throws { | ||
| // This is an example of a performance test case. | ||
| self.measure { | ||
| // Put the code you want to measure the time of here. | ||
| } | ||
| } | ||
|
|
||
| } |
This file contains hidden or 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,35 @@ | ||
| // | ||
| // CalculatorViewModelTests.swift | ||
| // SOPT-Test-Code-StudyTests | ||
| // | ||
| // Created by 이승준 on 12/23/25. | ||
| // | ||
|
|
||
| import XCTest | ||
|
|
||
| final class CalculatorViewModelTests: XCTestCase { | ||
|
|
||
| override func setUpWithError() throws { | ||
| // Put setup code here. This method is called before the invocation of each test method in the class. | ||
| } | ||
|
|
||
| override func tearDownWithError() throws { | ||
| // Put teardown code here. This method is called after the invocation of each test method in the class. | ||
| } | ||
|
|
||
| func testExample() throws { | ||
| // This is an example of a functional test case. | ||
| // Use XCTAssert and related functions to verify your tests produce the correct results. | ||
| // Any test you write for XCTest can be annotated as throws and async. | ||
| // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. | ||
| // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. | ||
| } | ||
|
|
||
| func testPerformanceExample() throws { | ||
| // This is an example of a performance test case. | ||
| self.measure { | ||
| // Put the code you want to measure the time of here. | ||
| } | ||
| } | ||
|
|
||
| } |
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.
뷰는 안구현 하신건가요..?