Core Data decimal validation uses truncated numeric values

Originator:atomicbird
Number:rdar://13677527 Date Originated:2013-04-17
Status:Open Resolved:
Product:Developer Tools Product Version:4.6.2
Classification:Serious Bug Reproducible:Always
 
17-Apr-2013 03:44 PM Tom Harrington:
Summary:

Xcode truncates non-integer values in validation predicates for decimal attributes in Core Data models.

Steps to Reproduce:

1. Create a Core Data model that includes an entity with a decimal attribute
2. Add non-integer min and max values for the decimal attribute. For example, min = -4.5 and max = 4.9.

Expected Results:

Since decimal values can hold non-integer values, validation would use the entered non-integer values.

Actual Results:

Limits are truncated. At run time, the validation predicates use truncated versions of the limits entered in Xcode. The sample limits of -4.5 and 4.9 become a min of -4 and a max of 4.

Regression:

Unknown.

Notes:

A sample project is attached. The data model has a single entity with a single decimal attribute with a min of -4.5 and a max of 4.9. The method -[AppDelegate testDecimalValidation] does the following:

1. Finds the attribute and prints its validation predicates, which produces this:

2013-04-17 15:38:27.806 DecimalValidate[51561:c07] Validation predicates: (
    "SELF >= -4",
    "SELF <= 4"
)

2. Creates an instance of this entity and sets its decimal attribute to 4.1, which should be legal.

3. Calls -validateForInsert: on the instance, which fails because of an illegal decimal value.


17-Apr-2013 03:44 PM Tom Harrington:
'DecimalValidate.zip' was successfully uploaded

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!