File: metar.t%2Cv

package info (click to toggle)
libgeo-metar-perl 1.12-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 116 kB
  • ctags: 15
  • sloc: perl: 364; makefile: 48
file content (207 lines) | stat: -rwxr-xr-x 2,715 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
head	1.3;
access;
symbols;
locks; strict;
comment	@# @;


1.3
date	99.02.20.23.15.40;	author jzawodn;	state Exp;
branches;
next	1.2;

1.2
date	99.02.20.23.14.21;	author jzawodn;	state Exp;
branches;
next	1.1;

1.1
date	99.02.20.23.08.00;	author jzawodn;	state Exp;
branches;
next	;


desc
@@


1.3
log
@Damn off-by-one error.
@
text
@#!/usr/bin/perl

# $Id: metar.t,v 1.2 1999/02/20 23:14:21 jzawodn Exp jzawodn $

# Test script for METAR installation.

use strict;
use Test;

BEGIN { plan tests => 6 }

use Geo::METAR;

my %tally = (passed => 0, failed => 0, skipped => 0);

print "Testing METAR.\n";

my $m = new Geo::METAR;

# Create a new instance.

if ($m) {
    ok(1);
} else {
    ok(0);
}

# Set to a given user.

if ($m->metar("KFDY 251450Z 21012G21KT 8SM OVC065 04/M01 A3010 RMK 57014")) {
    ok(1);
} else {
    ok(0);
}

if ($m->SITE eq "KFDY") {
    ok(1);
} else {
    ok(0);
}

if ($m->DATE eq "25") {
    ok(1);
} else {
    ok(0);
}

if ($m->MOD eq "AUTO") {
    ok(1);
} else {
    ok(0);
}

if ($m->F_TEMP eq "39.2") {
    ok(1);
} else {
    ok(0);
}

exit;

__END__


@


1.2
log
@New tests.
@
text
@d3 1
a3 1
# $Id: metar.t,v 1.1 1999/02/20 23:08:00 jzawodn Exp jzawodn $
d10 1
a10 1
BEGIN { plan tests => 5 }
@


1.1
log
@Initial revision
@
text
@d3 1
a3 1
# $Id: test.pl,v 1.5 1998/10/28 03:05:30 jzawodn Exp $
d7 5
d23 1
a23 1
    print Pad("Creation","passed");
d25 1
a25 1
    print Pad("Creation","failed");
d31 1
a31 1
    print Pad("metar","passed");
d33 1
a33 1
    print Pad("metar","failed");
d37 1
a37 1
  print Pad("SITE","passed");
d39 1
a39 1
  print Pad("SITE","failed");
d43 1
a43 1
  print Pad("DATE","passed");
d45 1
a45 1
  print Pad("DATE","failed");
d49 1
a49 1
  print Pad("MOD","passed");
d51 1
a51 1
  print Pad("MOD","failed");
d55 1
a55 1
  print Pad("F_TEMP","passed");
d57 1
a57 36
  print Pad("F_TEMP","failed");
}
 

# summary

print "\n";
print "$tally{passed} tests passed.\n";
print "$tally{skipped} tests skipped.\n";
print "$tally{failed} tests failed.\n";

if ($tally{skipped}) {

print<<EOMS01;

At least one test was skipped. This is probably ok. It
is usually the result of wanting to test parts of METAR
which require stuff that you don't have.

EOMS01

}

if ($tally{failed}) {

print<<EOMF01;

At least one test failed. That's not supposed to happen.
Please contact the author for help or try to fix it
yourself if you feel ambitious.

You *can* still use this module without fixing the problem(s),
but I really don't recommend it.

EOMF01

d62 1
a62 11
sub Pad {
  my $string = shift;
  my $type = shift;
  my $length = length($string);
  for($length..22) {
    $string .= ".";
  }
  $string .= "$type.\n";
  $tally{$type}++;
  return $string;
}
@