source:
branches/UKMO/CO6_shelfclimate/NEMOGCM/EXTERNAL/fcm/t/Fcm/Build/Fortran.t
@
7771
Last change on this file since 7771 was 7566, checked in by hadjt, 7 years ago | |
---|---|
File size: 1.3 KB |
Line | |
---|---|
1 | #!/usr/bin/perl |
2 | # ------------------------------------------------------------------------------ |
3 | # (C) Crown copyright Met Office. All rights reserved. |
4 | # For further details please refer to the file COPYRIGHT.txt |
5 | # which you should have received as part of this distribution. |
6 | # ------------------------------------------------------------------------------ |
7 | |
8 | use strict; |
9 | use warnings; |
10 | |
11 | use FindBin; |
12 | use lib "$FindBin::Bin/../../../lib"; |
13 | |
14 | use Test::More (tests => 3); |
15 | |
16 | if (!caller()) { |
17 | main(@ARGV); |
18 | } |
19 | |
20 | sub main { |
21 | my $CLASS = 'Fcm::Build::Fortran'; |
22 | use_ok($CLASS); |
23 | my $util = $CLASS->new(); |
24 | isa_ok($util, $CLASS); |
25 | test_extract_interface($util); |
26 | } |
27 | |
28 | sub test_extract_interface { |
29 | my ($util) = @_; |
30 | my $root = ($0 =~ qr{\A(.+)\.t\z}msx)[0]; |
31 | my $f90 = $root . '-extract-interface-source.f90'; |
32 | my $f90_interface = $root . '-extract-interface-result.f90'; |
33 | open(my($handle_for_source), '<', $f90) || die("$f90: $!"); |
34 | my @actual_lines = $util->extract_interface($handle_for_source); |
35 | close($handle_for_source); |
36 | open(my($handle_for_result), '<', $f90_interface) |
37 | || die("$f90_interface: $!"); |
38 | my @expected_lines = readline($handle_for_result); |
39 | close($handle_for_result); |
40 | is_deeply(\@actual_lines, \@expected_lines, 'extract_interface'); |
41 | } |
42 | |
43 | __END__ |
Note: See TracBrowser
for help on using the repository browser.