1###############################################################################
2#                                                                             #
3#          Geo::Postcodes::DK Test Suite 1 - Procedural interface             #
4#          ------------------------------------------------------             #
5#             Arne Sommer - perl@bbop.org  - 24. September 2006               #
6#                                                                             #
7###############################################################################
8#                                                                             #
9# Before `make install' is performed this script should be runnable with      #
10# `make test'. After `make install' it should work as `perl 1_procedures.t'.  #
11#                                                                             #
12###############################################################################
13
14use Test::More tests => 34;
15
16BEGIN { use_ok('Geo::Postcodes::DK') };
17
18#################################################################################
19
20ok(   Geo::Postcodes::DK::legal ("0010"),            "Legal postcode");
21ok( ! Geo::Postcodes::DK::valid ("0010"),            "Postcode not in use");
22ok(   Geo::Postcodes::DK::legal ("0900"),            "Legal postcode");
23ok(   Geo::Postcodes::DK::valid ("0900"),            "Postcode in use");
24ok( ! Geo::Postcodes::DK::legal ("10"),              "Illegal postcode");
25ok( ! Geo::Postcodes::DK::valid ("10"),              "Illegal postcode");
26ok( ! Geo::Postcodes::DK::legal ("Ett eller annet"), "Illegal postcode");
27ok( ! Geo::Postcodes::DK::valid ("Ett eller annet"), "Illegal postcode");
28
29ok( Geo::Postcodes::DK::legal          ("1171"),                "Legal postcode");
30ok( Geo::Postcodes::DK::valid          ("1171"),                "Postcode in use");
31is( Geo::Postcodes::DK::location_of    ("1171"), "K�benhavn K", "Postcode > Location");
32is( Geo::Postcodes::DK::type_of        ("1171"), "ST",          "Postcode > Type");
33is( Geo::Postcodes::DK::type_verbose_of("1171"), "Gadeadresse", "Postcode > Type");
34is( Geo::Postcodes::type_verbose_of    ("1171"), undef,         "Postcode > Type");
35is( Geo::Postcodes::DK::address_of     ("1171"), "Fiolstr�de",  "Postcode > Address");
36is( Geo::Postcodes::DK::owner_of       ("1171"), undef,         "Postcode > Owner");
37
38#################################################################################
39
40ok( Geo::Postcodes::DK::legal          ("215"),             "Legal postcode");
41ok( Geo::Postcodes::DK::valid          ("215"),             "Postcode in use");
42is( Geo::Postcodes::DK::location_of    ("215"), "Sandur",   "Postcode > Location");
43is( Geo::Postcodes::DK::type_of        ("215"), "BX",       "Postcode > Type");
44is( Geo::Postcodes::DK::type_verbose_of("215"), "Postboks", "Postcode > Type");
45is( Geo::Postcodes::type_verbose_of    ("215"), undef,      "Postcode > Type");
46is( Geo::Postcodes::DK::address_of     ("215"), undef,      "Postcode > Address");
47is( Geo::Postcodes::DK::owner_of       ("215"), undef,      "Postcode > Owner");
48
49#################################################################################
50
51## The '0999' postcode is not present in current versions of the module.
52
53# ok( Geo::Postcodes::DK::legal          ("0999"),                   "Legal postcode");
54# ok( Geo::Postcodes::DK::valid          ("0999"),                   "Postcode in use");
55# is( Geo::Postcodes::DK::location_of    ("0999"), "K�benhavn C",    "Postcode > Location");
56# is( Geo::Postcodes::DK::type_of        ("0999"), "IO",             "Postcode > Type");
57# is( Geo::Postcodes::DK::type_verbose_of("0999"), "Personlig ejer", "Postcode > Type");
58# is( Geo::Postcodes::type_verbose_of    ("0999"), undef,            "Postcode > Type");
59# is( Geo::Postcodes::DK::address_of     ("0999"), undef,            "Postcode > Address");
60# is( Geo::Postcodes::DK::owner_of       ("0999"), "DR Byen",        "Postcode > Owner");
61
62## And now, error handling ######################################################
63
64ok( ! Geo::Postcodes::DK::legal (undef), "Illegal postcode");
65ok( ! Geo::Postcodes::DK::valid (undef), "Postcode not in use");
66
67is( Geo::Postcodes::DK::location_of    (undef), undef, "Postcode > Location");
68is( Geo::Postcodes::DK::type_of        (undef), undef, "Postcode > Type");
69is( Geo::Postcodes::DK::type_verbose_of(undef), undef, "Postcode > Type");
70is( Geo::Postcodes::type_verbose_of    (undef), undef, "Postcode > Type");
71is( Geo::Postcodes::DK::type_of        (undef), undef, "Postcode > Type");
72is( Geo::Postcodes::DK::address_of     (undef), undef, "Postcode > Address");
73is( Geo::Postcodes::DK::owner_of       (undef), undef, "Postcode > Owner");
74
75#################################################################################
76