test: Add checks for memory allocation failure
test: Add negative test for get_layer_path
shared: Add missing break to serialize
test: Add serialize tests for all supported types
shared: Get rid of extra malloc calls
shared: add missing asserts for serialization arguments