tests: replace macro with function