Replies: 1 comment 1 reply
-
No, but then I'm not testing on 32 bit machines/builds. As far as I know, an out of range index would raise the same
I would maintain a skip list and document the implementation's limitations. Python seems to handle these things naturally, but sometimes I check array bounds explicitly when resolving a selector, like in Ruby. norm_index = normalize(@index, node.value.length)
return [] if norm_index.negative? || norm_index >= node.value.length Or in JavaScript. const normIndex = this.normalizedIndex(node.value.length);
if (normIndex in node.value) { ... } Taking the same approach in Java, you might need to store indexes as longs or BigIntegers internally, for the benefit of canonical paths, then just select nothing if the index can't be cast to an integer, considering no array will ever have that many items. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Did you encounter any Python specific issues in any of the test cases in your multiple public test suites? I'm failing the test for allowable index values because Java only provides for 32 bit unsigned values whereas JSON allows far larger ranges (+/- 2**53-1) . So my Java code will first report out-of-range JSON index errors, then immediately checks for out-of-range Java indexes. Therefore many of these tests in cts.json will always fail.
How did you handle these kinds of test issues ? Do you just keep them in a skip list forever? That means my "official" build will always indicate there were skipped tests. This doesn't feel like a proper solution. And if I manually remove them from the cts.json file, that becomes a maintenance issue when new versions of the file are published.
Beta Was this translation helpful? Give feedback.
All reactions