-
Notifications
You must be signed in to change notification settings - Fork 7
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
Depth function #22
Depth function #22
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it'll be a good idea to write a test for this new function. What do you say @harshey1103 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome thanks @harshey1103 ! This looks good to me, I agree that a test or two would be great. The OMT loading algorithm that we support should produce a balanced tree so that can be used for the tests.
Also running dune build @fmt --auto
will format the code :))
Just as an additional thing, your |
Hi @patricoferris, I looked into the test directory but I am not able to figure out how to write a test for the depth function. There aren't any tests for the Rtree module. :'( |
Yes the tests are a little disorganised, apologies! There are tests of the Rtree module though. For example Lines 88 to 120 in ee12c37
Here we test the OMT loader for an instantiation of the Rtree module using rectangles and lines. This should help write a test to check the |
I tried to make the function tail recursive and have written the tests can you please have a look @patricoferris @AryanGodara . |
The changes are looking good to me. Our CI system seems a bit broken, so I've opened an issue for them: ocurrent/solver-service#74. I ran this locally and I'm happing with the changes, thank you @harshey1103 :)) |
One thing I would add is that the depth function is not quite tail-recursive here (the function call is not in the tail position) but that's okay, I think something else might break before we get depths that cause us trouble... I think |
Initial implementation of depth function.
The function returns 0 for an empty tree and 1 for a tree whose root is a leaf.