Am Donnerstag, 12. August 2021, 13:25:09 CEST schrieb Ulrich Mueller:
> >>>>> On Thu, 12 Aug 2021, Rolf Eike Beer wrote:
> > -# @FUNCTION: primes
> > -# @USAGE: <min> <max>
> > +# @FUNCTION: is_prime
> > +# @USAGE: <number>
> > 
> >  # @DESCRIPTION:
> > -# Prints a list of primes between min and max inclusive
> > -# Note: this functions gets very slow when used with large numbers.
> > -primes() {
> > -   local min=${1} max=${2}
> > -   local result= primelist=2 i p
> > +# Checks wether a number is a valid prime number for queue split
> > +is_prime() {
> > +   local number=${1} i
> > +
> > +   if [[ ${number} < 7 ]]; then
> > +           # too small
> > +           return 0
> > +   fi
> 
> So e.g. all numbers between 100 and 699 qualify as primes? I doubt that
> this is what was intended. :)

Nope.

> This function asks for a unit test in eclass/tests/.

Indeed, that would uncover that it had to be "return 1" above.

The eclass guide at https://devmanual.gentoo.org/eclass-writing/index.html 
doesn't mention these tests with any words, not even how to run them.

Eike

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to