A statistical test for the Zipf's law by deviations from the Heaps' law