Bruce Jay Mack - iCIS Knowledge base and Collaboration WikiWiki
Welcome
Guest
, you are in:
<root>
iCIS
PTC
•
Login
Test Wiki
Navigation
¶
Main Page
Random Page
Create a new Page
All Pages
Categories
Navigation Paths
Administration
File Management
Create Account
Search the wiki
»
Back
Generate Column Fixture Table with Random Data
Modified on 02/23/2015 07:16
by
Administrator
Categorized as
Column Fixture
,
Data
<esc>{{ # !/usr/bin/perl # (c) 2002 Cunningham & Cunningham, Inc. use strict; print "Content-type: text/html\n\n"; my ($x, $y, $z, $t) = (0,0,0,0); my $date = `date`; my $version = '1.0.3'; my $rows = 30; $rows = $1 if $ENV{QUERY_STRING} =~ /\brows=(\d+)\b/; sub simulate { for (1..$rows) { $_ = int(rand(8)); /0/ && &enter(rand()); /1/ && &enter(-rand()); /2/ && &enter(rand(10000)); /3/ && &enter(-rand(10000)); /4/ && &press('+'); /5/ && &press('-'); /6/ && &press('*'); /7/ && &press('/'); } } sub enter { my $entry = substr($_[0|0],0,10); ($x, $y, $z, $t) = ($entry, $x, $y, $z); &row($entry); } sub press { my $result = eval("$y $_[0|0] $x")+0; ($x, $y, $z, $t) = ($result, $z, $t, $t); &row($_[0|0]); } sub row { print <<; <tr> <td>$_[0|0]</td> <td>$x</td> <td>$y</td> <td>$z</td> <td>$t</td> </tr> } # Note use of <wiki> ... </wiki> tags to be compatible with # wiki generated html expected by the run.cgi script. print <<; <html><body> <h1>Model Generated Test Data<br>for the HP-35 Calculator</h1> <p> A model of the HP-35 calculator has been implemented in perl and used to generate the self consistent randomized test data which is reported below. You can save this particular data using your browser's <i>Save As</i> menu. You can also try one of the following. </p> <ul> <li> Generate <a href=hp35.cgi>more</a> test data. <li> Use data like this to <a href=run.cgi>run</a> the test. <li> Read the <a href=hp35.txt>source</a> of the generator. </ul> <wiki> <table border cellspacing=0 cellpadding=3> <tr> <td colspan=5>eg.Calculator</td> </tr> <tr> <td>key</td> <td>x()</td> <td>y()</td> <td>z()</td> <td>t()</td> </tr> &simulate(); print <<; </table> </wiki> <p> Test data generated $date<br> with version $version generator. </p> </body> </html> }}</esc>
Meta Keywords:
Meta Description:
Change Comment:
ScrewTurn Wiki
version 3.0.5.600. Some of the icons created by
FamFamFam
.