Adding unit tests for MG_SAMPLE. Handling asking for 0 samples. Formatting.