[test] Use allocation functions in module testing

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>