Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Foundation
- struct Tanaka {
- var credit: Int!
- init(credit: Int) {
- self.credit = credit
- }
- }
- struct CreditChecker {
- func canGraduate(_ tanaka: Tanaka) -> Bool {
- if tanaka.credit >= 128 {
- return true
- }
- return false
- }
- }
- import XCTest
- @testable import TanakaGraduation
- class CreditCheckerTests: XCTestCase {
- // | 境界値-1, 境界値, 境界値+1 |の値でテストを行う
- func test田中の単位数が127なので卒業できない() {
- let tanaka = Tanaka(credit: 127)
- let creditChecker = CreditChecker()
- XCTAssertFalse(creditChecker.canGraduate(tanaka))
- }
- func test田中の単位数が128なので卒業できる() {
- let tanaka = Tanaka(credit: 128)
- let creditChecker = CreditChecker()
- XCTAssertTrue(creditChecker.canGraduate(tanaka))
- }
- func test田中の単位数が129なので卒業できる() {
- let tanaka = Tanaka(credit: 129)
- let creditChecker = CreditChecker()
- XCTAssertTrue(creditChecker.canGraduate(tanaka))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement