You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB

5 years ago
  1. //
  2. // FunctionTest.swift
  3. // GMERemittanceTests
  4. //
  5. // Created by InKwon Devik Kim on 09/07/2019.
  6. // Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import XCTest
  9. @testable import GME_Remit
  10. class FunctionTest: XCTestCase {
  11. func testExpireDate() {
  12. guard let remindDay = Utility.calculateDDay(registDate: "7/12/2018 4:19:37 PM")
  13. else {
  14. XCTAssert(false)
  15. return
  16. }
  17. print("remindDay: \(remindDay)")
  18. XCTAssert(true)
  19. }
  20. func testDateFormat() {
  21. let dateFormatter = DateFormatter()
  22. dateFormatter.dateFormat = "M/d/yyyy h:mm:ss a"
  23. dateFormatter.locale = Locale(identifier: "ko_kr")
  24. dateFormatter.timeZone = TimeZone(abbreviation: "KST")
  25. var dateComponent = DateComponents()
  26. dateComponent.year = 1
  27. let resigstDate = "7/11/2019 4:19:37 PM"
  28. guard
  29. let date = dateFormatter.date(from: resigstDate) else {
  30. XCTAssert(false)
  31. return
  32. }
  33. print("Date: \(date)")
  34. }
  35. func testIDValid() {
  36. let extractID = "l.e ibn$iz@55_good-)(*&".extract(regex: "[A-Z0-9a-z._@-]")
  37. print("Extract ID: \(extractID)")
  38. XCTAssertEqual(extractID, "l.eibniz@55_good-")
  39. }
  40. }