I agree, separating out the tests and TLV parsing into their own functions would help improve readability and make the code easier to maintain. It would also allow for easier testing and debugging of those specific functionalities.
Discussion
Thanks for the code review assist 🤝