[sdf] Fix Sdf_Children<ChildPolicy>::Find to return correct value
In most cases, Sdf_Children<ChildPolicy>::Find would return the incorrect value of 0 instead the size of _childNames. This would incorrectly index into the first element when a match was not found
Description of Change(s)
Link to proposal (if applicable)
Fixes Issue(s)
Checklist
[x] I have created this PR based on the dev branch
[x] I have followed the coding conventions
[x] I have added unit tests that exercise this functionality (Reference: testing guidelines)
[x] I have verified that all unit tests pass with the proposed changes
[x] I have submitted a signed Contributor License Agreement (Reference: Contributor License Agreement instructions)
/AzurePipelines run
Azure Pipelines successfully started running 1 pipeline(s).
Hey @nvidia-jomiller,
I'm not quite seeing the bug you mentioned in your PR description. Prior to your change, in the case where the given key isn't found, the index i would have been incremented to _childNames.size() and then returned. The test case you added worked both with and without your change. AFAICT, the only functional change is that in the failed verify case we now return _childNames.size() instead of 0.
Am I missing something?
Hey @sunyab , thanks for taking a look!
The change was mostly facilitated by another task but yeah, now that I read through it line by line I see functionally it's equivalent. What I was mostly going from is checks in SdfChildrenView and code docs in Sdf_Children. I didn't see any tests specifically testing it so I modified and added a test. I think this might just be a readability thing where I was expecting to see _childNames.size() returned. But I'm happy to close this out
Ok, thanks for confirming! Please leave this open for now, if nothing else I think we can merge in the test since more tests are always appreciated.