To test. You just need some sort of means to set up the call to your subroutine, call your subroutine, and and then check the results of memory or registers after the return. The code sample posted by spec476 is good example. If your assembler doesn’t have such a feature, you either need a conditional assembly directive or a way to cut your routine out of your assembly file and blend it with your test with something like Python or a ruby
https://mos.datatra.sh/guide/unit-testing.html