Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #5528
| 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-28 12:55 +0200 |
| Organization | University of Oslo, Norway |
| Message-ID | <hbf.20150728b0g8@bombur2.uio.no> (permalink) |
| References | <hbf.20150727d459@bombur2.uio.no> |
I wrote:
> I want to test a database by throwing random usage patterns
> at it. Maybe like this, but replacing rand() with something
> which exhibits random patterns in the output:
> (...)
So, I don't want to code 20 usage patterns like this:
switch (rand() % 20) {
case 0: Do N writes in descending order; break;
....
}
when I instead can get 4*5 usage patterns like this:
switch (anti_rand() % 4) {
case 0: write(smaller item than last time); break;
....
}
unsigned anti_rand() {
switch (foo % 5) {
case 0: return the same number N times, then change foo;
...
}
}
That's still pretty unimaginative, though. So I wonder how to write
anti_rand() to produce different patterns - mixtures of order and
randomness - to guide the test program. Or what to google for,
since I hope someone has done this before.
E.g. maybe instead of returning the same number N times, it'll return
different numbers but with the same bottom bits each time for a while,
and specify that usage like above should use COUNT = power of 2.
And I'll need to know how to best use it, but I expect that must wait
until I know what anti_rand() is doing. E.g. whether to use '% COUNT'
or something else. Or instead of a "write smaller item than last time"
case, maybe write data from another anti_rand() stream and leave it to
anti_rand() to sometimes return descending values for a while.
--
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