Best Mockingbird code snippet using TestTarget
LGV_CleantimeCalculationTests.swift
Source:LGV_CleantimeCalculationTests.swift
1/*2 © Copyright 2021, Little Green Viper Software Development LLC3 4 LICENSE:5 6 MIT License7 8 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation9 files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,10 modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the11 Software is furnished to do so, subject to the following conditions:12 13 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.14 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES16 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.17 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF18 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.19 */20import XCTest21import LGV_Cleantime22/* ###################################################################################################################################### */23// MARK: - Calculations Tests -24/* ###################################################################################################################################### */25/**26 **WHY THE HECK SO PEDANTIC?**27 28 Good question. Glad you asked.29 30 The tool uses a fundamental Date() algorithm, and a repeating test would use the same algorithm.31 One of the things I'm most worried about, is changes to that algorithm, so I need to do a simple, pedantic, test-every-damn-thing-every-damn-time test, to ensure that things are the way they are supposed to be.32*/33class LGV_CleantimeCalculationTests: XCTestCase {34 /* ################################################################## */35 /**36 */37 static func makeDate(year inYear: Int, month inMonth: Int, day inDay: Int, calendar inCalendar: Calendar? = nil) -> Date { (nil == inCalendar ? Calendar(identifier: .gregorian) : inCalendar!).date(from: DateComponents(year: inYear, month: inMonth, day: inDay)) ?? Date() }38 /* ################################################################## */39 /**40 */41 var endDate = Date()42 43 /* ################################################################## */44 /**45 */46 var startDate = Date()47 48 /* ################################################################## */49 /**50 */51 override func setUp() {52 endDate = Self.makeDate(year: 2021, month: 1, day: 1)53 }54 55 /* ################################################################## */56 /**57 */58 func testDateCalcSimpleYearRanges() {59 var testTarget = LGV_CleantimeDateCalc()60 XCTAssertEqual(testTarget.cleanTime.totalDays, 0)61 XCTAssertEqual(testTarget.cleanTime.totalMonths, 0)62 XCTAssertEqual(testTarget.cleanTime.years, 0)63 XCTAssertEqual(testTarget.cleanTime.months, 0)64 XCTAssertEqual(testTarget.cleanTime.days, 0)65 XCTAssertFalse(testTarget.cleanTime.isOneDayOrMore)66 XCTAssertFalse(testTarget.cleanTime.isThirtyDaysOrMore)67 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)68 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)69 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)70 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)71 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)72 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)73 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)74 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)75 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)76 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)77 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)78 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)79 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)80 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)81 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)82 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)83 XCTAssertEqual(testTarget.lastCleantimeMilestone, .invalid)84 XCTAssertNil(testTarget.timeInterval)85 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)86 testTarget = LGV_CleantimeDateCalc(startDate: Self.makeDate(year: 1949, month: 12, day: 31))87 XCTAssertEqual(testTarget.cleanTime.totalDays, 0)88 XCTAssertEqual(testTarget.cleanTime.totalMonths, 0)89 XCTAssertEqual(testTarget.cleanTime.years, 0)90 XCTAssertEqual(testTarget.cleanTime.months, 0)91 XCTAssertEqual(testTarget.cleanTime.days, 0)92 XCTAssertFalse(testTarget.cleanTime.isOneDayOrMore)93 XCTAssertFalse(testTarget.cleanTime.isThirtyDaysOrMore)94 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)95 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)96 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)97 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)98 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)99 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)100 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)101 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)102 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)103 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)104 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)105 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)106 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)107 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)108 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)109 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)110 XCTAssertEqual(testTarget.lastCleantimeMilestone, .invalid)111 XCTAssertNil(testTarget.timeInterval)112 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)113 testTarget = LGV_CleantimeDateCalc(startDate: Date())114 XCTAssertEqual(testTarget.cleanTime.totalDays, 0)115 XCTAssertEqual(testTarget.cleanTime.totalMonths, 0)116 XCTAssertEqual(testTarget.cleanTime.years, 0)117 XCTAssertEqual(testTarget.cleanTime.months, 0)118 XCTAssertEqual(testTarget.cleanTime.days, 0)119 XCTAssertFalse(testTarget.cleanTime.isOneDayOrMore)120 XCTAssertFalse(testTarget.cleanTime.isThirtyDaysOrMore)121 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)122 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)123 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)124 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)125 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)126 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)127 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)128 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)129 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)130 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)131 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)132 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)133 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)134 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)135 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)136 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)137 XCTAssertEqual(testTarget.lastCleantimeMilestone, .invalid)138 XCTAssertEqual(testTarget.timeInterval, 0)139 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)140 testTarget = LGV_CleantimeDateCalc(startDate: Self.makeDate(year: 2020, month: 12, day: 31), endDate: endDate)141 XCTAssertEqual(testTarget.cleanTime.totalDays, 1)142 XCTAssertEqual(testTarget.cleanTime.totalMonths, 0)143 XCTAssertEqual(testTarget.cleanTime.years, 0)144 XCTAssertEqual(testTarget.cleanTime.months, 0)145 XCTAssertEqual(testTarget.cleanTime.days, 1)146 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)147 XCTAssertFalse(testTarget.cleanTime.isThirtyDaysOrMore)148 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)149 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)150 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)151 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)152 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)153 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)154 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)155 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)156 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)157 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)158 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)159 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)160 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)161 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)162 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)163 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)164 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneDay)165 XCTAssertEqual(testTarget.timeInterval, 86400)166 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)167 testTarget = LGV_CleantimeDateCalc(startDate: Self.makeDate(year: 2020, month: 12, day: 31), endDate: Self.makeDate(year: 2020, month: 12, day: 31))168 XCTAssertEqual(testTarget.cleanTime.totalDays, 0)169 XCTAssertEqual(testTarget.cleanTime.totalMonths, 0)170 XCTAssertEqual(testTarget.cleanTime.years, 0)171 XCTAssertEqual(testTarget.cleanTime.months, 0)172 XCTAssertEqual(testTarget.cleanTime.days, 0)173 XCTAssertFalse(testTarget.cleanTime.isOneDayOrMore)174 XCTAssertFalse(testTarget.cleanTime.isThirtyDaysOrMore)175 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)176 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)177 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)178 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)179 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)180 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)181 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)182 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)183 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)184 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)185 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)186 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)187 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)188 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)189 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)190 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)191 XCTAssertEqual(testTarget.lastCleantimeMilestone, .invalid)192 XCTAssertEqual(testTarget.timeInterval, 0)193 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)194 testTarget = LGV_CleantimeDateCalc(startDate: Self.makeDate(year: 2020, month: 12, day: 30), endDate: Self.makeDate(year: 2020, month: 12, day: 31))195 XCTAssertEqual(testTarget.cleanTime.totalDays, 1)196 XCTAssertEqual(testTarget.cleanTime.totalMonths, 0)197 XCTAssertEqual(testTarget.cleanTime.years, 0)198 XCTAssertEqual(testTarget.cleanTime.months, 0)199 XCTAssertEqual(testTarget.cleanTime.days, 1)200 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)201 XCTAssertFalse(testTarget.cleanTime.isThirtyDaysOrMore)202 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)203 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)204 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)205 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)206 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)207 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)208 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)209 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)210 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)211 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)212 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)213 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)214 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)215 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)216 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)217 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)218 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneDay)219 XCTAssertEqual(testTarget.timeInterval, 86400)220 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)221 startDate = Self.makeDate(year: 1950, month: 1, day: 1)222 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)223 XCTAssertEqual(testTarget.cleanTime.totalDays, 25933)224 XCTAssertEqual(testTarget.cleanTime.totalMonths, 852)225 XCTAssertEqual(testTarget.cleanTime.years, 71)226 XCTAssertEqual(testTarget.cleanTime.months, 0)227 XCTAssertEqual(testTarget.cleanTime.days, 0)228 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)229 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)230 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)231 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)232 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)233 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)234 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)235 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)236 XCTAssertTrue(testTarget.cleanTime.isTwoOrMoreYears)237 XCTAssertTrue(testTarget.cleanTime.isFiveOrMoreYears)238 XCTAssertTrue(testTarget.cleanTime.isTenOrMoreYears)239 XCTAssertTrue(testTarget.cleanTime.isFifteenOrMoreYears)240 XCTAssertTrue(testTarget.cleanTime.isTwentyOrMoreYears)241 XCTAssertTrue(testTarget.cleanTime.isTwentyFiveOrMoreYears)242 XCTAssertTrue(testTarget.cleanTime.isTenThousandDaysOrMore)243 XCTAssertTrue(testTarget.cleanTime.isThirtyOrMoreYears)244 XCTAssertTrue(testTarget.cleanTime.isFortyOrMoreYears)245 XCTAssertTrue(testTarget.cleanTime.isFiftyOrMoreYears)246 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fortyYears)247 XCTAssertEqual(testTarget.timeInterval, 2240611200)248 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)249 startDate = Self.makeDate(year: 1960, month: 1, day: 1)250 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)251 XCTAssertEqual(testTarget.cleanTime.totalDays, 22281)252 XCTAssertEqual(testTarget.cleanTime.totalMonths, 732)253 XCTAssertEqual(testTarget.cleanTime.years, 61)254 XCTAssertEqual(testTarget.cleanTime.months, 0)255 XCTAssertEqual(testTarget.cleanTime.days, 0)256 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)257 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)258 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)259 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)260 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)261 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)262 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)263 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)264 XCTAssertTrue(testTarget.cleanTime.isTwoOrMoreYears)265 XCTAssertTrue(testTarget.cleanTime.isFiveOrMoreYears)266 XCTAssertTrue(testTarget.cleanTime.isTenOrMoreYears)267 XCTAssertTrue(testTarget.cleanTime.isFifteenOrMoreYears)268 XCTAssertTrue(testTarget.cleanTime.isTwentyOrMoreYears)269 XCTAssertTrue(testTarget.cleanTime.isTwentyFiveOrMoreYears)270 XCTAssertTrue(testTarget.cleanTime.isTenThousandDaysOrMore)271 XCTAssertTrue(testTarget.cleanTime.isThirtyOrMoreYears)272 XCTAssertTrue(testTarget.cleanTime.isFortyOrMoreYears)273 XCTAssertTrue(testTarget.cleanTime.isFiftyOrMoreYears)274 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fortyYears)275 XCTAssertEqual(testTarget.timeInterval, 1925078400)276 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)277 startDate = Self.makeDate(year: 1970, month: 1, day: 1)278 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)279 XCTAssertEqual(testTarget.cleanTime.totalDays, 18628)280 XCTAssertEqual(testTarget.cleanTime.totalMonths, 612)281 XCTAssertEqual(testTarget.cleanTime.years, 51)282 XCTAssertEqual(testTarget.cleanTime.months, 0)283 XCTAssertEqual(testTarget.cleanTime.days, 0)284 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)285 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)286 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)287 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)288 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)289 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)290 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)291 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)292 XCTAssertTrue(testTarget.cleanTime.isTwoOrMoreYears)293 XCTAssertTrue(testTarget.cleanTime.isFiveOrMoreYears)294 XCTAssertTrue(testTarget.cleanTime.isTenOrMoreYears)295 XCTAssertTrue(testTarget.cleanTime.isFifteenOrMoreYears)296 XCTAssertTrue(testTarget.cleanTime.isTwentyOrMoreYears)297 XCTAssertTrue(testTarget.cleanTime.isTwentyFiveOrMoreYears)298 XCTAssertTrue(testTarget.cleanTime.isTenThousandDaysOrMore)299 XCTAssertTrue(testTarget.cleanTime.isThirtyOrMoreYears)300 XCTAssertTrue(testTarget.cleanTime.isFortyOrMoreYears)301 XCTAssertTrue(testTarget.cleanTime.isFiftyOrMoreYears)302 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fortyYears)303 XCTAssertEqual(testTarget.timeInterval, 1609459200)304 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)305 startDate = Self.makeDate(year: 1980, month: 1, day: 1)306 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)307 XCTAssertEqual(testTarget.cleanTime.totalDays, 14976)308 XCTAssertEqual(testTarget.cleanTime.totalMonths, 492)309 XCTAssertEqual(testTarget.cleanTime.years, 41)310 XCTAssertEqual(testTarget.cleanTime.months, 0)311 XCTAssertEqual(testTarget.cleanTime.days, 0)312 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)313 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)314 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)315 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)316 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)317 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)318 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)319 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)320 XCTAssertTrue(testTarget.cleanTime.isTwoOrMoreYears)321 XCTAssertTrue(testTarget.cleanTime.isFiveOrMoreYears)322 XCTAssertTrue(testTarget.cleanTime.isTenOrMoreYears)323 XCTAssertTrue(testTarget.cleanTime.isFifteenOrMoreYears)324 XCTAssertTrue(testTarget.cleanTime.isTwentyOrMoreYears)325 XCTAssertTrue(testTarget.cleanTime.isTwentyFiveOrMoreYears)326 XCTAssertTrue(testTarget.cleanTime.isTenThousandDaysOrMore)327 XCTAssertTrue(testTarget.cleanTime.isThirtyOrMoreYears)328 XCTAssertTrue(testTarget.cleanTime.isFortyOrMoreYears)329 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)330 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fortyYears)331 XCTAssertEqual(testTarget.timeInterval, 1293926400)332 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)333 startDate = Self.makeDate(year: 2000, month: 1, day: 1)334 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)335 XCTAssertEqual(testTarget.cleanTime.totalDays, 7671)336 XCTAssertEqual(testTarget.cleanTime.totalMonths, 252)337 XCTAssertEqual(testTarget.cleanTime.years, 21)338 XCTAssertEqual(testTarget.cleanTime.months, 0)339 XCTAssertEqual(testTarget.cleanTime.days, 0)340 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)341 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)342 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)343 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)344 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)345 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)346 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)347 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)348 XCTAssertTrue(testTarget.cleanTime.isTwoOrMoreYears)349 XCTAssertTrue(testTarget.cleanTime.isFiveOrMoreYears)350 XCTAssertTrue(testTarget.cleanTime.isTenOrMoreYears)351 XCTAssertTrue(testTarget.cleanTime.isFifteenOrMoreYears)352 XCTAssertTrue(testTarget.cleanTime.isTwentyOrMoreYears)353 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)354 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)355 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)356 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)357 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)358 XCTAssertEqual(testTarget.lastCleantimeMilestone, .twentyYears)359 XCTAssertEqual(testTarget.timeInterval, 662774400)360 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)361 startDate = Self.makeDate(year: 2020, month: 1, day: 1)362 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)363 XCTAssertEqual(testTarget.cleanTime.totalDays, 366)364 XCTAssertEqual(testTarget.cleanTime.totalMonths, 12)365 XCTAssertEqual(testTarget.cleanTime.years, 1)366 XCTAssertEqual(testTarget.cleanTime.months, 0)367 XCTAssertEqual(testTarget.cleanTime.days, 0)368 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)369 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)370 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)371 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)372 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)373 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)374 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)375 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)376 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)377 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)378 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)379 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)380 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)381 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)382 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)383 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)384 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)385 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)386 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneYear)387 XCTAssertEqual(testTarget.timeInterval, 31622400)388 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)389 startDate = Self.makeDate(year: 2019, month: 1, day: 1)390 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)391 XCTAssertEqual(testTarget.cleanTime.totalDays, 731)392 XCTAssertEqual(testTarget.cleanTime.totalMonths, 24)393 XCTAssertEqual(testTarget.cleanTime.years, 2)394 XCTAssertEqual(testTarget.cleanTime.months, 0)395 XCTAssertEqual(testTarget.cleanTime.days, 0)396 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)397 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)398 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)399 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)400 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)401 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)402 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)403 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)404 XCTAssertTrue(testTarget.cleanTime.isTwoOrMoreYears)405 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)406 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)407 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)408 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)409 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)410 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)411 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)412 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)413 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)414 if case let .years(numberOfYears) = testTarget.lastCleantimeMilestone,415 2 == numberOfYears {416 XCTAssertTrue(true, "It is exactly two years.")417 } else {418 XCTFail("Should be exactly two years!")419 }420 XCTAssertEqual(testTarget.timeInterval, 63158400)421 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)422 // Test for non-leap year.423 startDate = Self.makeDate(year: 2019, month: 1, day: 1)424 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 2020, month: 1, day: 1))425 XCTAssertEqual(testTarget.cleanTime.totalDays, 365)426 XCTAssertEqual(testTarget.cleanTime.totalMonths, 12)427 XCTAssertEqual(testTarget.cleanTime.years, 1)428 XCTAssertEqual(testTarget.cleanTime.months, 0)429 XCTAssertEqual(testTarget.cleanTime.days, 0)430 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)431 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)432 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)433 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)434 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)435 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)436 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)437 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)438 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)439 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)440 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)441 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)442 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)443 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)444 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)445 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)446 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)447 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)448 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneYear)449 XCTAssertEqual(testTarget.timeInterval, 31536000)450 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 2020, month: 1, day: 1))451 testTarget = LGV_CleantimeDateCalc(startDate: endDate, endDate: endDate)452 XCTAssertEqual(testTarget.cleanTime.totalDays, 0)453 XCTAssertEqual(testTarget.cleanTime.totalMonths, 0)454 XCTAssertEqual(testTarget.cleanTime.years, 0)455 XCTAssertEqual(testTarget.cleanTime.months, 0)456 XCTAssertEqual(testTarget.cleanTime.days, 0)457 XCTAssertFalse(testTarget.cleanTime.isOneDayOrMore)458 XCTAssertFalse(testTarget.cleanTime.isThirtyDaysOrMore)459 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)460 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)461 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)462 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)463 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)464 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)465 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)466 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)467 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)468 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)469 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)470 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)471 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)472 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)473 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)474 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)475 XCTAssertEqual(testTarget.lastCleantimeMilestone, .invalid)476 XCTAssertEqual(testTarget.timeInterval, 0)477 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)478 startDate = Self.makeDate(year: 2023, month: 1, day: 1)479 endDate = Self.makeDate(year: 2021, month: 1, day: 1)480 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)481 XCTAssertEqual(testTarget.cleanTime.totalDays, 0)482 XCTAssertEqual(testTarget.cleanTime.totalMonths, 0)483 XCTAssertEqual(testTarget.cleanTime.years, 0)484 XCTAssertEqual(testTarget.cleanTime.months, 0)485 XCTAssertEqual(testTarget.cleanTime.days, 0)486 XCTAssertFalse(testTarget.cleanTime.isOneDayOrMore)487 XCTAssertFalse(testTarget.cleanTime.isThirtyDaysOrMore)488 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)489 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)490 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)491 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)492 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)493 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)494 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)495 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)496 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)497 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)498 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)499 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)500 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)501 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)502 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)503 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)504 XCTAssertEqual(testTarget.lastCleantimeMilestone, .invalid)505 XCTAssertEqual(testTarget.timeInterval, -63072000)506 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)507 }508 509 /* ################################################################## */510 /**511 */512 func testDateCalc1953() {513 startDate = Self.makeDate(year: 1953, month: 10, day: 5)514 var testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)515 XCTAssertEqual(testTarget.cleanTime.totalMonths, 806)516 XCTAssertEqual(testTarget.cleanTime.totalDays, 24560)517 XCTAssertEqual(testTarget.cleanTime.years, 67)518 XCTAssertEqual(testTarget.cleanTime.months, 2)519 XCTAssertEqual(testTarget.cleanTime.days, 27)520 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)521 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)522 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)523 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)524 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)525 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)526 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)527 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)528 XCTAssertTrue(testTarget.cleanTime.isTwoOrMoreYears)529 XCTAssertTrue(testTarget.cleanTime.isFiveOrMoreYears)530 XCTAssertTrue(testTarget.cleanTime.isTenOrMoreYears)531 XCTAssertTrue(testTarget.cleanTime.isFifteenOrMoreYears)532 XCTAssertTrue(testTarget.cleanTime.isTwentyOrMoreYears)533 XCTAssertTrue(testTarget.cleanTime.isTwentyFiveOrMoreYears)534 XCTAssertTrue(testTarget.cleanTime.isTenThousandDaysOrMore)535 XCTAssertTrue(testTarget.cleanTime.isThirtyOrMoreYears)536 XCTAssertTrue(testTarget.cleanTime.isFortyOrMoreYears)537 XCTAssertTrue(testTarget.cleanTime.isFiftyOrMoreYears)538 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fortyYears)539 XCTAssertEqual(testTarget.timeInterval, 2121984000)540 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 2020, month: 10, day: 5))541 let components = testTarget.components542 XCTAssertEqual(components.year, 67)543 XCTAssertEqual(components.month, 2)544 XCTAssertEqual(components.day, 27)545 let timeInterval = testTarget.timeInterval546 XCTAssertEqual(timeInterval, 2121984000.0)547 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1953, month: 11, day: 5))548 XCTAssertEqual(testTarget.cleanTime.totalMonths, 1)549 XCTAssertEqual(testTarget.cleanTime.totalDays, 31)550 XCTAssertEqual(testTarget.cleanTime.years, 0)551 XCTAssertEqual(testTarget.cleanTime.months, 1)552 XCTAssertEqual(testTarget.cleanTime.days, 0)553 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)554 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)555 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)556 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)557 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)558 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)559 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)560 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)561 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)562 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)563 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)564 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)565 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)566 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)567 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)568 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)569 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)570 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)571 XCTAssertEqual(testTarget.lastCleantimeMilestone, .thirtyDays)572 XCTAssertEqual(testTarget.timeInterval, 2678400)573 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)574 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1953, month: 11, day: 4))575 XCTAssertEqual(testTarget.cleanTime.totalMonths, 0)576 XCTAssertEqual(testTarget.cleanTime.totalDays, 30)577 XCTAssertEqual(testTarget.cleanTime.years, 0)578 XCTAssertEqual(testTarget.cleanTime.months, 0)579 XCTAssertEqual(testTarget.cleanTime.days, 30)580 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)581 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)582 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)583 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)584 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)585 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)586 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)587 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)588 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)589 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)590 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)591 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)592 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)593 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)594 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)595 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)596 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)597 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)598 XCTAssertEqual(testTarget.lastCleantimeMilestone, .thirtyDays)599 XCTAssertEqual(testTarget.timeInterval, 2592000)600 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)601 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1953, month: 11, day: 6))602 XCTAssertEqual(testTarget.cleanTime.totalMonths, 1)603 XCTAssertEqual(testTarget.cleanTime.totalDays, 32)604 XCTAssertEqual(testTarget.cleanTime.years, 0)605 XCTAssertEqual(testTarget.cleanTime.months, 1)606 XCTAssertEqual(testTarget.cleanTime.days, 1)607 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)608 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)609 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)610 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)611 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)612 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)613 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)614 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)615 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)616 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)617 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)618 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)619 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)620 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)621 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)622 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)623 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)624 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)625 XCTAssertEqual(testTarget.lastCleantimeMilestone, .thirtyDays)626 XCTAssertEqual(testTarget.timeInterval, 2764800)627 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)628 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1953, month: 12, day: 5))629 XCTAssertEqual(testTarget.cleanTime.totalMonths, 2)630 XCTAssertEqual(testTarget.cleanTime.totalDays, 61)631 XCTAssertEqual(testTarget.cleanTime.years, 0)632 XCTAssertEqual(testTarget.cleanTime.months, 2)633 XCTAssertEqual(testTarget.cleanTime.days, 0)634 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)635 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)636 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)637 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)638 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)639 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)640 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)641 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)642 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)643 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)644 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)645 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)646 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)647 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)648 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)649 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)650 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)651 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)652 XCTAssertEqual(testTarget.lastCleantimeMilestone, .sixtyDays)653 XCTAssertEqual(testTarget.timeInterval, 5270400)654 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)655 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1954, month: 12, day: 5))656 XCTAssertEqual(testTarget.cleanTime.totalMonths, 14)657 XCTAssertEqual(testTarget.cleanTime.totalDays, 426)658 XCTAssertEqual(testTarget.cleanTime.years, 1)659 XCTAssertEqual(testTarget.cleanTime.months, 2)660 XCTAssertEqual(testTarget.cleanTime.days, 0)661 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)662 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)663 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)664 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)665 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)666 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)667 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)668 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)669 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)670 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)671 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)672 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)673 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)674 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)675 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)676 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)677 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)678 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)679 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneYear)680 XCTAssertEqual(testTarget.timeInterval, 36806400)681 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1954, month: 10, day: 5))682 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1953, month: 12, day: 4))683 XCTAssertEqual(testTarget.cleanTime.totalMonths, 1)684 XCTAssertEqual(testTarget.cleanTime.totalDays, 60)685 XCTAssertEqual(testTarget.cleanTime.years, 0)686 XCTAssertEqual(testTarget.cleanTime.months, 1)687 XCTAssertEqual(testTarget.cleanTime.days, 29)688 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)689 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)690 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)691 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)692 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)693 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)694 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)695 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)696 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)697 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)698 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)699 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)700 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)701 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)702 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)703 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)704 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)705 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)706 XCTAssertEqual(testTarget.lastCleantimeMilestone, .sixtyDays)707 XCTAssertEqual(testTarget.timeInterval, 5184000)708 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)709 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1954, month: 1, day: 4))710 XCTAssertEqual(testTarget.cleanTime.totalMonths, 2)711 XCTAssertEqual(testTarget.cleanTime.totalDays, 91)712 XCTAssertEqual(testTarget.cleanTime.years, 0)713 XCTAssertEqual(testTarget.cleanTime.months, 2)714 XCTAssertEqual(testTarget.cleanTime.days, 30)715 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)716 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)717 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)718 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)719 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)720 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)721 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)722 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)723 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)724 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)725 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)726 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)727 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)728 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)729 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)730 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)731 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)732 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)733 XCTAssertEqual(testTarget.lastCleantimeMilestone, .ninetyDays)734 XCTAssertEqual(testTarget.timeInterval, 7862400)735 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)736 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1954, month: 4, day: 4))737 XCTAssertEqual(testTarget.cleanTime.totalMonths, 5)738 XCTAssertEqual(testTarget.cleanTime.totalDays, 181)739 XCTAssertEqual(testTarget.cleanTime.years, 0)740 XCTAssertEqual(testTarget.cleanTime.months, 5)741 XCTAssertEqual(testTarget.cleanTime.days, 30)742 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)743 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)744 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)745 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)746 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)747 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)748 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)749 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)750 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)751 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)752 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)753 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)754 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)755 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)756 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)757 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)758 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)759 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)760 XCTAssertEqual(testTarget.lastCleantimeMilestone, .ninetyDays)761 XCTAssertEqual(testTarget.timeInterval, 15638400)762 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)763 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1954, month: 4, day: 5))764 XCTAssertEqual(testTarget.cleanTime.totalMonths, 6)765 XCTAssertEqual(testTarget.cleanTime.totalDays, 182)766 XCTAssertEqual(testTarget.cleanTime.years, 0)767 XCTAssertEqual(testTarget.cleanTime.months, 6)768 XCTAssertEqual(testTarget.cleanTime.days, 0)769 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)770 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)771 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)772 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)773 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)774 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)775 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)776 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)777 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)778 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)779 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)780 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)781 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)782 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)783 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)784 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)785 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)786 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)787 XCTAssertEqual(testTarget.lastCleantimeMilestone, .sixMonths)788 XCTAssertEqual(testTarget.timeInterval, 15724800)789 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)790 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1954, month: 8, day: 5))791 XCTAssertEqual(testTarget.cleanTime.totalMonths, 10)792 XCTAssertEqual(testTarget.cleanTime.totalDays, 304)793 XCTAssertEqual(testTarget.cleanTime.years, 0)794 XCTAssertEqual(testTarget.cleanTime.months, 10)795 XCTAssertEqual(testTarget.cleanTime.days, 0)796 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)797 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)798 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)799 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)800 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)801 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)802 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)803 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)804 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)805 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)806 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)807 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)808 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)809 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)810 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)811 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)812 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)813 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)814 XCTAssertEqual(testTarget.lastCleantimeMilestone, .nineMonths)815 XCTAssertEqual(testTarget.timeInterval, 26262000)816 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)817 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1963, month: 11, day: 5))818 XCTAssertEqual(testTarget.cleanTime.totalMonths, 121)819 XCTAssertEqual(testTarget.cleanTime.totalDays, 3683)820 XCTAssertEqual(testTarget.cleanTime.years, 10)821 XCTAssertEqual(testTarget.cleanTime.months, 1)822 XCTAssertEqual(testTarget.cleanTime.days, 0)823 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)824 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)825 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)826 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)827 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)828 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)829 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)830 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)831 XCTAssertTrue(testTarget.cleanTime.isTwoOrMoreYears)832 XCTAssertTrue(testTarget.cleanTime.isFiveOrMoreYears)833 XCTAssertTrue(testTarget.cleanTime.isTenOrMoreYears)834 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)835 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)836 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)837 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)838 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)839 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)840 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)841 XCTAssertEqual(testTarget.lastCleantimeMilestone, .tenYears)842 XCTAssertEqual(testTarget.timeInterval, 318211200)843 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1963, month: 10, day: 5))844 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1963, month: 10, day: 5))845 XCTAssertEqual(testTarget.cleanTime.totalMonths, 120)846 XCTAssertEqual(testTarget.cleanTime.totalDays, 3652)847 XCTAssertEqual(testTarget.cleanTime.years, 10)848 XCTAssertEqual(testTarget.cleanTime.months, 0)849 XCTAssertEqual(testTarget.cleanTime.days, 0)850 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)851 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)852 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)853 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)854 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)855 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)856 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)857 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)858 XCTAssertTrue(testTarget.cleanTime.isTwoOrMoreYears)859 XCTAssertTrue(testTarget.cleanTime.isFiveOrMoreYears)860 XCTAssertTrue(testTarget.cleanTime.isTenOrMoreYears)861 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)862 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)863 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)864 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)865 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)866 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)867 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)868 XCTAssertEqual(testTarget.lastCleantimeMilestone, .tenYears)869 XCTAssertEqual(testTarget.timeInterval, 315529200)870 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1963, month: 10, day: 5))871 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1968, month: 10, day: 5))872 XCTAssertEqual(testTarget.cleanTime.totalMonths, 180)873 XCTAssertEqual(testTarget.cleanTime.totalDays, 5479)874 XCTAssertEqual(testTarget.cleanTime.years, 15)875 XCTAssertEqual(testTarget.cleanTime.months, 0)876 XCTAssertEqual(testTarget.cleanTime.days, 0)877 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)878 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)879 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)880 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)881 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)882 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)883 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)884 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)885 XCTAssertTrue(testTarget.cleanTime.isTwoOrMoreYears)886 XCTAssertTrue(testTarget.cleanTime.isFiveOrMoreYears)887 XCTAssertTrue(testTarget.cleanTime.isTenOrMoreYears)888 XCTAssertTrue(testTarget.cleanTime.isFifteenOrMoreYears)889 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)890 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)891 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)892 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)893 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)894 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)895 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fifteenYears)896 XCTAssertEqual(testTarget.timeInterval, 473382000)897 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1968, month: 10, day: 5))898 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: Self.makeDate(year: 1960, month: 1, day: 1))899 XCTAssertEqual(testTarget.cleanTime.totalMonths, 74)900 XCTAssertEqual(testTarget.cleanTime.totalDays, 2279)901 XCTAssertEqual(testTarget.cleanTime.years, 6)902 XCTAssertEqual(testTarget.cleanTime.months, 2)903 XCTAssertEqual(testTarget.cleanTime.days, 27)904 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)905 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)906 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)907 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)908 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)909 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)910 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)911 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)912 XCTAssertTrue(testTarget.cleanTime.isTwoOrMoreYears)913 XCTAssertTrue(testTarget.cleanTime.isFiveOrMoreYears)914 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)915 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)916 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)917 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)918 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)919 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)920 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)921 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)922 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fiveYears)923 XCTAssertEqual(testTarget.timeInterval, 196905600)924 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1959, month: 10, day: 5))925 }926 927 /* ################################################################## */928 /**929 */930 func testDateCalcLeapYear() {931 startDate = Self.makeDate(year: 2020, month: 1, day: 31)932 endDate = Self.makeDate(year: 2020, month: 3, day: 1)933 var testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)934 XCTAssertEqual(testTarget.cleanTime.totalMonths, 1)935 XCTAssertEqual(testTarget.cleanTime.totalDays, 30)936 XCTAssertEqual(testTarget.cleanTime.years, 0)937 XCTAssertEqual(testTarget.cleanTime.months, 1)938 XCTAssertEqual(testTarget.cleanTime.days, 1)939 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)940 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)941 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)942 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)943 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)944 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)945 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)946 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)947 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)948 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)949 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)950 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)951 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)952 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)953 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)954 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)955 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)956 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)957 XCTAssertEqual(testTarget.lastCleantimeMilestone, .thirtyDays)958 XCTAssertEqual(testTarget.timeInterval, 2592000)959 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)960 startDate = Self.makeDate(year: 2021, month: 1, day: 31)961 endDate = Self.makeDate(year: 2021, month: 3, day: 1)962 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)963 XCTAssertEqual(testTarget.cleanTime.totalMonths, 1)964 XCTAssertEqual(testTarget.cleanTime.totalDays, 29)965 XCTAssertEqual(testTarget.cleanTime.years, 0)966 XCTAssertEqual(testTarget.cleanTime.months, 1)967 XCTAssertEqual(testTarget.cleanTime.days, 1)968 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)969 XCTAssertFalse(testTarget.cleanTime.isThirtyDaysOrMore)970 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)971 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)972 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)973 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)974 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)975 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)976 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)977 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)978 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)979 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)980 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)981 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)982 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)983 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)984 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)985 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)986 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneDay)987 XCTAssertEqual(testTarget.timeInterval, 2505600)988 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)989 startDate = Self.makeDate(year: 2019, month: 2, day: 28)990 endDate = Self.makeDate(year: 2020, month: 2, day: 28)991 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)992 XCTAssertEqual(testTarget.cleanTime.totalMonths, 12)993 XCTAssertEqual(testTarget.cleanTime.totalDays, 365)994 XCTAssertEqual(testTarget.cleanTime.years, 1)995 XCTAssertEqual(testTarget.cleanTime.months, 0)996 XCTAssertEqual(testTarget.cleanTime.days, 0)997 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)998 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)999 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1000 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1001 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1002 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1003 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1004 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)1005 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1006 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1007 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1008 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1009 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1010 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1011 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1012 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1013 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1014 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1015 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneYear)1016 XCTAssertEqual(testTarget.timeInterval, 31536000)1017 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)1018 startDate = Self.makeDate(year: 2020, month: 1, day: 1)1019 endDate = Self.makeDate(year: 2020, month: 3, day: 1)1020 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1021 XCTAssertEqual(testTarget.cleanTime.totalMonths, 2)1022 XCTAssertEqual(testTarget.cleanTime.totalDays, 60)1023 XCTAssertEqual(testTarget.cleanTime.years, 0)1024 XCTAssertEqual(testTarget.cleanTime.months, 2)1025 XCTAssertEqual(testTarget.cleanTime.days, 0)1026 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1027 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1028 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1029 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)1030 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)1031 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)1032 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)1033 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)1034 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1035 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1036 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1037 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1038 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1039 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1040 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1041 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1042 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1043 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1044 XCTAssertEqual(testTarget.lastCleantimeMilestone, .sixtyDays)1045 XCTAssertEqual(testTarget.timeInterval, 5184000)1046 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1047 endDate = Self.makeDate(year: 2021, month: 1, day: 29)1048 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1049 XCTAssertEqual(testTarget.cleanTime.totalMonths, 12)1050 XCTAssertEqual(testTarget.cleanTime.totalDays, 394)1051 XCTAssertEqual(testTarget.cleanTime.years, 1)1052 XCTAssertEqual(testTarget.cleanTime.months, 0)1053 XCTAssertEqual(testTarget.cleanTime.days, 28)1054 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1055 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1056 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1057 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1058 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1059 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1060 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1061 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)1062 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1063 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1064 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1065 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1066 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1067 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1068 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1069 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1070 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1071 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1072 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneYear)1073 XCTAssertEqual(testTarget.timeInterval, 34041600)1074 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 2021, month: 1, day: 1))1075 endDate = Self.makeDate(year: 2021, month: 1, day: 1)1076 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1077 XCTAssertEqual(testTarget.cleanTime.totalMonths, 12)1078 XCTAssertEqual(testTarget.cleanTime.totalDays, 366)1079 XCTAssertEqual(testTarget.cleanTime.years, 1)1080 XCTAssertEqual(testTarget.cleanTime.months, 0)1081 XCTAssertEqual(testTarget.cleanTime.days, 0)1082 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1083 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1084 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1085 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1086 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1087 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1088 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1089 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)1090 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1091 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1092 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1093 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1094 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1095 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1096 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1097 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1098 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1099 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1100 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneYear)1101 XCTAssertEqual(testTarget.timeInterval, 31622400)1102 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)1103 endDate = Self.makeDate(year: 2021, month: 3, day: 31)1104 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1105 XCTAssertEqual(testTarget.cleanTime.totalMonths, 14)1106 XCTAssertEqual(testTarget.cleanTime.totalDays, 455)1107 XCTAssertEqual(testTarget.cleanTime.years, 1)1108 XCTAssertEqual(testTarget.cleanTime.months, 2)1109 XCTAssertEqual(testTarget.cleanTime.days, 30)1110 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1111 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1112 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1113 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1114 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1115 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1116 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1117 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)1118 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1119 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1120 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1121 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1122 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1123 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1124 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1125 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1126 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1127 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1128 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneYear)1129 XCTAssertEqual(testTarget.timeInterval, 39308400)1130 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 2021, month: 1, day: 1))1131 endDate = Self.makeDate(year: 2021, month: 4, day: 1)1132 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1133 XCTAssertEqual(testTarget.cleanTime.totalMonths, 15)1134 XCTAssertEqual(testTarget.cleanTime.totalDays, 456)1135 XCTAssertEqual(testTarget.cleanTime.years, 1)1136 XCTAssertEqual(testTarget.cleanTime.months, 3)1137 XCTAssertEqual(testTarget.cleanTime.days, 0)1138 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1139 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1140 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1141 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1142 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1143 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1144 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1145 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)1146 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1147 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1148 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1149 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1150 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1151 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1152 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1153 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1154 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1155 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1156 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneYear)1157 XCTAssertEqual(testTarget.timeInterval, 39394800)1158 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 2021, month: 1, day: 1))1159 startDate = Self.makeDate(year: 2020, month: 2, day: 29)1160 endDate = Self.makeDate(year: 2021, month: 2, day: 28)1161 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1162 XCTAssertEqual(testTarget.cleanTime.totalMonths, 12)1163 XCTAssertEqual(testTarget.cleanTime.totalDays, 365)1164 XCTAssertEqual(testTarget.cleanTime.years, 1)1165 XCTAssertEqual(testTarget.cleanTime.months, 0)1166 XCTAssertEqual(testTarget.cleanTime.days, 0)1167 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1168 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1169 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1170 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1171 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1172 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1173 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1174 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)1175 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1176 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1177 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1178 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1179 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1180 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1181 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1182 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1183 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1184 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1185 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneYear)1186 XCTAssertEqual(testTarget.timeInterval, 31536000)1187 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 2021, month: 2, day: 28))1188 }1189 1190 /* ################################################################## */1191 /**1192 */1193 func testDateCalcEighteenMonths() {1194 startDate = Self.makeDate(year: 2011, month: 8, day: 29)1195 endDate = Self.makeDate(year: 2013, month: 3, day: 1)1196 var testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1197 XCTAssertEqual(testTarget.cleanTime.totalMonths, 18)1198 XCTAssertEqual(testTarget.cleanTime.totalDays, 550)1199 XCTAssertEqual(testTarget.cleanTime.years, 1)1200 XCTAssertEqual(testTarget.cleanTime.months, 6)1201 XCTAssertEqual(testTarget.cleanTime.days, 1)1202 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1203 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1204 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1205 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1206 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1207 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1208 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1209 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)1210 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1211 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1212 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1213 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1214 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1215 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1216 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1217 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1218 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1219 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1220 XCTAssertEqual(testTarget.lastCleantimeMilestone, .eighteenMonths)1221 XCTAssertEqual(testTarget.timeInterval, 47523600)1222 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 2012, month: 8, day: 29))1223 startDate = Self.makeDate(year: 2018, month: 8, day: 29)1224 endDate = Self.makeDate(year: 2020, month: 4, day: 1)1225 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1226 XCTAssertEqual(testTarget.cleanTime.totalMonths, 19)1227 XCTAssertEqual(testTarget.cleanTime.totalDays, 581)1228 XCTAssertEqual(testTarget.cleanTime.years, 1)1229 XCTAssertEqual(testTarget.cleanTime.months, 7)1230 XCTAssertEqual(testTarget.cleanTime.days, 3)1231 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1232 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1233 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1234 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1235 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1236 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1237 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1238 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)1239 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1240 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1241 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1242 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1243 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1244 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1245 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1246 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1247 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1248 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1249 XCTAssertEqual(testTarget.lastCleantimeMilestone, .eighteenMonths)1250 XCTAssertEqual(testTarget.timeInterval, 50198400)1251 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 2019, month: 8, day: 29))1252 }1253 /* ################################################################## */1254 /**1255 */1256 func testDateCalcSolarCalendar() {1257 let calendar = Calendar(identifier: .persian)1258 startDate = Self.makeDate(year: 1388, month: 1, day: 27, calendar: calendar)1259 endDate = Self.makeDate(year: 1400, month: 4, day: 12, calendar: calendar)1260 var testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate, calendar: calendar)1261 XCTAssertEqual(testTarget.cleanTime.totalMonths, 146)1262 XCTAssertEqual(testTarget.cleanTime.totalDays, 4461)1263 XCTAssertEqual(testTarget.cleanTime.years, 12)1264 XCTAssertEqual(testTarget.cleanTime.months, 2)1265 XCTAssertEqual(testTarget.cleanTime.days, 17)1266 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1267 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1268 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1269 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1270 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1271 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1272 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1273 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)1274 XCTAssertTrue(testTarget.cleanTime.isTwoOrMoreYears)1275 XCTAssertTrue(testTarget.cleanTime.isFiveOrMoreYears)1276 XCTAssertTrue(testTarget.cleanTime.isTenOrMoreYears)1277 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1278 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1279 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1280 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1281 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1282 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1283 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1284 XCTAssertEqual(testTarget.lastCleantimeMilestone, .tenYears)1285 XCTAssertEqual(testTarget.timeInterval, 385430400)1286 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1400, month: 1, day: 27, calendar: calendar))1287 endDate = Self.makeDate(year: 1388, month: 2, day: 2, calendar: calendar)1288 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate, calendar: calendar)1289 XCTAssertEqual(testTarget.cleanTime.totalMonths, 0)1290 XCTAssertEqual(testTarget.cleanTime.totalDays, 6)1291 XCTAssertEqual(testTarget.cleanTime.years, 0)1292 XCTAssertEqual(testTarget.cleanTime.months, 0)1293 XCTAssertEqual(testTarget.cleanTime.days, 6)1294 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1295 XCTAssertFalse(testTarget.cleanTime.isThirtyDaysOrMore)1296 XCTAssertFalse(testTarget.cleanTime.isSixtyDaysOrMore)1297 XCTAssertFalse(testTarget.cleanTime.isNinetyDaysOrMore)1298 XCTAssertFalse(testTarget.cleanTime.isSixMonthsOrMore)1299 XCTAssertFalse(testTarget.cleanTime.isNineMonthsOrMore)1300 XCTAssertFalse(testTarget.cleanTime.isOneYearOrMore)1301 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)1302 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1303 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1304 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1305 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1306 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1307 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1308 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1309 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1310 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1311 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1312 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneDay)1313 XCTAssertEqual(testTarget.timeInterval, 518400)1314 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1315 endDate = Self.makeDate(year: 1389, month: 2, day: 2, calendar: calendar)1316 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate, calendar: calendar)1317 XCTAssertEqual(testTarget.cleanTime.totalMonths, 12)1318 XCTAssertEqual(testTarget.cleanTime.totalDays, 371)1319 XCTAssertEqual(testTarget.cleanTime.years, 1)1320 XCTAssertEqual(testTarget.cleanTime.months, 0)1321 XCTAssertEqual(testTarget.cleanTime.days, 6)1322 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1323 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1324 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1325 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1326 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1327 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1328 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1329 XCTAssertFalse(testTarget.cleanTime.isEighteenMonthsOrMore)1330 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1331 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1332 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1333 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1334 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1335 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1336 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1337 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1338 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1339 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1340 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneYear)1341 XCTAssertEqual(testTarget.timeInterval, 32054400)1342 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1389, month: 1, day: 27, calendar: calendar))1343 startDate = Self.makeDate(year: 2018, month: 8, day: 29)1344 endDate = Self.makeDate(year: 2020, month: 4, day: 1)1345 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate, calendar: calendar)1346 XCTAssertEqual(testTarget.cleanTime.totalMonths, 19)1347 XCTAssertEqual(testTarget.cleanTime.totalDays, 581)1348 XCTAssertEqual(testTarget.cleanTime.years, 1)1349 XCTAssertEqual(testTarget.cleanTime.months, 7)1350 XCTAssertEqual(testTarget.cleanTime.days, 3)1351 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1352 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1353 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1354 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1355 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1356 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1357 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1358 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)1359 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1360 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1361 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1362 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1363 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1364 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1365 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1366 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1367 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1368 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1369 XCTAssertEqual(testTarget.lastCleantimeMilestone, .eighteenMonths)1370 XCTAssertEqual(testTarget.timeInterval, 50198400)1371 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 2019, month: 8, day: 29))1372 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1398, month: 6, day: 7, calendar: calendar))1373 startDate = Self.makeDate(year: 1397, month: 6, day: 7, calendar: calendar)1374 endDate = Self.makeDate(year: 2020, month: 4, day: 1)1375 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate, calendar: calendar)1376 XCTAssertEqual(testTarget.cleanTime.totalMonths, 19)1377 XCTAssertEqual(testTarget.cleanTime.totalDays, 581)1378 XCTAssertEqual(testTarget.cleanTime.years, 1)1379 XCTAssertEqual(testTarget.cleanTime.months, 7)1380 XCTAssertEqual(testTarget.cleanTime.days, 3)1381 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1382 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1383 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1384 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1385 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1386 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1387 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1388 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)1389 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1390 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1391 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1392 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1393 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1394 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1395 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1396 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1397 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1398 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1399 XCTAssertEqual(testTarget.lastCleantimeMilestone, .eighteenMonths)1400 XCTAssertEqual(testTarget.timeInterval, 50198400)1401 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 2019, month: 8, day: 29))1402 startDate = Self.makeDate(year: 2018, month: 8, day: 29)1403 endDate = Self.makeDate(year: 1399, month: 1, day: 13, calendar: calendar)1404 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate, calendar: calendar)1405 XCTAssertEqual(testTarget.cleanTime.totalMonths, 19)1406 XCTAssertEqual(testTarget.cleanTime.totalDays, 581)1407 XCTAssertEqual(testTarget.cleanTime.years, 1)1408 XCTAssertEqual(testTarget.cleanTime.months, 7)1409 XCTAssertEqual(testTarget.cleanTime.days, 3)1410 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1411 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1412 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1413 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1414 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1415 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1416 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1417 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)1418 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1419 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1420 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1421 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1422 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1423 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1424 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1425 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1426 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1427 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1428 XCTAssertEqual(testTarget.lastCleantimeMilestone, .eighteenMonths)1429 XCTAssertEqual(testTarget.timeInterval, 50198400)1430 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 2019, month: 8, day: 29))1431 startDate = Self.makeDate(year: 1397, month: 6, day: 7, calendar: calendar)1432 endDate = Self.makeDate(year: 1399, month: 1, day: 13, calendar: calendar)1433 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1434 XCTAssertEqual(testTarget.cleanTime.totalMonths, 19)1435 XCTAssertEqual(testTarget.cleanTime.totalDays, 581)1436 XCTAssertEqual(testTarget.cleanTime.years, 1)1437 XCTAssertEqual(testTarget.cleanTime.months, 7)1438 XCTAssertEqual(testTarget.cleanTime.days, 3)1439 XCTAssertTrue(testTarget.cleanTime.isOneDayOrMore)1440 XCTAssertTrue(testTarget.cleanTime.isThirtyDaysOrMore)1441 XCTAssertTrue(testTarget.cleanTime.isSixtyDaysOrMore)1442 XCTAssertTrue(testTarget.cleanTime.isNinetyDaysOrMore)1443 XCTAssertTrue(testTarget.cleanTime.isSixMonthsOrMore)1444 XCTAssertTrue(testTarget.cleanTime.isNineMonthsOrMore)1445 XCTAssertTrue(testTarget.cleanTime.isOneYearOrMore)1446 XCTAssertTrue(testTarget.cleanTime.isEighteenMonthsOrMore)1447 XCTAssertFalse(testTarget.cleanTime.isTwoOrMoreYears)1448 XCTAssertFalse(testTarget.cleanTime.isFiveOrMoreYears)1449 XCTAssertFalse(testTarget.cleanTime.isTenOrMoreYears)1450 XCTAssertFalse(testTarget.cleanTime.isFifteenOrMoreYears)1451 XCTAssertFalse(testTarget.cleanTime.isTwentyOrMoreYears)1452 XCTAssertFalse(testTarget.cleanTime.isTwentyFiveOrMoreYears)1453 XCTAssertFalse(testTarget.cleanTime.isTenThousandDaysOrMore)1454 XCTAssertFalse(testTarget.cleanTime.isThirtyOrMoreYears)1455 XCTAssertFalse(testTarget.cleanTime.isFortyOrMoreYears)1456 XCTAssertFalse(testTarget.cleanTime.isFiftyOrMoreYears)1457 XCTAssertEqual(testTarget.lastCleantimeMilestone, .eighteenMonths)1458 XCTAssertEqual(testTarget.timeInterval, 50198400)1459 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 2019, month: 8, day: 29))1460 }1461 1462 /* ################################################################## */1463 /**1464 */1465 func testLastCleantimeMilestone() {1466 startDate = Self.makeDate(year: 1952, month: 1, day: 1)1467 endDate = Self.makeDate(year: 1952, month: 1, day: 1)1468 var testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1469 XCTAssertEqual(testTarget.lastCleantimeMilestone, .invalid)1470 XCTAssertNil(testTarget.dateOfLastCleantimeMilestone)1471 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1472 endDate = Self.makeDate(year: 1952, month: 1, day: 2)1473 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1474 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneDay)1475 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 1, day: 2))1476 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1477 endDate = Self.makeDate(year: 1952, month: 1, day: 30)1478 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1479 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneDay)1480 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 1, day: 2))1481 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1482 endDate = Self.makeDate(year: 1952, month: 1, day: 31)1483 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1484 XCTAssertEqual(testTarget.lastCleantimeMilestone, .thirtyDays)1485 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 1, day: 31))1486 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1487 endDate = Self.makeDate(year: 1952, month: 2, day: 1)1488 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1489 XCTAssertEqual(testTarget.lastCleantimeMilestone, .thirtyDays)1490 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 1, day: 31))1491 endDate = Self.makeDate(year: 1952, month: 2, day: 29)1492 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1493 XCTAssertEqual(testTarget.lastCleantimeMilestone, .thirtyDays)1494 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 1, day: 31))1495 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1496 endDate = Self.makeDate(year: 1952, month: 3, day: 1)1497 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1498 XCTAssertEqual(testTarget.lastCleantimeMilestone, .sixtyDays)1499 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 3, day: 1))1500 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1501 endDate = Self.makeDate(year: 1952, month: 3, day: 30)1502 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1503 XCTAssertEqual(testTarget.lastCleantimeMilestone, .sixtyDays)1504 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 3, day: 1))1505 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1506 endDate = Self.makeDate(year: 1952, month: 3, day: 31)1507 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1508 XCTAssertEqual(testTarget.lastCleantimeMilestone, .ninetyDays)1509 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 3, day: 31))1510 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1511 endDate = Self.makeDate(year: 1952, month: 6, day: 30)1512 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1513 XCTAssertEqual(testTarget.lastCleantimeMilestone, .ninetyDays)1514 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 3, day: 31))1515 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1516 endDate = Self.makeDate(year: 1952, month: 7, day: 1)1517 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1518 XCTAssertEqual(testTarget.lastCleantimeMilestone, .sixMonths)1519 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 7, day: 1))1520 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1521 endDate = Self.makeDate(year: 1952, month: 9, day: 1)1522 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1523 XCTAssertEqual(testTarget.lastCleantimeMilestone, .sixMonths)1524 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 7, day: 1))1525 endDate = Self.makeDate(year: 1952, month: 10, day: 1)1526 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1527 XCTAssertEqual(testTarget.lastCleantimeMilestone, .nineMonths)1528 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 10, day: 1))1529 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1530 endDate = Self.makeDate(year: 1952, month: 12, day: 31)1531 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1532 XCTAssertEqual(testTarget.lastCleantimeMilestone, .nineMonths)1533 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 10, day: 1))1534 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1535 endDate = Self.makeDate(year: 1953, month: 1, day: 1)1536 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1537 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneYear)1538 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1953, month: 1, day: 1))1539 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)1540 endDate = Self.makeDate(year: 1953, month: 6, day: 30)1541 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1542 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneYear)1543 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1953, month: 1, day: 1))1544 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1953, month: 1, day: 1))1545 endDate = Self.makeDate(year: 1953, month: 7, day: 1)1546 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1547 XCTAssertEqual(testTarget.lastCleantimeMilestone, .eighteenMonths)1548 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1953, month: 7, day: 1))1549 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1953, month: 1, day: 1))1550 endDate = Self.makeDate(year: 1954, month: 1, day: 1)1551 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1552 XCTAssertEqual(testTarget.lastCleantimeMilestone, .years(numberOfYears: 2))1553 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1954, month: 1, day: 1))1554 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)1555 endDate = Self.makeDate(year: 1955, month: 4, day: 13)1556 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1557 XCTAssertEqual(testTarget.lastCleantimeMilestone, .years(numberOfYears: 3))1558 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1955, month: 1, day: 1))1559 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1955, month: 1, day: 1))1560 endDate = Self.makeDate(year: 1956, month: 12, day: 31)1561 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1562 XCTAssertEqual(testTarget.lastCleantimeMilestone, .years(numberOfYears: 4))1563 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1956, month: 1, day: 1))1564 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1956, month: 1, day: 1))1565 endDate = Self.makeDate(year: 1957, month: 1, day: 1)1566 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1567 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fiveYears)1568 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1957, month: 1, day: 1))1569 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1957, month: 1, day: 1))1570 endDate = Self.makeDate(year: 1957, month: 10, day: 31)1571 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1572 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fiveYears)1573 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1957, month: 1, day: 1))1574 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1957, month: 1, day: 1))1575 endDate = Self.makeDate(year: 1958, month: 1, day: 1)1576 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1577 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fiveYears)1578 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1957, month: 1, day: 1))1579 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)1580 endDate = Self.makeDate(year: 1961, month: 12, day: 31)1581 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1582 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fiveYears)1583 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1957, month: 1, day: 1))1584 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1961, month: 1, day: 1))1585 endDate = Self.makeDate(year: 1962, month: 1, day: 1)1586 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1587 XCTAssertEqual(testTarget.lastCleantimeMilestone, .tenYears)1588 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1962, month: 1, day: 1))1589 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)1590 endDate = Self.makeDate(year: 1966, month: 12, day: 31)1591 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1592 XCTAssertEqual(testTarget.lastCleantimeMilestone, .tenYears)1593 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1962, month: 1, day: 1))1594 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1966, month: 1, day: 1))1595 endDate = Self.makeDate(year: 1967, month: 1, day: 1)1596 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1597 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fifteenYears)1598 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1967, month: 1, day: 1))1599 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)1600 endDate = Self.makeDate(year: 1971, month: 12, day: 31)1601 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1602 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fifteenYears)1603 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1967, month: 1, day: 1))1604 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1971, month: 1, day: 1))1605 endDate = Self.makeDate(year: 1972, month: 1, day: 1)1606 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1607 XCTAssertEqual(testTarget.lastCleantimeMilestone, .twentyYears)1608 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1972, month: 1, day: 1))1609 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)1610 endDate = Self.makeDate(year: 1976, month: 12, day: 31)1611 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1612 XCTAssertEqual(testTarget.lastCleantimeMilestone, .twentyYears)1613 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1972, month: 1, day: 1))1614 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1976, month: 1, day: 1))1615 endDate = Self.makeDate(year: 1977, month: 1, day: 1)1616 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1617 XCTAssertEqual(testTarget.lastCleantimeMilestone, .twentyFiveYears)1618 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1977, month: 1, day: 1))1619 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)1620 endDate = Self.makeDate(year: 1979, month: 5, day: 18)1621 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1622 XCTAssertEqual(testTarget.lastCleantimeMilestone, .twentyFiveYears)1623 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1977, month: 1, day: 1))1624 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1979, month: 1, day: 1))1625 endDate = Self.makeDate(year: 1979, month: 5, day: 20)1626 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1627 XCTAssertEqual(testTarget.lastCleantimeMilestone, .tenThousandDays)1628 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1979, month: 5, day: 19))1629 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1979, month: 1, day: 1))1630 endDate = Self.makeDate(year: 1981, month: 12, day: 31)1631 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1632 XCTAssertEqual(testTarget.lastCleantimeMilestone, .tenThousandDays)1633 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1979, month: 5, day: 19))1634 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1981, month: 1, day: 1))1635 endDate = Self.makeDate(year: 1982, month: 1, day: 1)1636 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1637 XCTAssertEqual(testTarget.lastCleantimeMilestone, .thirtyYears)1638 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1982, month: 1, day: 1))1639 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)1640 endDate = Self.makeDate(year: 1991, month: 12, day: 31)1641 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1642 XCTAssertEqual(testTarget.lastCleantimeMilestone, .thirtyYears)1643 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1982, month: 1, day: 1))1644 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1991, month: 1, day: 1))1645 endDate = Self.makeDate(year: 1992, month: 1, day: 1)1646 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1647 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fortyYears)1648 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1992, month: 1, day: 1))1649 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 1992, month: 1, day: 1))1650 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)1651 endDate = Self.makeDate(year: 2222, month: 1, day: 1)1652 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1653 XCTAssertEqual(testTarget.lastCleantimeMilestone, .fortyYears)1654 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.oneDay), Self.makeDate(year: 1952, month: 1, day: 2))1655 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.thirtyDays), Self.makeDate(year: 1952, month: 1, day: 31))1656 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.sixtyDays), Self.makeDate(year: 1952, month: 3, day: 1))1657 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.ninetyDays), Self.makeDate(year: 1952, month: 3, day: 31))1658 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.sixMonths), Self.makeDate(year: 1952, month: 7, day: 1))1659 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.nineMonths), Self.makeDate(year: 1952, month: 10, day: 1))1660 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.oneYear), Self.makeDate(year: 1953, month: 1, day: 1))1661 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.eighteenMonths), Self.makeDate(year: 1953, month: 7, day: 1))1662 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.years(numberOfYears: 2)), Self.makeDate(year: 1954, month: 1, day: 1))1663 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.years(numberOfYears: 3)), Self.makeDate(year: 1955, month: 1, day: 1))1664 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.years(numberOfYears: 4)), Self.makeDate(year: 1956, month: 1, day: 1))1665 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.fiveYears), Self.makeDate(year: 1957, month: 1, day: 1))1666 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.tenYears), Self.makeDate(year: 1962, month: 1, day: 1))1667 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.fifteenYears), Self.makeDate(year: 1967, month: 1, day: 1))1668 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.twentyYears), Self.makeDate(year: 1972, month: 1, day: 1))1669 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.twentyFiveYears), Self.makeDate(year: 1977, month: 1, day: 1))1670 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.tenThousandDays), Self.makeDate(year: 1979, month: 5, day: 19))1671 XCTAssertEqual(testTarget.dateOfThisCleantimeMilestone(.thirtyYears), Self.makeDate(year: 1982, month: 1, day: 1))1672 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1992, month: 1, day: 1))1673 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, Self.makeDate(year: 2222, month: 1, day: 1))1674 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)1675 startDate = Self.makeDate(year: 1952, month: 2, day: 29)1676 endDate = Self.makeDate(year: 1953, month: 2, day: 27)1677 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1678 XCTAssertEqual(testTarget.lastCleantimeMilestone, .nineMonths)1679 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1952, month: 11, day: 29))1680 XCTAssertNil(testTarget.dateOfLastAnnualMilestone)1681 endDate = Self.makeDate(year: 1953, month: 2, day: 28)1682 testTarget = LGV_CleantimeDateCalc(startDate: startDate, endDate: endDate)1683 XCTAssertEqual(testTarget.lastCleantimeMilestone, .oneYear)1684 XCTAssertEqual(testTarget.dateOfLastCleantimeMilestone, Self.makeDate(year: 1953, month: 2, day: 28))1685 XCTAssertEqual(testTarget.dateOfLastAnnualMilestone, endDate)1686 }1687}...
PrimitiveTypeTests.swift
Source:PrimitiveTypeTests.swift
...10class PrimitiveTypeTests: XCTestCase {11 12 // Mark: Bool13 func testBool() {14 typealias TestTarget = Bool15 XCTAssertEqual(true, try! TestTarget.decode(any: true))16 XCTAssertEqual(true, try! TestTarget.decode(any: "true"))17 XCTAssertEqual(false, try! TestTarget.decode(any: false))18 XCTAssertEqual(false, try! TestTarget.decode(any: "false"))19 XCTAssertNil(try? TestTarget.decode(any: nil))20 }21 22 23 // Mark: Int24 func testInt8() {25 typealias TestTarget = Int826 27 // upper bound28 let max:TestTarget = 0x7F29 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: max))30 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: TestTarget.max))31 32 // lower bound33 let min:TestTarget = -12834 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: min))35 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: TestTarget.min))36 37 XCTAssertEqual(1, try! TestTarget.decode(any: "1"))38 XCTAssertNil(try? TestTarget.decode(any: nil))39 }40 41 func testInt16() {42 typealias TestTarget = Int1643 44 // upper bound45 let max:TestTarget = 0x7FFF46 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: max))47 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: TestTarget.max))48 49 // lower bound50 let min:TestTarget = -3276851 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: min))52 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: TestTarget.min))53 54 XCTAssertEqual(1, try! TestTarget.decode(any: "1"))55 XCTAssertNil(try? TestTarget.decode(any: nil))56 }57 func testInt32() {58 typealias TestTarget = Int3259 60 // upper bound61 let max:TestTarget = 214748364762 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: max))63 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: TestTarget.max))64 65 // lower bound66 let min:TestTarget = -214748364867 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: min))68 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: TestTarget.min))69 70 XCTAssertEqual(1, try! TestTarget.decode(any: "1"))71 XCTAssertNil(try? TestTarget.decode(any: nil))72 }73 func testInt64() {74 typealias TestTarget = Int6475 76 // upper bound77 let max:TestTarget = 0x7FFFFFFF_FFFFFFFF78 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: max))79 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: TestTarget.max))80 81 // lower bound82 let min:TestTarget = -922337203685477580883 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: min))84 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: TestTarget.min))85 86 XCTAssertEqual(1, try! TestTarget.decode(any: "1"))87 XCTAssertNil(try? TestTarget.decode(any: nil))88 }89 90 91 // Mark: UInt92 func testUInt8() {93 typealias TestTarget = UInt894 95 // upper bound96 let max:TestTarget = 0xFF97 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: max))98 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: TestTarget.max))99 100 // lower bound101 let min:TestTarget = 0102 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: min))103 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: TestTarget.min))104 105 XCTAssertEqual(1, try! TestTarget.decode(any: "1"))106 XCTAssertNil(try? TestTarget.decode(any: nil))107 }108 func testUInt16() {109 typealias TestTarget = UInt16110 111 // upper bound112 let max:TestTarget = 0xFFFF113 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: max))114 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: TestTarget.max))115 116 // lower bound117 let min:TestTarget = 0118 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: min))119 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: TestTarget.min))120 121 XCTAssertEqual(1, try! TestTarget.decode(any: "1"))122 XCTAssertNil(try? TestTarget.decode(any: nil))123 }124 func testUInt32() {125 typealias TestTarget = UInt32126 127 // upper bound128 let max:TestTarget = 0xFFFFFFFF129 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: max))130 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: TestTarget.max))131 132 // lower bound133 let min:TestTarget = 0134 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: min))135 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: TestTarget.min))136 137 XCTAssertEqual(1, try! TestTarget.decode(any: "1"))138 XCTAssertNil(try? TestTarget.decode(any: nil))139 }140 func testUInt64() {141 typealias TestTarget = UInt64142 143 // upper bound144 let max:TestTarget = 0xFFFFFFFF_FFFFFFFF145 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: max))146 XCTAssertEqual(TestTarget.max, try! TestTarget.decode(any: TestTarget.max))147 148 // lower bound149 let min:TestTarget = 0150 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: min))151 XCTAssertEqual(TestTarget.min, try! TestTarget.decode(any: TestTarget.min))152 153 XCTAssertEqual(1, try! TestTarget.decode(any: "1"))154 XCTAssertNil(try? TestTarget.decode(any: nil))155 }156 157 158 // MARK: Float159 func testFloat() {160 typealias TestTarget = Float161 let target: Float = 1.0162 XCTAssertEqual(target, try! TestTarget.decode(any: target))163 XCTAssertEqual(target, try! TestTarget.decode(any: "1.0"))164 XCTAssertNil(try? TestTarget.decode(any: nil))165 }166 167 func testDouble() {168 typealias TestTarget = Double169 XCTAssertEqual(1.0, try! TestTarget.decode(any: 1.0))170 XCTAssertEqual(1.0, try! TestTarget.decode(any: "1.0"))171 XCTAssertNil(try? TestTarget.decode(any: nil))172 }173 174 func testString() {175 XCTAssertEqual("1", try! String.decode(any: 1))176 XCTAssertEqual("true", try! String.decode(any: true))177 XCTAssertEqual("1.2", try! String.decode(any: 1.2))178 XCTAssertNil(try? String.decode(any: nil))179 }180 181 //extension URL:PrimitiveType {}182 183}...
TestTarget
Using AI Code Generation
1import MockingbirdTests2let testTarget = TestTarget()3testTarget.test()4import MockingbirdTests5let testTarget = TestTarget()6testTarget.test()7import MockingbirdTests8let testTarget = TestTarget()9testTarget.test()
TestTarget
Using AI Code Generation
1import MockingbirdTests2class MockingbirdTests: XCTestCase {3 func testExample() {4 let testTarget = TestTarget()5 XCTAssertEqual(testTarget.test(), 1)6 }7}8import MockingbirdTests9class MockingbirdTests: XCTestCase {10 func testExample() {11 let testTarget = TestTarget()12 XCTAssertEqual(testTarget.test(), 1)13 }14}
TestTarget
Using AI Code Generation
1import MockingbirdTests2let testTarget = TestTarget()3testTarget.printHello()4import MockingbirdTests5let testTarget = TestTarget()6testTarget.printHello()7The module name is only used when importing
TestTarget
Using AI Code Generation
1let testTarget = TestTarget()2testTarget.doSomething()3let testTarget = TestTarget()4testTarget.doSomething()5let testTarget = TestTarget()6testTarget.doSomething()7let testTarget = TestTarget()8testTarget.doSomething()9let testTarget = TestTarget()10testTarget.doSomething()11let testTarget = TestTarget()12testTarget.doSomething()
TestTarget
Using AI Code Generation
1import MockingbirdTests2class TestClass {3 let testTarget = TestTarget()4 func testMethod() {5 testTarget.method()6 }7}8import MockingbirdTests9class TestClass2 {10 let testTarget = TestTarget()11 func testMethod() {12 testTarget.method()13 }14}15import MockingbirdTests16class TestClass3 {17 let testTarget = TestTarget()18 func testMethod() {19 testTarget.method()20 }21}22import MockingbirdTests23class TestClass4 {24 let testTarget = TestTarget()25 func testMethod() {26 testTarget.method()27 }28}29import MockingbirdTests30class TestClass5 {31 let testTarget = TestTarget()32 func testMethod() {33 testTarget.method()34 }35}36import MockingbirdTests37class TestClass6 {38 let testTarget = TestTarget()39 func testMethod() {40 testTarget.method()41 }42}43import MockingbirdTests44class TestClass7 {45 let testTarget = TestTarget()46 func testMethod() {47 testTarget.method()48 }49}50import MockingbirdTests51class TestClass8 {52 let testTarget = TestTarget()53 func testMethod() {54 testTarget.method()55 }56}57import MockingbirdTests58class TestClass9 {59 let testTarget = TestTarget()60 func testMethod() {61 testTarget.method()62 }63}64import MockingbirdTests65class TestClass10 {66 let testTarget = TestTarget()
TestTarget
Using AI Code Generation
1import Mockingbird2@testable import MockingbirdTests3func testFunc() {4 let testTarget = TestTarget()5 testTarget.testFunc()6}7import Mockingbird8@testable import MockingbirdTests9func testFunc() {10 let testTarget = TestTarget()11 testTarget.testFunc()12}13import Mockingbird14@testable import MockingbirdTests15func testFunc() {16 let testTarget = TestTarget()17 testTarget.testFunc()18}19import Mockingbird20@testable import MockingbirdTests21func testFunc() {22 let testTarget = TestTarget()23 testTarget.testFunc()24}25import Mockingbird26@testable import MockingbirdTests27func testFunc() {28 let testTarget = TestTarget()29 testTarget.testFunc()30}31import Mockingbird32@testable import MockingbirdTests33func testFunc() {34 let testTarget = TestTarget()35 testTarget.testFunc()36}37import Mockingbird38@testable import MockingbirdTests39func testFunc() {40 let testTarget = TestTarget()41 testTarget.testFunc()42}43import Mockingbird44@testable import MockingbirdTests45func testFunc() {46 let testTarget = TestTarget()47 testTarget.testFunc()48}49import Mockingbird50@testable import MockingbirdTests51func testFunc() {52 let testTarget = TestTarget()53 testTarget.testFunc()54}55import Mockingbird56@testable import MockingbirdTests57func testFunc() {58 let testTarget = TestTarget()
TestTarget
Using AI Code Generation
1import MockingbirdTests2class MyTest {3 func test() {4 let testTarget = TestTarget()5 testTarget.methodToTest()6 }7}8import MockingbirdTests9class MyTest {10 func test() {11 let testTarget = TestTarget()12 testTarget.methodToTest()13 }14}15import MockingbirdTests16class MyTest {17 func test() {18 let testTarget = TestTarget()19 testTarget.methodToTest()20 }21}22struct Request {23}24extension Request {25 func asURLRequest() throws -> URLRequest {26 var urlRequest = URLRequest(url: url)27 urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type")28 urlRequest.setValue("application/json", forHTTPHeaderField: "Accept")29 if let parameters = parameters {30 do {31 urlRequest.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: [])32 } catch {33 throw AFError.parameterEncodingFailed(reason: .jsonEncodingFailed(error: error))34 }35 }36 }37}38import Mockingbird39import Alamofire40protocol RequestProtocol {41 var url: URL { get }42 var method: HTTPMethod { get }43 var parameters: Parameters? { get }44 var headers: HTTPHeaders? { get }45}46extension Request: RequestProtocol {}47protocol RequestMock: RequestProtocol, Mock {48 var url: URL { get }49 var method: HTTPMethod { get }50 var parameters: Parameters? { get }51 var headers: HTTPHeaders? { get }52}53class RequestMockImpl: RequestMock {
TestTarget
Using AI Code Generation
1import XCTest2import MockingbirdTest3class TestTargetTests: XCTestCase {4 func testTarget() {5 let target = TestTarget()6 XCTAssertEqual(target.test(), 1)7 }8}9import XCTest10import MockingbirdTest11class TestTargetTests: XCTestCase {12 func testTarget() {13 let target = TestTarget()14 XCTAssertEqual(target.test(), 1)15 }16}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!