|
Re: How should max,min handle null case ? [message #1748116 is a reply to message #1748047] |
Fri, 18 November 2016 10:10  |
Eclipse User |
|
|
|
Hi
The OCL 2.4 specification 11.2.3 makes it clear that all operations involving null are invalid with the exception of a few special functions such as oclIsUndefined(). So null.max(5) is invalid.
The new Pivot OCL JUnit tests include:
ocl.assertQueryInvalid(null, "let i : Integer = null in 1.max(i)");
ocl.assertQueryInvalid(null, "let i : Integer = null in i.max(1)");
ocl.assertQueryInvalid(null, "let r : Real = null in 1.max(r)");
ocl.assertQueryInvalid(null, "let r : Real = null in r.max(1)");
The old Classic OCL (used by Acceleo) JUnit tests include:
assertResultInvalid("let i : Integer = null in 1.max(i)");
assertResultInvalid("let i : Integer = null in i.max(1)");
assertResultInvalid("let r : Real = null in 1.max(r)");
assertResultInvalid("let r : Real = null in r.max(1)");
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.02249 seconds