From 507dccd2206137d510887ee55505afd7d69db876 Mon Sep 17 00:00:00 2001 From: Fabrizio Demaria Date: Mon, 8 Apr 2024 17:27:37 +0200 Subject: [PATCH] Rename bool to boolean --- Sources/Confidence/ConfidenceValue.swift | 4 ++-- Sources/ConfidenceProvider/Utils/ConfidenceTypeMapper.swift | 2 +- Tests/ConfidenceProviderTests/ConfidenceTypeMapperTest.swift | 4 ++-- Tests/ConfidenceTests/ConfidenceValueTests.swift | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/Confidence/ConfidenceValue.swift b/Sources/Confidence/ConfidenceValue.swift index 6a961cbf..63f147be 100644 --- a/Sources/Confidence/ConfidenceValue.swift +++ b/Sources/Confidence/ConfidenceValue.swift @@ -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]) { diff --git a/Sources/ConfidenceProvider/Utils/ConfidenceTypeMapper.swift b/Sources/ConfidenceProvider/Utils/ConfidenceTypeMapper.swift index e81d52bf..2c45a899 100644 --- a/Sources/ConfidenceProvider/Utils/ConfidenceTypeMapper.swift +++ b/Sources/ConfidenceProvider/Utils/ConfidenceTypeMapper.swift @@ -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: diff --git a/Tests/ConfidenceProviderTests/ConfidenceTypeMapperTest.swift b/Tests/ConfidenceProviderTests/ConfidenceTypeMapperTest.swift index ad2d7c48..343fd584 100644 --- a/Tests/ConfidenceProviderTests/ConfidenceTypeMapperTest.swift +++ b/Tests/ConfidenceProviderTests/ConfidenceTypeMapperTest.swift @@ -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)]), @@ -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]), diff --git a/Tests/ConfidenceTests/ConfidenceValueTests.swift b/Tests/ConfidenceTests/ConfidenceValueTests.swift index 2fddf30c..1a312c94 100644 --- a/Tests/ConfidenceTests/ConfidenceValueTests.swift +++ b/Tests/ConfidenceTests/ConfidenceValueTests.swift @@ -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")])