-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jiwon Yoon
authored and
Jiwon Yoon
committed
Dec 1, 2021
1 parent
63a42e5
commit f851467
Showing
4 changed files
with
226 additions
and
2 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
SanTa/ResultDetailAltitudeTest/ResultDetailAltitudeTest.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,68 @@ | ||
// | ||
// ResultDetailTest.swift | ||
// ResultDetailTest | ||
// | ||
// Created by Jiwon Yoon on 2021/11/30. | ||
// | ||
|
||
import XCTest | ||
|
||
class ResultDetailTest: XCTestCase { | ||
let location1 = Location(latitude: 37.53456840060343, longitude: 127.1299119494656, altitude: 20) | ||
let location2 = Location(latitude: 37.53456840060343, longitude: 127.1299119494656, altitude: 40) | ||
let location3 = Location(latitude: 37.53456840060343, longitude: 127.1299119494656, altitude: 50) | ||
let location4 = Location(latitude: 37.53456840060343, longitude: 127.1299119494656, altitude: 10) | ||
|
||
private var resultAltitude: ResultDetailViewModel.AltitudeViewModel! | ||
|
||
|
||
func test_빈위치좌표배열받을시_고도가전부마이너스() throws { | ||
let emptyRecord = Record(startTime: Date.now, endTime: Date.now + 100, step: 7777, distance: 777, locations: []) | ||
let records = Records(title: "기록제목", records: [emptyRecord], assetIdentifiers: [], secondPerHighestSpeed: 600, secondPerMinimumSpeed: 600, id: "id") | ||
let altModel = ResultAltitude(records: records) | ||
resultAltitude = .init(altitudeData: altModel) | ||
XCTAssertEqual(resultAltitude.contents.filter{$0.content.contains("-")}.count, 5) | ||
} | ||
|
||
func test_최저고도_최고고도_레코드한개() throws { | ||
let record1 = Record(startTime: Date.now, endTime: Date.now + 100, step: 7777, distance: 777, locations: [location1, location2]) | ||
let records = Records(title: "기록제목", records: [record1], assetIdentifiers: [], secondPerHighestSpeed: 600, secondPerMinimumSpeed: 600, id: "id") | ||
let altModel = ResultAltitude(records: records) | ||
resultAltitude = .init(altitudeData: altModel) | ||
XCTAssertEqual(resultAltitude.lowest, "20") | ||
XCTAssertEqual(resultAltitude.highest, "40") | ||
} | ||
|
||
func test_최저고도_최고고도_레코드여러개() throws { | ||
let record1 = Record(startTime: Date.now, endTime: Date.now + 100, step: 7777, distance: 777, locations: [location1, location2]) | ||
let record2 = Record(startTime: Date.now, endTime: Date.now + 100, step: 7777, distance: 777, locations: [location3, location4]) | ||
let records = Records(title: "기록제목", records: [record1, record2], assetIdentifiers: [], secondPerHighestSpeed: 600, secondPerMinimumSpeed: 600, id: "id") | ||
let altModel = ResultAltitude(records: records) | ||
resultAltitude = .init(altitudeData: altModel) | ||
XCTAssertEqual(resultAltitude.lowest, "10") | ||
XCTAssertEqual(resultAltitude.highest, "50") | ||
} | ||
|
||
func test_시작고도_종료고도_레코드한개() throws { | ||
let record1 = Record(startTime: Date.now, endTime: Date.now + 100, step: 7777, distance: 777, locations: [location1, location2]) | ||
let records = Records(title: "기록제목", records: [record1], assetIdentifiers: [], secondPerHighestSpeed: 600, secondPerMinimumSpeed: 600, id: "id") | ||
let altModel = ResultAltitude(records: records) | ||
resultAltitude = .init(altitudeData: altModel) | ||
let start = resultAltitude.contents.filter {$0.contentTitle == "시작"}.first?.content ?? "" | ||
let end = resultAltitude.contents.filter {$0.contentTitle == "종료"}.first?.content ?? "" | ||
XCTAssertEqual(start, "20") | ||
XCTAssertEqual(end, "40") | ||
} | ||
|
||
func test_시작고도_종료고도_레코드여러개() throws { | ||
let record1 = Record(startTime: Date.now, endTime: Date.now + 100, step: 7777, distance: 777, locations: [location1, location2]) | ||
let record2 = Record(startTime: Date.now, endTime: Date.now + 100, step: 7777, distance: 777, locations: [location3, location4]) | ||
let records = Records(title: "기록제목", records: [record2, record1], assetIdentifiers: [], secondPerHighestSpeed: 600, secondPerMinimumSpeed: 600, id: "id") | ||
let altModel = ResultAltitude(records: records) | ||
resultAltitude = .init(altitudeData: altModel) | ||
let start = resultAltitude.contents.filter {$0.contentTitle == "시작"}.first?.content ?? "" | ||
let end = resultAltitude.contents.filter {$0.contentTitle == "종료"}.first?.content ?? "" | ||
XCTAssertEqual(start, "50") | ||
XCTAssertEqual(end, "40") | ||
} | ||
} |
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
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
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