SettingsVCTest.swift 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. //
  2. // SettingsVCTest.swift
  3. // SettingsVCTest
  4. //
  5. // Created by Marcus Rohrmoser on 23.04.20.
  6. // Copyright © 2020-2022 Marcus Rohrmoser mobile Software http://mro.name/me. All rights reserved.
  7. //
  8. // This program is free software: you can redistribute it and/or modify
  9. // it under the terms of the GNU General Public License as published by
  10. // the Free Software Foundation, either version 3 of the License, or
  11. // (at your option) any later version.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU General Public License
  19. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. //
  21. import XCTest
  22. @testable import ShaarliOS
  23. class SettingsVCTest: XCTestCase {
  24. override func setUp() {
  25. // Put setup code here. This method is called before the invocation of each test method in the class.
  26. }
  27. override func tearDown() {
  28. // Put teardown code here. This method is called after the invocation of each test method in the class.
  29. }
  30. func testPerformanceExample() {
  31. // This is an example of a performance test case.
  32. self.measure {
  33. // Put the code you want to measure the time of here.
  34. }
  35. }
  36. func testEndpoints() {
  37. for txt in [
  38. "https://demo.0x4c.de/shaarli-v0.41b",
  39. "http://demo.0x4c.de/shaarli-v0.41b",
  40. "//demo.0x4c.de/shaarli-v0.41b",
  41. "demo.0x4c.de/shaarli-v0.41b",
  42. "demo.0x4c.de/shaarli-v0.41b",
  43. ] {
  44. let ep = endpoints(txt, "demo", "demodemodemo")
  45. XCTAssertEqual(4, ep.count)
  46. XCTAssertEqual([
  47. "https://demo:demodemodemo@demo.0x4c.de/shaarli-v0.41b",
  48. "http://demo:demodemodemo@demo.0x4c.de/shaarli-v0.41b",
  49. "https://demo:demodemodemo@demo.0x4c.de/shaarli-v0.41b/index.php",
  50. "http://demo:demodemodemo@demo.0x4c.de/shaarli-v0.41b/index.php"
  51. ], ep.map({ $0.absoluteString }))
  52. }
  53. for txt in [
  54. "https://demo.0x4c.de/shaarli-v0.41b/",
  55. "http://demo.0x4c.de/shaarli-v0.41b/",
  56. "//demo.0x4c.de/shaarli-v0.41b/",
  57. "demo.0x4c.de/shaarli-v0.41b/",
  58. "demo.0x4c.de/shaarli-v0.41b/",
  59. ] {
  60. let ep = endpoints(txt, "demo", "demodemodemo")
  61. XCTAssertEqual(4, ep.count)
  62. XCTAssertEqual([
  63. "https://demo:demodemodemo@demo.0x4c.de/shaarli-v0.41b/",
  64. "http://demo:demodemodemo@demo.0x4c.de/shaarli-v0.41b/",
  65. "https://demo:demodemodemo@demo.0x4c.de/shaarli-v0.41b/index.php",
  66. "http://demo:demodemodemo@demo.0x4c.de/shaarli-v0.41b/index.php"
  67. ], ep.map({ $0.absoluteString }))
  68. }
  69. }
  70. }