Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #5518

How to write a test with random usage patterns?

From Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no>
Newsgroups comp.programming
Subject How to write a test with random usage patterns?
Date 2015-07-27 14:48 +0200
Organization University of Oslo, Norway
Message-ID <hbf.20150727d459@bombur2.uio.no> (permalink)

Show all headers | View raw


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:

for (...)
  switch (anti_rand() % CASES) {
    case 0: foo();                     break;
    case 1: bar(randomly chosen data); break;
    ...
  }

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.

The point is to avoid coding up some particular patterns like
"write descending keys for a while", and instead have anti_rand()
cause that.  What's a good way to write anti_rand()?  How to use
it well?  Or should I ask, what should I goolge for?  I expect
someone has dealt with this problem before.

-- 
Hallvard

Back to comp.programming | Previous | Next — Next in thread | Find similar | Unroll thread


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