It's true that the typical value of n is a power of 2 in n-point FFTs. It's not mandatory though.
Transform length, specified as  or a nonnegative integer scalar. Specifying a positive integer scalar for the transform length can increase the performance of fft. The length is typically specified as a power of 2 or a value that can be factored into a product of small prime numbers. If n is less than the length of the signal, then fft ignores the remaining signal values past the nth entry and returns the truncated result. If n is 0, then fft returns an empty matrix.
So, you should still be able to compare your custom code with the fft function for reasonable values of 'n'.