Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions App/DevKeychain.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
};
};
};
buildConfigurationList = 4C135EBE2E088223008CE477 /* Build configuration list for PBXProject "DevKeychainApp" */;
buildConfigurationList = 4C135EBE2E088223008CE477 /* Build configuration list for PBXProject "DevKeychain" */;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Expand Down Expand Up @@ -487,7 +487,7 @@
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
4C135EBE2E088223008CE477 /* Build configuration list for PBXProject "DevKeychainApp" */ = {
4C135EBE2E088223008CE477 /* Build configuration list for PBXProject "DevKeychain" */ = {
isa = XCConfigurationList;
buildConfigurations = (
4C135EE32E088224008CE477 /* Debug */,
Expand Down Expand Up @@ -530,7 +530,7 @@
requirement = {
kind = versionRange;
maximumVersion = 2.0.0;
minimumVersion = "1.0.0-beta.8";
minimumVersion = "1.0.0-beta.9";
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct GenericPasswordIntegrationTests: RandomValueGenerating {
mutating func addQueryAndDeleteItems() throws {
let service = randomAlphanumericString(count: 64)
let accounts = Array(
Set(count: random(Int.self, in: 3 ... 5)) {
Set(count: randomInt(in: 3 ... 5)) {
randomAlphanumericString()
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct InternetPasswordIntegrationTests: RandomValueGenerating {
mutating func addQueryAndDeleteItems() throws {
let server = randomAlphanumericString(count: 64)
let accounts = Array(
Set(count: random(Int.self, in: 3 ... 5)) {
Set(count: randomInt(in: 3 ... 5)) {
randomAlphanumericString()
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct StandardKeychainServicesTests: RandomValueGenerating {
mutating func addQueryAndDeleteItemsSucceeds() throws {
let service = randomAlphanumericString(count: 64)
let accounts = Array(
Set(count: random(Int.self, in: 3 ... 5)) {
Set(count: randomInt(in: 3 ... 5)) {
randomAlphanumericString()
}
)
Expand Down
6 changes: 3 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/DevKitOrganization/DevTesting", from: "1.0.0-beta.7")
.package(url: "https://github.com/DevKitOrganization/DevTesting", from: "1.0.0-beta.9")
],
targets: [
.target(
Expand Down
14 changes: 7 additions & 7 deletions Tests/DevKeychainTests/Core/KeychainTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,13 @@ struct KeychainTests: RandomValueGenerating {

// Create some overlap between query dictionary and return dictionary
var attributesDictionary = randomKeychainDictionary() as [CFString: Any]
attributesDictionary[kSecMatchLimit] = random(Float64.self, in: -10 ... 0)
attributesDictionary[kSecMatchCaseInsensitive] = random(Int.self, in: 2 ... .max)
attributesDictionary[kSecMatchLimit] = randomFloat64(in: -10 ... 0)
attributesDictionary[kSecMatchCaseInsensitive] = randomInt(in: 2 ... .max)

var returnDictionary = randomKeychainDictionary() as [CFString: Any]
returnDictionary[attributesDictionary.keys.randomElement()!] = randomAlphanumericString()
returnDictionary[kSecMatchLimit] = random(Float64.self, in: -10 ... 0)
returnDictionary[kSecMatchCaseInsensitive] = random(Int.self, in: 2 ... .max)
returnDictionary[kSecMatchLimit] = randomFloat64(in: -10 ... 0)
returnDictionary[kSecMatchCaseInsensitive] = randomInt(in: 2 ... .max)

let keychainService = MockKeychainServices()
keychainService.itemsStub = ThrowingStub(defaultResult: .success(expectedObject))
Expand All @@ -181,7 +181,7 @@ struct KeychainTests: RandomValueGenerating {
query.returnDictionaryStub = Stub(defaultReturnValue: returnDictionary)

var options = randomKeychainQueryOptions()
options.limit = isLimitNil ? nil : random(Int.self, in: 1 ... .max)
options.limit = isLimitNil ? nil : randomInt(in: 1 ... .max)

let convertedValue = randomUUID()
query.mapStub = ThrowingStub(defaultResult: .success([convertedValue]))
Expand Down Expand Up @@ -244,7 +244,7 @@ struct Keychain_QueryOptionsTests: RandomValueGenerating {
@Test
mutating func initSetsValues() {
let isCaseInsensitive = randomBool()
let limit = randomOptional(random(Int.self, in: .min ... .max))
let limit = randomOptional(randomInt(in: .min ... .max))
let options = Keychain.QueryOptions(isCaseInsensitive: isCaseInsensitive, limit: limit)
#expect(options.isCaseInsensitive == isCaseInsensitive)
#expect(options.limit == limit)
Expand All @@ -254,7 +254,7 @@ struct Keychain_QueryOptionsTests: RandomValueGenerating {
@Test(arguments: [false, true])
mutating func oteamptionDictionaryIsCorrect(isLimitNil: Bool) {
let isCaseInsensitive = randomBool()
let limit = isLimitNil ? nil : random(Int.self, in: .min ... .max)
let limit = isLimitNil ? nil : randomInt(in: .min ... .max)
let options = Keychain.QueryOptions(isCaseInsensitive: isCaseInsensitive, limit: limit)

let expected: [CFString: Any] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct GenericPasswordTests: RandomValueGenerating {

for (key, type) in keysAndTypes {
var attributes = dictionary
attributes[key] = random(Int.self, in: .min ... .max)
attributes[key] = randomInt(in: .min ... .max)

#expect(throws: KeychainItemMappingError.attributeTypeMismatch(attribute: key as String, type: type)) {
_ = try GenericPassword(attributes: attributes)
Expand Down Expand Up @@ -327,7 +327,7 @@ struct GenericPassword_QueryTests: RandomValueGenerating {
account: randomOptional(randomAlphanumericString())
)

let expectedItems = Array(count: random(Int.self, in: 3 ... 5)) {
let expectedItems = Array(count: randomInt(in: 3 ... 5)) {
GenericPassword(
service: randomAlphanumericString(),
account: randomAlphanumericString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct InternetPasswordTests: RandomValueGenerating {

for (key, type) in keysAndTypes {
var attributes = dictionary
attributes[key] = random(Int.self, in: .min ... .max)
attributes[key] = randomInt(in: .min ... .max)

#expect(throws: KeychainItemMappingError.attributeTypeMismatch(attribute: key as String, type: type)) {
_ = try InternetPassword(attributes: attributes)
Expand Down Expand Up @@ -327,7 +327,7 @@ struct InternetPassword_QueryTests: RandomValueGenerating {
account: randomOptional(randomAlphanumericString())
)

let expectedItems = Array(count: random(Int.self, in: 3 ... 5)) {
let expectedItems = Array(count: randomInt(in: 3 ... 5)) {
InternetPassword(
server: randomAlphanumericString(),
account: randomAlphanumericString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension RandomValueGenerating {


mutating func randomKeychainDictionary() -> [String: String] {
return Dictionary(count: random(Int.self, in: 3 ... 5)) {
return Dictionary(count: randomInt(in: 3 ... 5)) {
(randomAlphanumericString(), randomAlphanumericString())
}
}
Expand All @@ -25,7 +25,7 @@ extension RandomValueGenerating {
mutating func randomKeychainQueryOptions() -> Keychain.QueryOptions {
return .init(
isCaseInsensitive: randomBool(),
limit: randomOptional(random(Int.self, in: 1 ... 10))
limit: randomOptional(randomInt(in: 1 ... 10))
)
}
}
Loading