[WIP] Add avl tests

This pull request adds and fixes the avl tests
There will be no other notes until I fixed the cause of the segfault.