How to properly write tests for kernel functions