#!/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,10); ($x, $y, $z, $t) = ($entry, $x, $y, $z); &row($entry); } sub press { my $result = eval("$y $_[0] $x")+0; ($x, $y, $z, $t) = ($result, $z, $t, $t); &row($_[0]); } sub row { print <<; $_[0] $x $y $z $t } # Note use of ... tags to be compatible with # wiki generated html expected by the run.cgi script. print <<;

Model Generated Test Data
for the HP-35 Calculator

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 Save As menu. You can also try one of the following.

&simulate(); print <<;
eg.Calculator
key x() y() z() t()

Test data generated $date
with version $version generator.