tests end conditions