summaryrefslogtreecommitdiff
path: root/Examples/test-suite/python/hugemod.pl
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2009-08-18 20:56:02 +0000
committerLorry <lorry@roadtrain.codethink.co.uk>2012-09-25 16:59:08 +0000
commit9f8a09ed743cedd9547bf0661d518647966ab114 (patch)
tree9c7803d3b27a8ec22e91792ac7f7932efa128b20 /Examples/test-suite/python/hugemod.pl
downloadswig-tarball-master.tar.gz
Imported from /srv/lorry/lorry-area/swig-tarball/swig-1.3.40.tar.gz.HEADswig-1.3.40master
Diffstat (limited to 'Examples/test-suite/python/hugemod.pl')
-rw-r--r--Examples/test-suite/python/hugemod.pl55
1 files changed, 55 insertions, 0 deletions
diff --git a/Examples/test-suite/python/hugemod.pl b/Examples/test-suite/python/hugemod.pl
new file mode 100644
index 0000000..5420926
--- /dev/null
+++ b/Examples/test-suite/python/hugemod.pl
@@ -0,0 +1,55 @@
+#!/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;