Skip to content

Commit

Permalink
Rename bool to boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziodemaria committed Apr 8, 2024
1 parent a7ddf66 commit 507dccd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Sources/Confidence/ConfidenceValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public class ConfidenceValue: Equatable, Encodable {
self.value = .timestamp(timestamp)
}

public init(boolList: [Bool]) {
self.value = .list(boolList.map { .boolean($0) })
public init(booleanList: [Bool]) {
self.value = .list(booleanList.map { .boolean($0) })
}

public init(stringList: [String]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public enum ConfidenceTypeMapper {
}
switch listType {
case .boolean:
return ConfidenceValue.init(boolList: values.compactMap { $0.asBoolean() })
return ConfidenceValue.init(booleanList: values.compactMap { $0.asBoolean() })
case .string:
return ConfidenceValue.init(stringList: values.compactMap { $0.asString() })
case .integer:
Expand Down
4 changes: 2 additions & 2 deletions Tests/ConfidenceProviderTests/ConfidenceTypeMapperTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ValueConverterTest: XCTestCase {
targetingKey: "userid",
structure: MutableStructure(attributes: ([
"stringList": .list([.string("test1"), .string("test2")]),
"boolList": .list([.boolean(true), .boolean(false)]),
"booleanList": .list([.boolean(true), .boolean(false)]),
"integerList": .list([.integer(11), .integer(33)]),
"doubleList": .list([.double(3.14), .double(1.0)]),
"dateList": .list([.date(date1), .date(date2)]),
Expand All @@ -39,7 +39,7 @@ class ValueConverterTest: XCTestCase {
let confidenceStruct = ConfidenceTypeMapper.from(ctx: openFeatureCtx)
let expected = [
"stringList": ConfidenceValue(stringList: ["test1", "test2"]),
"boolList": ConfidenceValue(boolList: [true, false]),
"booleanList": ConfidenceValue(booleanList: [true, false]),
"integerList": ConfidenceValue(integerList: [11, 33]),
"doubleList": ConfidenceValue(doubleList: [3.14, 1.0]),
"dateList": ConfidenceValue(timestampList: [date1, date2]),
Expand Down
4 changes: 2 additions & 2 deletions Tests/ConfidenceTests/ConfidenceValueTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ final class ConfidenceConfidenceValueTests: XCTestCase {
let date2 = try XCTUnwrap(formatter.date(from: "2022-01-02 00:00:00"))
let dateComponents2 = DateComponents(year: 2024, month: 4, day: 2)

let boolListValue = ConfidenceValue(boolList: [true, false])
let booleanListValue = ConfidenceValue(booleanList: [true, false])
let integerListValue = ConfidenceValue(integerList: [3, 4])
let doubleListValue = ConfidenceValue(doubleList: [3.14, 4.0])
let stringListValue = ConfidenceValue(stringList: ["val1", "val2"])
let timestampListValue = ConfidenceValue(timestampList: [date1, date2])
let dateListValue = ConfidenceValue(dateList: [dateComponents1, dateComponents2])

XCTAssertEqual(boolListValue.asList(), [ConfidenceValue(boolean: true), ConfidenceValue(boolean: false)])
XCTAssertEqual(booleanListValue.asList(), [ConfidenceValue(boolean: true), ConfidenceValue(boolean: false)])
XCTAssertEqual(integerListValue.asList(), [ConfidenceValue(integer: 3), ConfidenceValue(integer: 4)])
XCTAssertEqual(doubleListValue.asList(), [ConfidenceValue(double: 3.14), ConfidenceValue(double: 4.0)])
XCTAssertEqual(stringListValue.asList(), [ConfidenceValue(string: "val1"), ConfidenceValue(string: "val2")])
Expand Down

0 comments on commit 507dccd

Please sign in to comment.