You may have missed Peter's email. I just forwarded it again.
We created the test program.
Please download this file into the same directory as the current code you are working with.
You can use a wget
gcc -o selfTest-LIS3MDL selfTest-LIS3MDL.c
Can you please run it and share the output