~ubuntu-branches/ubuntu/trusty/clc-intercal/trusty-proposed

« back to all changes in this revision

Viewing changes to t/12intercalc-full-ick.t

  • Committer: Bazaar Package Importer
  • Author(s): Mark Brown
  • Date: 2006-10-08 13:30:54 UTC
  • mfrom: (1.1.1 upstream) (3.1.1 dapper)
  • Revision ID: james.westby@ubuntu.com-20061008133054-fto70u71yoyltr3m
Tags: 1:1.0~2pre1.-94.-4.1-1
* New upstream release.
* Change to dh_installman.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# test the calculator in ick mode
 
2
 
 
3
use IPC::Open3 qw(open3);
 
4
 
 
5
my @tests = (
 
6
    ['DO .1 <- #V2', 'OK'],
 
7
    ['DO .2 <- .V1', 'OK'],
 
8
    ['.1', 'III'],
 
9
    ['.2', 'xxxiiDCCLXXI'],
 
10
    ['PLEASE IGNORE .2', 'OK'],
 
11
    ['DO .2 <- #666', 'OK'],
 
12
    ['.2', 'xxxiiDCCLXXI'],
 
13
    ['PLEASE REMEMBER .2', 'OK'],
 
14
    ['DO .2 <- #666', 'OK'],
 
15
    ['.2', 'DCLXVI'],
 
16
    # XXX more tests are necessary
 
17
);
 
18
 
 
19
my $maxtest = @tests;
 
20
print "1..$maxtest\n";
 
21
 
 
22
my @l = map { "-I$_" } @INC;
 
23
my $pid = open3(\*READ, \*WRITE, \*WRITE, $^X, @l, 'bin/intercalc', '--batch', '-mfull', '-lick');
 
24
 
 
25
select READ; $| = 1; select STDOUT;
 
26
 
 
27
my $testnum = 1;
 
28
for my $test (@tests) {
 
29
    my ($cmd, $res) = @$test;
 
30
    print READ "$cmd\n";
 
31
    my $line = <WRITE>;
 
32
    chomp $line;
 
33
    while ($line =~ /loading compiler/i) {
 
34
        $line = <WRITE>;
 
35
        chomp $line;
 
36
    }
 
37
    $line =~ s/^\s+//;
 
38
    my ($gr, $gc) = split(/\s+/, $line, 2);
 
39
    my $not = 'not ';
 
40
    if ($gr ne $res) {
 
41
        print STDERR "FAIL $testnum res ($gr ne $res)\n";
 
42
    } else {
 
43
        $not = '';
 
44
    }
 
45
    print "${not}ok ", $testnum++, "\n";
 
46
}
 
47