Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #5522
| From | Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: How to write a test with random usage patterns? |
| Date | 2015-07-27 17:00 +0200 |
| Organization | University of Oslo, Norway |
| Message-ID | <hbf.20150727fhro@bombur2.uio.no> (permalink) |
| References | <hbf.20150727d459@bombur2.uio.no> <2547f646-b573-4216-9a77-eb2b0ca259e2@googlegroups.com> |
Julio Di Egidio <julio@diegidio.name> writes:
> On Monday, July 27, 2015 at 1:48:18 PM UTC+1, Hallvard Breien Furuseth wrote:
[Rearranging a bit]
>> That is, anti_rand() might output random numbers for a while, then
>> switch to (X,Y,Z, X,Y,Z ...) for a while, and so on.
>
> And so on what? Is it supposed to generate random numbers or not?
> Indeed, why call it anti_rand and not just rand? And why not just use
> some library function? (It is utterly non-trivial to code a decent
> random number generator.)
I do *not* want a random number generator. I want a random _pattern_
generator. See the Subject header. Generate some pattern and output
that, then another, and so on. Some regular patterns, some half-
randomized. Or something like that.
>> switch (anti_rand() % CASES) {
> That is not a good approach: if the range of anti_rand is not an exact
> multiple of the number of cases, you get that some cases are hit more
> frequently than others. But you'll have to clarify about anti_rand
> before I get to suggest a better approach:
Not quite, but the program must be adapted to anti_rand(), yes.
>> I expect someone has dealt with this problem before.
>
> I do use random input for some tests, it may be useful to
> automatically generate a large number of test cases with varying
> input: the only drawback is that tests are not repeatable unless you
> specify a seed for the random number generator.
I expect to output the seed at the beginning of the test, and make the
program deterministic after picking the seed. Or offer that as an
option, anyway.
--
Hallvard
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to write a test with random usage patterns? Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no> - 2015-07-27 14:48 +0200
Re: How to write a test with random usage patterns? Julio Di Egidio <julio@diegidio.name> - 2015-07-27 07:19 -0700
Re: How to write a test with random usage patterns? Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no> - 2015-07-27 17:00 +0200
Re: How to write a test with random usage patterns? Julio Di Egidio <julio@diegidio.name> - 2015-07-27 08:42 -0700
Re: How to write a test with random usage patterns? Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no> - 2015-07-28 12:53 +0200
Re: How to write a test with random usage patterns? Julio Di Egidio <julio@diegidio.name> - 2015-07-27 07:42 -0700
Re: How to write a test with random usage patterns? Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no> - 2015-07-28 12:55 +0200
Re: How to write a test with random usage patterns? Richard Heathfield <rjh@cpax.org.uk> - 2015-07-28 12:26 +0100
Re: How to write a test with random usage patterns? Julio Di Egidio <julio@diegidio.name> - 2015-07-28 05:20 -0700
Re: How to write a test with random usage patterns? Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no> - 2015-07-28 15:03 +0200
Re: How to write a test with random usage patterns? Richard Heathfield <rjh@cpax.org.uk> - 2015-07-28 17:17 +0100
csiph-web