-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DMN 1.4 - 1145-feel-context-function #596
DMN 1.4 - 1145-feel-context-function #596
Conversation
@StrayAlien Thank you again! I would use xsd:decimal instead of xsd:double in the test files xsd:decimal as is a better mapping for the number type in FEEL. I think we should add extra tests to check the type of the value returned by context(). For example:
We should probably discuss the expected values, value produces by context() or coversion to expected type ( e.g. add only members in super type) :) |
thanks @opatrascoiu - re 'double' oh yes, for sure. Apologies - that is an oversight. Good pickup. I'll amend. Re the type checking - the context() function is not intrinsically typed, and we do have other tests for checking on context types, so my feeling here was just to prove it creates the desired contexts and leave the type checking to those other tests. Happy to discuss. |
doubles change to decimal on this PR, and the others with the same thing. Thanks again - nice pickup @opatrascoiu . |
Also, I see the TCK validation fails with |
@StrayAlien These functions are new, we need to add these tests either here, in this file, or somewhere else to have the coverage. Is there an existing test case that you have in mind that can be enhanced ? Adding the tests here will align us with the localization principle. |
Hi @opatrascoiu , thanks. The examples provided show type constraints at the decision/variable level, but (IMO) that is unrelated to asserting results of context function itself. The context() function just produces a context object based on inputs, so we can simply assert that it produces the output context we expect based on the inputs provided. No types are necessary to prove that context() is working as expected IMO. Types are orthogonal. The test are asserting on an exact outcome. So, testing for the type of the outcome gains no value. If the exact expected outcome is not delivered then the type is moot. I think we already have context types covered at the decision/variable level. Likely, also in the as-yet-ummerged PR for domain constraints. I'll have a dig to see if we have. If not, we can add context type checking to some type-specific tests (again, IMO). |
@StrayAlien I am inclined to agree with you about the location. A good place is to have them in 0082-feel-coersion. Comments, thoughts? Once we agree on the location, I'll create a PR. |
Apols for late reply @opatrascoiu - we dp have a few tests fr context types here: https://github.com/dmn-tck/tck/blob/master/TestCases/compliance-level-3/0070-feel-instance-of/0070-feel-instance-of-test-01.xml#L1207. And there are also some more in the 'allow values' PR, butm yes, we're a bit light - expecially around whern they're associated with a decision variable I think. Let's discuss tonight at the DMN meeting. |
I would argue that the test case 003 would not return null but the intention was to return only {a: 2}. We can discuss that one! |
According to 10.3.2.6 Context,
Based on this I think the test is correct. |
@opatrascoiu All right, make sense to keep the test then. |
* 1145-feel-context-function * replace xsd:double with xsd:decimal
No description provided.