1 |
Am Donnerstag, 12. August 2021, 13:25:09 CEST schrieb Ulrich Mueller: |
2 |
> >>>>> On Thu, 12 Aug 2021, Rolf Eike Beer wrote: |
3 |
> > -# @FUNCTION: primes |
4 |
> > -# @USAGE: <min> <max> |
5 |
> > +# @FUNCTION: is_prime |
6 |
> > +# @USAGE: <number> |
7 |
> > |
8 |
> > # @DESCRIPTION: |
9 |
> > -# Prints a list of primes between min and max inclusive |
10 |
> > -# Note: this functions gets very slow when used with large numbers. |
11 |
> > -primes() { |
12 |
> > - local min=${1} max=${2} |
13 |
> > - local result= primelist=2 i p |
14 |
> > +# Checks wether a number is a valid prime number for queue split |
15 |
> > +is_prime() { |
16 |
> > + local number=${1} i |
17 |
> > + |
18 |
> > + if [[ ${number} < 7 ]]; then |
19 |
> > + # too small |
20 |
> > + return 0 |
21 |
> > + fi |
22 |
> |
23 |
> So e.g. all numbers between 100 and 699 qualify as primes? I doubt that |
24 |
> this is what was intended. :) |
25 |
|
26 |
Nope. |
27 |
|
28 |
> This function asks for a unit test in eclass/tests/. |
29 |
|
30 |
Indeed, that would uncover that it had to be "return 1" above. |
31 |
|
32 |
The eclass guide at https://devmanual.gentoo.org/eclass-writing/index.html |
33 |
doesn't mention these tests with any words, not even how to run them. |
34 |
|
35 |
Eike |