IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10186


Ignore:
Timestamp:
Nov 24, 2006, 3:01:08 PM (20 years ago)
Author:
jhoblitt
Message:

additional structure tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-Metadata-Config/t/03_metadata.t

    r9495 r10186  
    33# Copyright (C) 2005  Joshua Hoblitt
    44#
    5 # $Id: 03_metadata.t,v 1.4 2006-10-12 02:08:51 jhoblitt Exp $
     5# $Id: 03_metadata.t,v 1.5 2006-11-25 01:01:08 jhoblitt Exp $
    66
    77use strict;
     
    1212#$::RD_TRACE = 1;
    1313
    14 use Test::More tests => 9;
     14use Test::More tests => 13;
    1515use PS::IPP::Metadata::Config;
    1616
     
    2828    my $config = $config_parser->parse( $example );
    2929
    30     ok( defined( $config ), "SDRS example");
     30    ok( defined( $config ), "SDRS example parsed");
     31
     32    my $tree = [
     33        {
     34            name    => 'CELL',
     35            class   => 'metadata',
     36            value   => [
     37                {
     38                    name    => 'EXTNAME',
     39                    class   => 'scalar',
     40                    class   => 'STR',
     41                    value   => 'CCD00'
     42                },
     43                {
     44                    name    => 'BIASSEC',
     45                    class   => 'scalar',
     46                    class   => 'STR',
     47                    value   => 'BSEC-00'
     48                },
     49                {
     50                    name    => 'CHIP',
     51                    class   => 'scalar',
     52                    class   => 'STR',
     53                    value   => 'CHIP.00'
     54                },
     55                {
     56                    name    => 'NCELL',
     57                    class   => 'scalar',
     58                    class   => 'S32',
     59                    value   => 24,
     60                },
     61            ],
     62        }
     63    ];
     64
     65    is_deeply( $config, $tree, "SDRS example structure");
    3166}
    3267
     
    4277    my $config = $config_parser->parse( $example );
    4378
    44     ok( defined( $config ), "SDRS example + comments");
     79    ok( defined( $config ), "SDRS example + comments parsed");
     80
     81    my $tree = [
     82        {
     83            name    => 'CELL',
     84            class   => 'metadata',
     85            value   => [
     86                {
     87                    name    => 'EXTNAME',
     88                    class   => 'scalar',
     89                    class   => 'STR',
     90                    value   => 'CCD00',
     91                    comment => 'bar',
     92                },
     93                {
     94                    name    => 'BIASSEC',
     95                    class   => 'scalar',
     96                    class   => 'STR',
     97                    value   => 'BSEC-00',
     98                    comment => 'baz',
     99                },
     100                {
     101                    name    => 'CHIP',
     102                    class   => 'scalar',
     103                    class   => 'STR',
     104                    value   => 'CHIP.00',
     105                    comment => 'zab',
     106                },
     107                {
     108                    name    => 'NCELL',
     109                    class   => 'scalar',
     110                    class   => 'S32',
     111                    value   => 24,
     112                    comment => 'rab',
     113                },
     114            ],
     115            comment => 'foo',
     116        }
     117    ];
     118
     119    is_deeply( $config, $tree, "SDRS example + comments structure");
    45120}
    46121
     
    61136    my $config = $config_parser->parse( $example );
    62137
    63     ok( defined( $config ), "nested metadata");
     138    ok( defined( $config ), "nested metadata parsed");
     139
     140    my $tree = [
     141        {
     142            name    => 'CELL',
     143            class   => 'metadata',
     144            value   => [
     145                {
     146                    name    => 'FOO',
     147                    class   => 'metdata',
     148                    value   => [
     149                        {
     150                            name    => 'BAR',
     151                            class   => 'scalar',
     152                            class   => 'STR',
     153                            value   => 'BAZ',
     154                        },
     155                        {
     156                            name    => 'BAR',
     157                            class   => 'scalar',
     158                            class   => 'STR',
     159                            value   => 'PONG',
     160                        },
     161                    ],
     162                },
     163                {
     164                    name    => 'EXTNAME',
     165                    class   => 'scalar',
     166                    class   => 'STR',
     167                    value   => 'CCD00',
     168                    comment => 'bar',
     169                },
     170                {
     171                    name    => 'BIASSEC',
     172                    class   => 'scalar',
     173                    class   => 'STR',
     174                    value   => 'BSEC-00',
     175                    comment => 'baz',
     176                },
     177                {
     178                    name    => 'CHIP',
     179                    class   => 'scalar',
     180                    class   => 'STR',
     181                    value   => 'CHIP.00',
     182                    comment => 'zab',
     183                },
     184                {
     185                    name    => 'NCELL',
     186                    class   => 'scalar',
     187                    class   => 'S32',
     188                    value   => 24,
     189                    comment => 'rab',
     190                },
     191            ],
     192            comment => 'foo',
     193        }
     194    ];
     195
     196    is_deeply( $config, $tree, "nested metadata structure");
    64197}
    65198
     
    94227
    95228    ok( defined( $config ), "deeply nested metadata");
     229
     230    my $tree = [
     231        {
     232            name    => 'FOO1',
     233            class   => 'metadata',
     234            value   => [
     235                {
     236                    name    => 'FOO2',
     237                    class   => 'metdata',
     238                    value   => [
     239                        {
     240                            name    => 'FOO3',
     241                            class   => 'metdata',
     242                            value   => [
     243                                {
     244                                    name    => 'FOO4',
     245                                    class   => 'metdata',
     246                                    value   => [
     247                                        {
     248                                            name    => 'FOO5',
     249                                            class   => 'metdata',
     250                                            value   => [
     251                                                {
     252                                                    name    => 'FOO6',
     253                                                    class   => 'metdata',
     254                                                    value   => [
     255                                                        {
     256                                                            name    => 'BAR',
     257                                                            class   => 'scalar',
     258                                                            class   => 'STR',
     259                                                            value   => 'BAZ',
     260                                                        },
     261                                                        {
     262                                                            name    => 'BAR',
     263                                                            class   => 'scalar',
     264                                                            class   => 'STR',
     265                                                            value   => 'PONG',
     266                                                        },
     267                                                    ],
     268                                                },
     269                                                {
     270                                                    name    => 'BAR',
     271                                                    class   => 'scalar',
     272                                                    class   => 'STR',
     273                                                    value   => 'BAZ',
     274                                                },
     275                                                {
     276                                                    name    => 'BAR',
     277                                                    class   => 'scalar',
     278                                                    class   => 'STR',
     279                                                    value   => 'PONG',
     280                                                },
     281                                            ],
     282                                        },
     283                                        {
     284                                            name    => 'BAR',
     285                                            class   => 'scalar',
     286                                            class   => 'STR',
     287                                            value   => 'BAZ',
     288                                        },
     289                                        {
     290                                            name    => 'BAR',
     291                                            class   => 'scalar',
     292                                            class   => 'STR',
     293                                            value   => 'PONG',
     294                                        },
     295                                    ],
     296                                },
     297                                {
     298                                    name    => 'BAR',
     299                                    class   => 'scalar',
     300                                    class   => 'STR',
     301                                    value   => 'BAZ',
     302                                },
     303                                {
     304                                    name    => 'BAR',
     305                                    class   => 'scalar',
     306                                    class   => 'STR',
     307                                    value   => 'PONG',
     308                                },
     309                            ],
     310                        },
     311                        {
     312                            name    => 'BAR',
     313                            class   => 'scalar',
     314                            class   => 'STR',
     315                            value   => 'BAZ',
     316                        },
     317                        {
     318                            name    => 'BAR',
     319                            class   => 'scalar',
     320                            class   => 'STR',
     321                            value   => 'PONG',
     322                        },
     323                    ],
     324                },
     325                {
     326                    name    => 'BAR',
     327                    class   => 'scalar',
     328                    class   => 'STR',
     329                    value   => 'BAZ',
     330                },
     331                {
     332                    name    => 'BAR',
     333                    class   => 'scalar',
     334                    class   => 'STR',
     335                    value   => 'PONG',
     336                },
     337            ],
     338        },
     339    ];
     340
     341    is_deeply( $config, $tree, "nested metadata structure");
    96342}
    97343
Note: See TracChangeset for help on using the changeset viewer.