test-lib-functions.sh: rewrite test_seq without Perl