Also your test requires an exact match to the byte - depending on the FS setup the exact number of bytes in a 1GB file created by dd can vary +/- 4/8/16.  When you use ls's output in human readable format it takes care of the conversion.

This is also what the community cookbook uses and it works.