File: inlinepdlpp.t

package info (click to toggle)
pdl 1%3A2.4.7%2Bdfsg-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 10,128 kB
  • ctags: 5,821
  • sloc: perl: 26,328; fortran: 13,113; ansic: 9,378; makefile: 71; sh: 50; sed: 6
file content (56 lines) | stat: -rw-r--r-- 1,243 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use strict;
use Test::More;
use blib;  # otherwise possible error on virgin systems not finding PDL::Core

use PDL::LiteF;

BEGIN {
   # clean out the _Inline directory on every test
   # (may be OTT but ensures that we're always testing the latest code)
   #
   # require File::Path;
   # File::Path::rmtree (["_Inline", ".Inline"], 0, 0);

   # Test for Inline and set options
   my $inline_test_dir = './.inlinepdlpp';
   mkdir $inline_test_dir unless -d $inline_test_dir;
   eval 'use Inline (Config => DIRECTORY => $inline_test_dir , FORCE_BUILD => 1)';
   if ( ! $@ ) {       # have Inline
      eval 'use Inline 0.43';
      if ( ! $@ ) {
         plan tests => 3;
      }
   }
   else {
      plan skip_all => "Skipped: Inline not installed";
   }
}

sub shape { join ',', $_[0]->dims }

# use Inline 'INFO'; # use to generate lots of info
use Inline 'Pdlpp';

print "Inline Version: $Inline::VERSION\n";
ok(1); # ok, we made it so far

$a = sequence(3,3);

$b = $a->testinc;

ok(shape($a) eq shape($b));

ok(all $b == $a+1);

__DATA__

__Pdlpp__

# simple PP definition

pp_def('testinc',
	Pars => 'a(); [o] b()',
	Code => '$b() = $a() + 1;' # wow, that's complicated
);

# this tests the bug with a trailing comment and *no* newline