@@ -346,11 +346,11 @@ extension AttributeValueTests {
346
346
let attr = AttributeValue . others
347
347
var tmpError : Error ?
348
348
do {
349
- _ = try attr. isExactMatch ( with: invalidValue)
349
+ _ = try attr. isExactMatch ( with: invalidValue, condition : conditionString , name : attributeKey )
350
350
} catch {
351
351
tmpError = error
352
352
}
353
- XCTAssertNotNil ( tmpError)
353
+ XCTAssertEqual ( " [Optimizely][Error] " + tmpError! . localizedDescription , OptimizelyError . evaluateAttributeInvalidCondition ( conditionString ) . localizedDescription )
354
354
}
355
355
356
356
func testIsExactMatchWithInfiniteValue( ) {
@@ -368,34 +368,34 @@ extension AttributeValueTests {
368
368
let attr = AttributeValue . string ( " string " )
369
369
var tmpError : Error ?
370
370
do {
371
- _ = try attr. isExactMatch ( with: invalidValue)
371
+ _ = try attr. isExactMatch ( with: invalidValue, condition : conditionString , name : attributeKey )
372
372
} catch {
373
373
tmpError = error
374
374
}
375
- XCTAssertNotNil ( tmpError)
375
+ XCTAssertEqual ( " [Optimizely][Error] " + tmpError! . localizedDescription , OptimizelyError . evaluateAttributeInvalidType ( conditionString , invalidValue , attributeKey ) . localizedDescription )
376
376
}
377
377
378
378
func testIsExactMatchWithInfiniteAttributeValue( ) {
379
379
let attr = AttributeValue . double ( 1 )
380
380
let value = Double . infinity
381
381
var tmpError : Error ?
382
382
do {
383
- _ = try attr. isExactMatch ( with: value)
383
+ _ = try attr. isExactMatch ( with: value, condition : conditionString , name : attributeKey )
384
384
} catch {
385
385
tmpError = error
386
386
}
387
- XCTAssertNotNil ( tmpError)
387
+ XCTAssertEqual ( " [Optimizely][Error] " + tmpError! . localizedDescription , OptimizelyError . evaluateAttributeValueOutOfRange ( conditionString , attributeKey ) . localizedDescription )
388
388
}
389
389
390
390
func testIsGreaterWithInvalidValue( ) {
391
391
let attr = AttributeValue . string ( " " )
392
392
var tmpError : Error ?
393
393
do {
394
- _ = try attr. isGreater ( than: Double ( 1 ) )
394
+ _ = try attr. isGreater ( than: Double ( 1 ) , condition : conditionString , name : attributeKey )
395
395
} catch {
396
396
tmpError = error
397
397
}
398
- XCTAssertNotNil ( tmpError)
398
+ XCTAssertEqual ( " [Optimizely][Error] " + tmpError! . localizedDescription , OptimizelyError . evaluateAttributeInvalidCondition ( conditionString ) . localizedDescription )
399
399
}
400
400
401
401
func testIsGreaterWithInfiniteValue( ) {
@@ -413,22 +413,22 @@ extension AttributeValueTests {
413
413
let attr = AttributeValue . double ( 100.23 )
414
414
var tmpError : Error ?
415
415
do {
416
- _ = try attr. isGreater ( than: invalidValue)
416
+ _ = try attr. isGreater ( than: invalidValue, condition : conditionString , name : attributeKey )
417
417
} catch {
418
418
tmpError = error
419
419
}
420
- XCTAssertNotNil ( tmpError)
420
+ XCTAssertEqual ( " [Optimizely][Error] " + tmpError! . localizedDescription , OptimizelyError . evaluateAttributeInvalidType ( conditionString , invalidValue , attributeKey ) . localizedDescription )
421
421
}
422
422
423
423
func testIsLessWithInvalidValue( ) {
424
424
let attr = AttributeValue . string ( " " )
425
425
var tmpError : Error ?
426
426
do {
427
- _ = try attr. isLess ( than: Double ( 1 ) )
427
+ _ = try attr. isLess ( than: Double ( 1 ) , condition : conditionString , name : attributeKey )
428
428
} catch {
429
429
tmpError = error
430
430
}
431
- XCTAssertNotNil ( tmpError)
431
+ XCTAssertEqual ( " [Optimizely][Error] " + tmpError! . localizedDescription , OptimizelyError . evaluateAttributeInvalidCondition ( conditionString ) . localizedDescription )
432
432
}
433
433
434
434
func testIsLessWithInfiniteValue( ) {
@@ -446,33 +446,33 @@ extension AttributeValueTests {
446
446
let attr = AttributeValue . double ( 100.23 )
447
447
var tmpError : Error ?
448
448
do {
449
- _ = try attr. isLess ( than: invalidValue)
449
+ _ = try attr. isLess ( than: invalidValue, condition : conditionString , name : attributeKey )
450
450
} catch {
451
451
tmpError = error
452
452
}
453
- XCTAssertNotNil ( tmpError)
453
+ XCTAssertEqual ( " [Optimizely][Error] " + tmpError! . localizedDescription , OptimizelyError . evaluateAttributeInvalidType ( conditionString , invalidValue , attributeKey ) . localizedDescription )
454
454
}
455
455
456
456
func testIsSubstringWithInvalidValue( ) {
457
457
let attr = AttributeValue . double ( 1 )
458
458
var tmpError : Error ?
459
459
do {
460
- _ = try attr. isSubstring ( of: " valid " )
460
+ _ = try attr. isSubstring ( of: " valid " , condition : conditionString , name : attributeKey )
461
461
} catch {
462
462
tmpError = error
463
463
}
464
- XCTAssertNotNil ( tmpError)
464
+ XCTAssertEqual ( " [Optimizely][Error] " + tmpError! . localizedDescription , OptimizelyError . evaluateAttributeInvalidCondition ( conditionString ) . localizedDescription )
465
465
}
466
466
467
467
func testIsSubstringWithInvalidAttributeValue( ) {
468
468
let attr = AttributeValue . string ( " valid " )
469
469
var tmpError : Error ?
470
470
do {
471
- _ = try attr. isSubstring ( of: invalidValue)
471
+ _ = try attr. isSubstring ( of: invalidValue, condition : conditionString , name : attributeKey )
472
472
} catch {
473
473
tmpError = error
474
474
}
475
- XCTAssertNotNil ( tmpError)
475
+ XCTAssertEqual ( " [Optimizely][Error] " + tmpError! . localizedDescription , OptimizelyError . evaluateAttributeInvalidType ( conditionString , invalidValue , attributeKey ) . localizedDescription )
476
476
}
477
477
478
478
func testIsValidForExactMatcher( ) {
0 commit comments