diff --git a/Example/MuslimData.xcodeproj/project.pbxproj b/Example/MuslimData.xcodeproj/project.pbxproj index 1968790..e44d3d7 100755 --- a/Example/MuslimData.xcodeproj/project.pbxproj +++ b/Example/MuslimData.xcodeproj/project.pbxproj @@ -10,6 +10,9 @@ 2D110EDE216BE7FB002035FA /* PrayerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D110EDD216BE7FB002035FA /* PrayerTests.swift */; }; 2D27AC4B2188E621004722BD /* LocationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D27AC4A2188E621004722BD /* LocationViewController.swift */; }; 2D4558BA21694A5200A08DAF /* LocationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D4558B921694A5200A08DAF /* LocationTests.swift */; }; + 2D4EC4D42B835D7C00F08DCB /* IQCityMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D4EC4D32B835D7C00F08DCB /* IQCityMapperTests.swift */; }; + 2D4EC4D72B83637A00F08DCB /* IRCityMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D4EC4D62B83637A00F08DCB /* IRCityMapperTests.swift */; }; + 2D4EC4D92B83639E00F08DCB /* KWCityMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D4EC4D82B83639E00F08DCB /* KWCityMapperTests.swift */; }; 2D6B21C421708D600054F8C0 /* NamesTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D6B21C321708D600054F8C0 /* NamesTest.swift */; }; 2D9FC355217278E0003EF074 /* AzkarTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D9FC354217278E0003EF074 /* AzkarTests.swift */; }; 2DBD7E7B218E01AF00B6595B /* AzkarChaptersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DBD7E7A218E01AF00B6595B /* AzkarChaptersViewController.swift */; }; @@ -40,6 +43,9 @@ 2D110EDD216BE7FB002035FA /* PrayerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrayerTests.swift; sourceTree = ""; }; 2D27AC4A2188E621004722BD /* LocationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationViewController.swift; sourceTree = ""; }; 2D4558B921694A5200A08DAF /* LocationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationTests.swift; sourceTree = ""; }; + 2D4EC4D32B835D7C00F08DCB /* IQCityMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IQCityMapperTests.swift; sourceTree = ""; }; + 2D4EC4D62B83637A00F08DCB /* IRCityMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IRCityMapperTests.swift; sourceTree = ""; }; + 2D4EC4D82B83639E00F08DCB /* KWCityMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KWCityMapperTests.swift; sourceTree = ""; }; 2D6B21C321708D600054F8C0 /* NamesTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NamesTest.swift; sourceTree = ""; }; 2D9FC354217278E0003EF074 /* AzkarTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AzkarTests.swift; sourceTree = ""; }; 2DBD7E7A218E01AF00B6595B /* AzkarChaptersViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AzkarChaptersViewController.swift; sourceTree = ""; }; @@ -96,6 +102,16 @@ name = Pods; sourceTree = ""; }; + 2D4EC4D52B83634200F08DCB /* CityMapperTests */ = { + isa = PBXGroup; + children = ( + 2D4EC4D32B835D7C00F08DCB /* IQCityMapperTests.swift */, + 2D4EC4D62B83637A00F08DCB /* IRCityMapperTests.swift */, + 2D4EC4D82B83639E00F08DCB /* KWCityMapperTests.swift */, + ); + path = CityMapperTests; + sourceTree = ""; + }; 2DBD7E7C218E01BF00B6595B /* Azkars */ = { isa = PBXGroup; children = ( @@ -196,6 +212,7 @@ 607FACE81AFB9204008FA782 /* Tests */ = { isa = PBXGroup; children = ( + 2D4EC4D52B83634200F08DCB /* CityMapperTests */, 2D9FC354217278E0003EF074 /* AzkarTests.swift */, 2D6B21C321708D600054F8C0 /* NamesTest.swift */, 2D110EDD216BE7FB002035FA /* PrayerTests.swift */, @@ -445,9 +462,12 @@ buildActionMask = 2147483647; files = ( 2D110EDE216BE7FB002035FA /* PrayerTests.swift in Sources */, + 2D4EC4D92B83639E00F08DCB /* KWCityMapperTests.swift in Sources */, 2D6B21C421708D600054F8C0 /* NamesTest.swift in Sources */, 2D4558BA21694A5200A08DAF /* LocationTests.swift in Sources */, 2D9FC355217278E0003EF074 /* AzkarTests.swift in Sources */, + 2D4EC4D72B83637A00F08DCB /* IRCityMapperTests.swift in Sources */, + 2D4EC4D42B835D7C00F08DCB /* IQCityMapperTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -596,7 +616,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = 4HFFW4423Q; INFOPLIST_FILE = MuslimData/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -615,7 +635,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = 4HFFW4423Q; INFOPLIST_FILE = MuslimData/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -641,7 +661,7 @@ "$(inherited)", ); INFOPLIST_FILE = Tests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -664,7 +684,7 @@ "$(inherited)", ); INFOPLIST_FILE = Tests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index e5cb8c5..9c6c0b5 100755 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -36,7 +36,7 @@ 2A050272F5AA9419EACC2B68583FBF0C /* StatementAuthorizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = A83D32E01380A9B4A0B3817B6B914A51 /* StatementAuthorizer.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; 2B130AEAB2EE4BD7997DB369572A684A /* FetchableRecord+TableRecord.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2058FFAD3AA3F5F1DA38DAB365079462 /* FetchableRecord+TableRecord.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; 2D0F97A52B813E8B003D46C5 /* CHANGELOG.md in Resources */ = {isa = PBXBuildFile; fileRef = 2D0F97A42B813E8B003D46C5 /* CHANGELOG.md */; }; - 2D6CD44729CC5BF2009B527C /* muslim_db_v1.3.3.db in Resources */ = {isa = PBXBuildFile; fileRef = 2D6CD44629CC5BF2009B527C /* muslim_db_v1.3.3.db */; }; + 2D6CD44729CC5BF2009B527C /* muslim_db_v1.4.0.db in Resources */ = {isa = PBXBuildFile; fileRef = 2D6CD44629CC5BF2009B527C /* muslim_db_v1.4.0.db */; }; 2DAF0C709FAF6D288751DB00EB06B40C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7FD7232797ACF3F6F7685B58BCDC00C7 /* Foundation.framework */; }; 318B2D4FBE83F08BB67C2AA6A52977AB /* FTS5+QueryInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5779BFB97BB16F7C257E39CD28630594 /* FTS5+QueryInterface.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; 33FDF2697ECE2E34513CACBC1EDFDB51 /* DatabaseValueConvertible+RawRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1585FD241A9AC0D79B3E084E1A8B7B77 /* DatabaseValueConvertible+RawRepresentable.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; @@ -229,7 +229,7 @@ 2BC5D21AC275156EB1E637182C566346 /* MuslimData.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = MuslimData.modulemap; sourceTree = ""; }; 2C8D1DE939367A8362484A58B33EB6DE /* DatabaseSnapshot.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DatabaseSnapshot.swift; path = GRDB/Core/DatabaseSnapshot.swift; sourceTree = ""; }; 2D0F97A42B813E8B003D46C5 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = CHANGELOG.md; path = MuslimData/Assets/CHANGELOG.md; sourceTree = ""; }; - 2D6CD44629CC5BF2009B527C /* muslim_db_v1.3.3.db */ = {isa = PBXFileReference; lastKnownFileType = file; name = muslim_db_v1.3.3.db; path = MuslimData/Assets/muslim_db_v1.3.3.db; sourceTree = ""; }; + 2D6CD44629CC5BF2009B527C /* muslim_db_v1.4.0.db */ = {isa = PBXFileReference; lastKnownFileType = file; name = muslim_db_v1.4.0.db; path = MuslimData/Assets/muslim_db_v1.4.0.db; sourceTree = ""; }; 2DC6A83C7FE2580E3F2A1AFBB2B117E6 /* PrayerAttribute.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = PrayerAttribute.swift; sourceTree = ""; }; 2E88CF46329DBA47B53B98F005E11EE3 /* MuslimData.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MuslimData.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2F75C56ED8BD1951FC8172C608B20303 /* Pods-MuslimData_Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-MuslimData_Example-acknowledgements.plist"; sourceTree = ""; }; @@ -756,7 +756,7 @@ CF862A95B5D3FFC023257833F1193CE5 /* Resources */ = { isa = PBXGroup; children = ( - 2D6CD44629CC5BF2009B527C /* muslim_db_v1.3.3.db */, + 2D6CD44629CC5BF2009B527C /* muslim_db_v1.4.0.db */, 3A3F05D7AA5BB40DB61D702ECFAACD79 /* cityMapper.json */, 2D0F97A42B813E8B003D46C5 /* CHANGELOG.md */, ); @@ -968,7 +968,7 @@ files = ( 2D0F97A52B813E8B003D46C5 /* CHANGELOG.md in Resources */, 34B4EB735E3756C6399E9137529EE8BF /* cityMapper.json in Resources */, - 2D6CD44729CC5BF2009B527C /* muslim_db_v1.3.3.db in Resources */, + 2D6CD44729CC5BF2009B527C /* muslim_db_v1.4.0.db in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Example/Tests/CityMapperTests/IQCityMapperTests.swift b/Example/Tests/CityMapperTests/IQCityMapperTests.swift new file mode 100644 index 0000000..6f7466f --- /dev/null +++ b/Example/Tests/CityMapperTests/IQCityMapperTests.swift @@ -0,0 +1,152 @@ +// +// IQCityMapperTests.swift +// MuslimData_Tests +// +// Created by Kosrat Ahmed on 19/02/2024. +// Copyright © 2024 CocoaPods. All rights reserved. +// + +import XCTest +@testable import MuslimData + +class IQCityMapperTests: XCTestCase { + + override func setUp() { + super.setUp() + } + + override func tearDown() { + super.tearDown() + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testDuhokCityMapper() { + XCTAssertEqual("Sumel".mapper(countryCode: "IQ"), "Duhok") + XCTAssertEqual("Zawita".mapper(countryCode: "IQ"), "Duhok") + XCTAssertEqual("Atrish".mapper(countryCode: "IQ"), "Duhok") + XCTAssertEqual("Sharya".mapper(countryCode: "IQ"), "Duhok") + XCTAssertEqual("Mrebah".mapper(countryCode: "IQ"), "Duhok") + } + + func testAkreCityMapper() { + XCTAssertEqual("Amedi".mapper(countryCode: "IQ"), "Akre") + XCTAssertEqual("Sulav".mapper(countryCode: "IQ"), "Akre") + XCTAssertEqual("Kani".mapper(countryCode: "IQ"), "Akre") + XCTAssertEqual("Sheladiz".mapper(countryCode: "IQ"), "Akre") + XCTAssertEqual("Barzan".mapper(countryCode: "IQ"), "Akre") + XCTAssertEqual("Bele".mapper(countryCode: "IQ"), "Akre") + XCTAssertEqual("Shanidar".mapper(countryCode: "IQ"), "Akre") + XCTAssertEqual("Bujal".mapper(countryCode: "IQ"), "Akre") + XCTAssertEqual("Mergin".mapper(countryCode: "IQ"), "Akre") + XCTAssertEqual("Susna".mapper(countryCode: "IQ"), "Akre") + XCTAssertEqual("Sersink".mapper(countryCode: "IQ"), "Akre") + } + + func testBardarashCityMapper() { + XCTAssertEqual("Mamuzin".mapper(countryCode: "IQ"), "Bardarash") + } + + func testErbilCityMapper() { + XCTAssertEqual("Kalak".mapper(countryCode: "IQ"), "Erbil") + XCTAssertEqual("Pirmam".mapper(countryCode: "IQ"), "Erbil") + XCTAssertEqual("Shaqlawa".mapper(countryCode: "IQ"), "Erbil") + XCTAssertEqual("Harir".mapper(countryCode: "IQ"), "Erbil") + XCTAssertEqual("Khalifan".mapper(countryCode: "IQ"), "Erbil") + XCTAssertEqual("Rawanduz".mapper(countryCode: "IQ"), "Erbil") + XCTAssertEqual("Soran".mapper(countryCode: "IQ"), "Erbil") + XCTAssertEqual("Mergasur".mapper(countryCode: "IQ"), "Erbil") + XCTAssertEqual("Galala".mapper(countryCode: "IQ"), "Erbil") + XCTAssertEqual("Choman".mapper(countryCode: "IQ"), "Erbil") + XCTAssertEqual("Hiran".mapper(countryCode: "IQ"), "Erbil") + XCTAssertEqual("Qushtapa".mapper(countryCode: "IQ"), "Erbil") + XCTAssertEqual("Kasnazan".mapper(countryCode: "IQ"), "Erbil") + } + + func testQasreCityMapper() { + XCTAssertEqual("Wallze".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Soraban".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Shnawa".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Rashdur".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Makosan".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Saya".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Walash".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Eskawa".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Xazena".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Dilman".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Sarkan".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Chomsak".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Qalat".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Koila".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Mawnan".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Wasan".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Choma".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Mergay Khwaru".mapper(countryCode: "IQ"), "Qasre") + XCTAssertEqual("Kani bast".mapper(countryCode: "IQ"), "Qasre") + } + + func testKirkukCityMapper() { + XCTAssertEqual("Taza Khurmatu".mapper(countryCode: "IQ"), "Kirkuk") + } + + func testSulaymaniyahCityMapper() { + XCTAssertEqual("Mawat".mapper(countryCode: "IQ"), "Sulaymaniyah") + XCTAssertEqual("Arbat".mapper(countryCode: "IQ"), "Sulaymaniyah") + } + + func testQaladizaCityMapper() { + XCTAssertEqual("Halsho".mapper(countryCode: "IQ"), "Qaladiza") + XCTAssertEqual("Nawdasht".mapper(countryCode: "IQ"), "Qaladiza") + XCTAssertEqual("Tasluja".mapper(countryCode: "IQ"), "Qaladiza") + XCTAssertEqual("Bazian".mapper(countryCode: "IQ"), "Qaladiza") + XCTAssertEqual("Sangasar".mapper(countryCode: "IQ"), "Qaladiza") + XCTAssertEqual("Zharawa".mapper(countryCode: "IQ"), "Qaladiza") + XCTAssertEqual("Bngrd".mapper(countryCode: "IQ"), "Qaladiza") + XCTAssertEqual("Hero".mapper(countryCode: "IQ"), "Qaladiza") + } + + func testDokanCityMapper() { + XCTAssertEqual("Piramagroon".mapper(countryCode: "IQ"), "Dokan") + } + + func testRanyaCityMapper() { + XCTAssertEqual("Hajiawa".mapper(countryCode: "IQ"), "Ranya") + XCTAssertEqual("Sarkapkan".mapper(countryCode: "IQ"), "Ranya") + XCTAssertEqual("Khalakan".mapper(countryCode: "IQ"), "Ranya") + XCTAssertEqual("Taqtaq".mapper(countryCode: "IQ"), "Ranya") + XCTAssertEqual("Hizop".mapper(countryCode: "IQ"), "Ranya") + XCTAssertEqual("Chwarqurna".mapper(countryCode: "IQ"), "Ranya") + } + + func testChamchamalCityMapper() { + XCTAssertEqual("Takiya".mapper(countryCode: "IQ"), "Chamchamal") + XCTAssertEqual("Takiay Jabari".mapper(countryCode: "IQ"), "Chamchamal") + XCTAssertEqual("Shorsh".mapper(countryCode: "IQ"), "Chamchamal") + XCTAssertEqual("Aghjalar".mapper(countryCode: "IQ"), "Chamchamal") + XCTAssertEqual("Sangaw".mapper(countryCode: "IQ"), "Chamchamal") + } + + func testDarbandikhanCityMapper() { + XCTAssertEqual("Zalan".mapper(countryCode: "IQ"), "Darbandikhan") + XCTAssertEqual("Gapilon".mapper(countryCode: "IQ"), "Darbandikhan") + XCTAssertEqual("Chwarta".mapper(countryCode: "IQ"), "Darbandikhan") + XCTAssertEqual("Barzinjah".mapper(countryCode: "IQ"), "Darbandikhan") + XCTAssertEqual("Zarayan".mapper(countryCode: "IQ"), "Darbandikhan") + XCTAssertEqual("Halebjai Taza".mapper(countryCode: "IQ"), "Darbandikhan") + XCTAssertEqual("Qara Dagh".mapper(countryCode: "IQ"), "Darbandikhan") + } + + func testPenjwenCityMapper() { + XCTAssertEqual("Garmk".mapper(countryCode: "IQ"), "Penjwen") + XCTAssertEqual("Nalparez".mapper(countryCode: "IQ"), "Penjwen") + XCTAssertEqual("Said Sadiq".mapper(countryCode: "IQ"), "Penjwen") + XCTAssertEqual("Pshta".mapper(countryCode: "IQ"), "Penjwen") + } + + func testHalabjaCityMapper() { + XCTAssertEqual("Sirwan".mapper(countryCode: "IQ"), "Halabja") + XCTAssertEqual("Byara".mapper(countryCode: "IQ"), "Halabja") + XCTAssertEqual("Tawella".mapper(countryCode: "IQ"), "Halabja") + XCTAssertEqual("Balkha".mapper(countryCode: "IQ"), "Halabja") + XCTAssertEqual("Khurmal".mapper(countryCode: "IQ"), "Halabja") + } +} diff --git a/Example/Tests/CityMapperTests/IRCityMapperTests.swift b/Example/Tests/CityMapperTests/IRCityMapperTests.swift new file mode 100644 index 0000000..2124a27 --- /dev/null +++ b/Example/Tests/CityMapperTests/IRCityMapperTests.swift @@ -0,0 +1,34 @@ +// +// IRCityMapperTests.swift +// MuslimData_Tests +// +// Created by Kosrat Ahmed on 19/02/2024. +// Copyright © 2024 CocoaPods. All rights reserved. +// + +import XCTest +@testable import MuslimData + +class IRCityMapperTests: XCTestCase { + + override func setUp() { + super.setUp() + } + + override func tearDown() { + super.tearDown() + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + + func testSanandajCityMapper() { + XCTAssertEqual("Kamyaran".mapper(countryCode: "IR"), "Sanandaj") + XCTAssertEqual("Divandarreh".mapper(countryCode: "IR"), "Sanandaj") + XCTAssertEqual("Dehgolan".mapper(countryCode: "IR"), "Sanandaj") + XCTAssertEqual("Qorveh".mapper(countryCode: "IR"), "Sanandaj") + } + + func testUrmiaCityMapper() { + XCTAssertEqual("Orumiyeh".mapper(countryCode: "IR"), "Urmia") + } +} diff --git a/Example/Tests/CityMapperTests/KWCityMapperTests.swift b/Example/Tests/CityMapperTests/KWCityMapperTests.swift new file mode 100644 index 0000000..2e45083 --- /dev/null +++ b/Example/Tests/CityMapperTests/KWCityMapperTests.swift @@ -0,0 +1,93 @@ +// +// KWCityMapperTests.swift +// MuslimData_Tests +// +// Created by Kosrat Ahmed on 19/02/2024. +// Copyright © 2024 CocoaPods. All rights reserved. +// + +import XCTest +@testable import MuslimData + +class KWCityMapperTests: XCTestCase { + + override func setUp() { + super.setUp() + } + + override func tearDown() { + super.tearDown() + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testAlAsimahCityMapper() { + XCTAssertEqual("Kuwait City".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Dasman Palace".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Sharq".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Mirqab".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Jibla".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Dasma".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Daiya".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Salhia".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Bneid Al Qar".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Kaifan".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Mansouriya".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Abdullah al-Salem".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Nuzha".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Faiha".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Shamiya".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Rawda".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Adailiya".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Khaldiya".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Qadsiya".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Qortuba".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Surra".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Yarmouk".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Shuwaikh Industrial".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Rai".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Granada".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Sulaibikhat".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Doha".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Nahdha".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Jaber Al Ahmad".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Qairawan".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Ahmadi".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Al Wafrah".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Sabah Al Salem".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Messila".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Al-Masayel".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Adan".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Fnaitees".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Qusor".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Qurain".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Abu Fatira".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Mubarak Al Kabeer".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Jeleeb Al-Shuyoukh".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Eqaila".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Fintas".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Dahar".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Mahboula".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Hadiya".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Al-Riqqa".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Abu Halifa".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Fahad Al Ahmad".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Assabahiyah".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Mangaf".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Fahaheel".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("South Sabahiya".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Ali Sabah Al Salem".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Shalayhat Mina Abdullah".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Zour".mapper(countryCode: "KW"), "Al Asimah") + XCTAssertEqual("Al Khiran".mapper(countryCode: "KW"), "Al Asimah") + } + + func testFailakaIslandCityMapper() { + XCTAssertEqual("Zoor".mapper(countryCode: "KW"), "Failaka Island") + XCTAssertEqual("Kubbar Island".mapper(countryCode: "KW"), "Failaka Island") + XCTAssertEqual("Al-Nuwaiseeb".mapper(countryCode: "KW"), "Failaka Island") + } + + func testAbdaliCityMapper() { + XCTAssertEqual("Jahra".mapper(countryCode: "KW"), "Abdali") + } +} diff --git a/Example/Tests/LocationTests.swift b/Example/Tests/LocationTests.swift index 484dab32..7fa02b8 100755 --- a/Example/Tests/LocationTests.swift +++ b/Example/Tests/LocationTests.swift @@ -101,26 +101,4 @@ class LocationTests: XCTestCase { XCTAssertEqual(location!.hasFixedPrayerTime, true) } } - - func testCityMapper() { - XCTAssertEqual("Sulav".mapper(countryCode: "IQ"), "Akre") - XCTAssertEqual("Mamuzin".mapper(countryCode: "IQ"), "Bardarash") - XCTAssertEqual("Zarayan".mapper(countryCode: "IQ"), "Darbandikhan") - XCTAssertEqual("Atrish".mapper(countryCode: "IQ"), "Duhok") - XCTAssertEqual("Choman".mapper(countryCode: "IQ"), "Erbil") - XCTAssertEqual("Byara".mapper(countryCode: "IQ"), "Halabja") - XCTAssertEqual("Hajiawa".mapper(countryCode: "IQ"), "Ranya") - XCTAssertEqual("Taza Khurmatu".mapper(countryCode: "IQ"), "Kirkuk") - XCTAssertEqual("Khalakan".mapper(countryCode: "IQ"), "Ranya") - XCTAssertEqual("Sangasar".mapper(countryCode: "IQ"), "Qaladiza") - XCTAssertEqual("Takiya".mapper(countryCode: "IQ"), "Chamchamal") - XCTAssertEqual("Divandarreh".mapper(countryCode: "IR"), "Sanandaj") - XCTAssertEqual("Rai".mapper(countryCode: "KW"), "Al Asimah") - XCTAssertEqual("Kubbar Island".mapper(countryCode: "KW"), "Failaka Island") - XCTAssertEqual("Jahra".mapper(countryCode: "KW"), "Abdali") - XCTAssertEqual("Wallze".mapper(countryCode: "IQ"), "Qasre") - XCTAssertEqual("Koila".mapper(countryCode: "IQ"), "Qasre") - XCTAssertNotEqual("Rai".mapper(countryCode: "IQ"), "Qasre") - XCTAssertNotEqual("Choman".mapper(countryCode: "IQ"), "Qasre") - } } diff --git a/Example/Tests/PrayerTests.swift b/Example/Tests/PrayerTests.swift index 11c7f5b..fe0d398 100755 --- a/Example/Tests/PrayerTests.swift +++ b/Example/Tests/PrayerTests.swift @@ -30,6 +30,16 @@ class PrayerTests: XCTestCase { // Put teardown code here. This method is called after the invocation of each test method in the class. } + func testAllFixedPrayerTimes() { + let locations = LocationHelper.shared.fixedPrayerTimesList() + locations!.forEach({ location in + PrayerTime.getPrayerTimes(location: location, date: self.date, attributes: self.attributes) { prayer, error in + XCTAssertNil(error) + XCTAssertNotNil(prayer) + } + }) + } + func testFixedPrayer() { // Test fixed prayer times for Sulav, Iraq let sulav = Location(latitude: 0.0, longitude: 0.0, cityName: "Sulav", countryCode: "IQ", diff --git a/MuslimData/Assets/CHANGELOG.md b/MuslimData/Assets/CHANGELOG.md index 81369e0..e02a8d0 100644 --- a/MuslimData/Assets/CHANGELOG.md +++ b/MuslimData/Assets/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to the MuslimData database will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). + +## [1.4.0] - 2024-02-18 + +Update Sulaymaniyah governorate prayer times. + +### Added +- Kalar, IQ prayer times have been added as a separate list with old Suli data. +- Hero, IQ added to the city table. +- Bngrd, IQ added to the city table. +- Dokan, IQ prayer times have been added to the prayer time table. +- Khanaqin, IQ prayer times have been added to the prayer time table. +- Penjwen, IQ prayer times have been added to the prayer time table. +- Gokhlan, IQ prayer times have been added to the prayer time table. + +### Changed +- Sulaymaniyah, IQ prayer times have been updated. +- Qaladiza, IQ prayer times have been updated. +- Qadir Karam removed from fixed prayer times. +- Ranya, IQ prayer times have been updated. +- Darbandikhan, IQ prayer times have been udpated. ## [1.3.3] - 2024-02-17 diff --git a/MuslimData/Assets/cityMapper.json b/MuslimData/Assets/cityMapper.json index 6a55129..0b7951e 100755 --- a/MuslimData/Assets/cityMapper.json +++ b/MuslimData/Assets/cityMapper.json @@ -5,15 +5,16 @@ "Bardarash": ["Mamuzin"], "Erbil": ["Kalak", "Pirmam", "Shaqlawa", "Harir", "Khalifan", "Rawanduz", "Soran", "Mergasur", "Galala", "Choman", "Hiran", "Qushtapa", "Kasnazan"], "Qasre": ["Wallze","Soraban","Shnawa","Rashdur","Makosan","Saya","Walash","Eskawa","Xazena","Dilman", - "Sarkan", "Chomsak","Qalat","Koila","Mawnan","Wasan","Choma","Mergay Khwaru","Kani Bast"], + "Sarkan", "Chomsak","Qalat","Koila","Mawnan","Wasan","Choma","Mergay Khwaru","Kani bast"], "Kirkuk": ["Taza Khurmatu"], - "Sulaymaniyah": ["Kalar", "Mawat", "Arbat"], - "Qaladiza": ["Halsho", "Nawdasht", "Piramagroon", "Tasluja", "Bazian", "Sangasar", "Zharawa"], - "Kifri": ["Dokan", "Qadir Karam"], + "Sulaymaniyah": ["Mawat", "Arbat"], + "Qaladiza": ["Halsho", "Nawdasht", "Tasluja", "Bazian", "Sangasar", "Zharawa", "Bngrd", "Hero"], + "Dokan": ["Piramagroon"], "Ranya": ["Hajiawa", "Sarkapkan", "Khalakan", "Taqtaq", "Hizop", "Chwarqurna"], "Chamchamal": ["Takiya", "Takiay Jabari", "Shorsh", "Aghjalar", "Sangaw"], - "Darbandikhan": ["Zalan", "Gapilon", "Chwarta", "Barzinjah", "Zarayan", "Halebjai Taza","Qara Dagh", "Khanaqin"], - "Halabja": ["Garmk", "Penjwen", "Nalparez", "Said Sadiq", "Sirwan", "Pshta", "Byara", "Tawella", "Gokhlan", "Balkha", "Khurmal"], + "Darbandikhan": ["Zalan", "Gapilon", "Chwarta", "Barzinjah", "Zarayan", "Halebjai Taza","Qara Dagh"], + "Penjwen": ["Garmk", "Nalparez", "Said Sadiq", "Pshta"], + "Halabja": ["Sirwan", "Byara", "Tawella", "Balkha", "Khurmal"] }, "IR":{ "Sanandaj": ["Kamyaran", "Divandarreh", "Dehgolan", "Qorveh"], diff --git a/MuslimData/Assets/muslim_db_v1.3.3.db b/MuslimData/Assets/muslim_db_v1.4.0.db similarity index 98% rename from MuslimData/Assets/muslim_db_v1.3.3.db rename to MuslimData/Assets/muslim_db_v1.4.0.db index 8d01498..4c74c49 100644 Binary files a/MuslimData/Assets/muslim_db_v1.3.3.db and b/MuslimData/Assets/muslim_db_v1.4.0.db differ diff --git a/MuslimData/Classes/DB Helper/DBHelper.swift b/MuslimData/Classes/DB Helper/DBHelper.swift index bc913bb..d054cec 100755 --- a/MuslimData/Classes/DB Helper/DBHelper.swift +++ b/MuslimData/Classes/DB Helper/DBHelper.swift @@ -19,7 +19,7 @@ class DBHelper { private init() { var configuration = Configuration() configuration.readonly = true - let databaseURL = Bundle(for: DBHelper.self).path(forResource: "muslim_db_v1.3.3", ofType: "db")! + let databaseURL = Bundle(for: DBHelper.self).path(forResource: "muslim_db_v1.4.0", ofType: "db")! dbPool = try? DatabasePool(path: databaseURL, configuration: configuration) // Be a nice iOS citizen, and don’t consume too much memory @@ -34,8 +34,8 @@ class DBHelper { try dbPool?.read { dbConnect in let result = try Row.fetchOne(dbConnect, sql: """ SELECT * FROM prayer_time - WHERE country_code = '\(countryCode)' and city = '\(city.mapper(countryCode: countryCode))' - and date = '\(formatPrayerDate(date))' + WHERE country_code = "\(countryCode)" and city = "\(city.mapper(countryCode: countryCode))" + and date = "\(formatPrayerDate(date))" """) guard let row = result else { callback(nil, "Found nil while unwrapping result.") @@ -59,7 +59,7 @@ class DBHelper { let result = try Name.fetchAll(dbConnect, sql: """ SELECT org.name , tr.name as translated FROM name as org - INNER JOIN name_translation as tr on tr.name_id = org._id and tr.language = '\(language)' + INNER JOIN name_translation as tr on tr.name_id = org._id and tr.language = "\(language)" """) guard result.count > 0 else { callback(nil, "No row found") @@ -84,7 +84,7 @@ class DBHelper { SELECT org._id, category_name FROM azkar_category as org INNER JOIN azkar_category_translation as tr on tr.category_id = org._id - and language = '\(language)' + and language = "\(language)" """) guard result.count > 0 else { callback(nil, "No row found") @@ -113,7 +113,7 @@ class DBHelper { let result = try AzkarChapter.fetchAll(dbConnect, sql: """ SELECT org._id, category_id, chapter_name FROM azkar_chapter as org - INNER JOIN azkar_chapter_translation as tr on tr.chapter_id = org._id and language = '\(language)' + INNER JOIN azkar_chapter_translation as tr on tr.chapter_id = org._id and language = "\(language)" \(category) """) guard result.count > 0 else { @@ -139,11 +139,11 @@ class DBHelper { let result = try AzkarItem.fetchAll(dbConnect, sql: """ SELECT org._id, org.chapter_id, org.item, tr.item_translation, rtr.reference FROM azkar_item as org - INNER JOIN azkar_item_translation as tr on tr.item_id = org._id and tr.language = '\(language)' + INNER JOIN azkar_item_translation as tr on tr.item_id = org._id and tr.language = "\(language)" and org.chapter_id = \(chapterId) INNER JOIN azkar_reference as ref on ref.item_id = org._id INNER JOIN azkar_reference_translation as rtr on rtr.reference_id = ref._id - and rtr.language = '\(language)' + and rtr.language = "\(language)" """) guard result.count > 0 else { callback(nil, "No row found") diff --git a/MuslimData/Classes/Extensions/String+Extensions.swift b/MuslimData/Classes/Extensions/String+Extensions.swift index 750ea70..3ce8376 100755 --- a/MuslimData/Classes/Extensions/String+Extensions.swift +++ b/MuslimData/Classes/Extensions/String+Extensions.swift @@ -34,7 +34,7 @@ extension String { /// - Parameter countryCode: Country code /// - Returns: Parent city if available else the city it self. func mapper(countryCode: String) -> String { - let city = capitalized + let city = self var parentCity: String? if let path = Bundle(for: DBHelper.self).path(forResource: "cityMapper", ofType: "json") { do { diff --git a/MuslimData/Classes/Location/LocationHelper.swift b/MuslimData/Classes/Location/LocationHelper.swift index 26f0977..0bd8642 100755 --- a/MuslimData/Classes/Location/LocationHelper.swift +++ b/MuslimData/Classes/Location/LocationHelper.swift @@ -36,7 +36,7 @@ public struct LocationHelper { latitude, longitude, has_fixed_prayer_time FROM city INNER JOIN country on city.country_code = country.country_code - WHERE city.city_name like '\(city)%' + WHERE city.city_name like "\(city)%" """) DispatchQueue.main.async { callback(locations, nil) @@ -64,7 +64,7 @@ public struct LocationHelper { longitude, has_fixed_prayer_time FROM city INNER JOIN country on city.country_code = country.country_code - WHERE city.country_code='\(countryCode)' COLLATE NOCASE and city.city_name='\(city)' COLLATE NOCASE + WHERE city.country_code="\(countryCode)" COLLATE NOCASE and city.city_name="\(city)" COLLATE NOCASE """) guard var location = result else { @@ -108,4 +108,23 @@ public struct LocationHelper { callback(nil) } } + + /// Get all the locations that has fixed prayer times. + /// - Returns: Location list + public func fixedPrayerTimesList() -> [Location]?{ + do { + return try self.dbHelper.dbPool?.read { dbConnect in + let locations = try Location.fetchAll(dbConnect, sql: """ + SELECT city.country_code as country_code, country_name, city_name, + latitude, longitude, has_fixed_prayer_time + FROM city + INNER JOIN country on city.country_code = country.country_code + WHERE has_fixed_prayer_time=1 + """) + return locations + } + } catch { + return nil + } + } }