From: tb Date: Sat, 6 Aug 2016 14:41:14 +0000 (+0000) Subject: If you see code like this, you know something's quite wrong X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=91bad9411e52969bd1f503acda86b305538ff9f4;p=openbsd If you see code like this, you know something's quite wrong (present in some form since r1.1, still present in r1.31): 229 case 013: 230 if (randomize) 231 begin = BEGIN_DEF; 232 else if (reps == 0) 233 errx(1, "Must specify begin if reps == 0"); 234 begin = ender - reps * s + s; Add two tests that check for the intended behavior. --- diff --git a/regress/usr.bin/jot/regress.rdhhh.out b/regress/usr.bin/jot/regress.rdhhh.out new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/regress/usr.bin/jot/regress.rdhhh.out @@ -0,0 +1 @@ +1 diff --git a/regress/usr.bin/jot/regress.rhdhh.out b/regress/usr.bin/jot/regress.rhdhh.out new file mode 100644 index 00000000000..29d6383b52c --- /dev/null +++ b/regress/usr.bin/jot/regress.rhdhh.out @@ -0,0 +1 @@ +100 diff --git a/regress/usr.bin/jot/regress.sh b/regress/usr.bin/jot/regress.sh index 247b85b0db7..9165b8faf37 100644 --- a/regress/usr.bin/jot/regress.sh +++ b/regress/usr.bin/jot/regress.sh @@ -1,4 +1,4 @@ -# $OpenBSD: regress.sh,v 1.2 2016/08/05 13:24:04 tb Exp $ +# $OpenBSD: regress.sh,v 1.3 2016/08/06 14:41:14 tb Exp $ # $FreeBSD: head/usr.bin/jot/tests/regress.sh 208728 2010-06-02 07:47:29Z brian $ JOT=${JOT-jot} @@ -37,6 +37,9 @@ REGRESSION_TEST([[dhhd2]], [[${JOT} - 20 160 -]]) REGRESSION_TEST([[ddhh2]], [[${JOT} - - 160 2]]) REGRESSION_TEST([[rand1]], [[${JOT} -r 10000 0 9 | sort -u]]) REGRESSION_TEST([[rand2]], [[${JOT} -r 10000 9 0 | sort -u]]) +# rdhhh and rhdhh test if begin and ender are set to the default with jot -r +REGRESSION_TEST([[rdhhh]], [[${JOT} -r 100 - 10 2 2>/dev/null | sort -n | head -1]]) +REGRESSION_TEST([[rhdhh]], [[${JOT} -r 100 90 - 2 2>/dev/null | sort -n | tail -1]]) REGRESSION_TEST([[n21]], [[${JOT} 21 -1 1.00]]) REGRESSION_TEST([[ascii]], [[${JOT} -c 128 0]]) REGRESSION_TEST([[xaa]], [[${JOT} -w xa%c 26 a]])