Here, the snr value increases by 1 dB for every for loop iteration. Since, some userdefined functions are used before saving the test data with added noise, I assume that the test data is being modified after overlaying it with the additive white gaussian noise.
I recommend you to check the reason for the test data being modified. However, plotting the test data after 'test = awgn(test,i);' line gives the correct results i.e. As snr increases, test data is with less noise power.