A reference implementation can be found at src/.
src/
A very simple test can be found at test/ and requires Foundry to be installed.
test/
Run with:
> forge test -vvvv