swig/Examples/test-suite/python/hugemod.pl
Haoyu Bai 3d8ddfc442 Merged the Python 3.0 support branch. The merging progress is not so smooth, so hope this commit won't make anything broken.
This is the (incomplemete) log produced by svnmerge.py:

Merged revisions 10405-10409,10420-10422,10426,10438,10445,10451,10454-10465,10467,10473-10475,10485,10488-10489,10493-10495,10497,10509-10510,10513-10514,10517,10520,10525,10528-10529,10533-10535,10554-10557,10570,10573,10593,10614,10666-10669,10673,10678,10687,10690,10704-10706,10731,10744,10750-10752,10755,10759,10770,10775-10776,10813,10819 via svnmerge from 
https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-bhy



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10834 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-09-11 17:18:07 +00:00

55 lines
1.2 KiB
Perl

#!/usr/bin/perl
use strict;
my $modsize = 399; #adjust it so you can have a smaller or bigger hugemod
my $runme = shift @ARGV;
open HEADER, ">hugemod.h" or die "error";
open TEST, ">$runme" or die "error";
open I1, ">hugemod_a.i" or die "error";
open I2, ">hugemod_b.i" or die "error";
print TEST "import hugemod_a\n";
print TEST "import hugemod_b\n";
print I1 "\%module hugemod_a;\n";
print I1 "\%include \"hugemod.h\";\n";
print I1 "\%{ #include \"hugemod.h\" \%}\n";
print I2 "\%module hugemod_b;\n";
print I2 "\%import \"hugemod.h\";\n";
print I2 "\%{ #include \"hugemod.h\" \%}\n";
print I2 "\%inline \%{\n";
my $i;
for ($i = 0; $i < $modsize; $i++) {
my $t = $i * 4;
print HEADER "class type$i { public: int a; };\n";
print I2 "class dtype$i : public type$i { public: int b; };\n";
print TEST "c = hugemod_a.type$i()\n";
print TEST "c.a = $t\n";
print TEST "if c.a != $t:\n";
print TEST " raise RuntimeError\n";
print TEST "c = hugemod_b.dtype$i()\n";
print TEST "c.a = $t\n";
print TEST "if c.a != $t:\n";
print TEST " raise RuntimeError\n";
$t = -$t;
print TEST "c.b = $t\n";
print TEST "if c.b != $t:\n";
print TEST " raise RuntimeError\n\n";
}
print I2 "\%}\n";
close HEADER;
close TEST;
close I1;
close I2;