IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3487


Ignore:
Timestamp:
Mar 23, 2005, 2:13:02 PM (21 years ago)
Author:
jhoblitt
Message:

separate tests for SDRS example with and w/o overwrite()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PS-IPP-Metadata-Config/t/02_examples.t

    r3482 r3487  
    33# Copyright (C) 2005  Joshua Hoblitt
    44#
    5 # $Id: 02_examples.t,v 1.2 2005-03-23 06:48:04 jhoblitt Exp $
     5# $Id: 02_examples.t,v 1.3 2005-03-24 00:13:02 jhoblitt Exp $
    66
    77use strict;
     
    1212#$::RD_TRACE = 1;
    1313
    14 use Test::More tests => 3;
     14use Test::More tests => 5;
    1515use PS::IPP::Metadata::Config;
    1616
     
    106106            value   => 'key',
    107107        },
     108    ];
     109
     110    is_deeply( $config, $tree, "SDRS example structure, no overwrite" );
     111}
     112
     113{
     114my $example = q{
     115Double     F64     1.23456789      # This is a comment
     116Float    F32 0.98765#This is a comment too
     117String  STR This is the string that forms the value #comment
     118
     119 # This is a comment line and is to be ignored
     120boolean     BOOL    T # The value of `boolean' is `true'
     121 
     122@primes U8  2,3 5 7,11,13 17 #   These are prime numbers
     123
     124comment MULTI # The rest of this line is ignored, but `comment' is set to be non-unique
     125comment STR This
     126comment STR     is
     127comment STR       a
     128comment STR        non-unique
     129comment STR                  key
     130Float F64 1.23456 # This generates a warning, and, if `overwrite' is `false', is ignored
     131};
     132    $config_parser->overwrite( 1 );
     133    my $config = $config_parser->parse( $example );
     134
     135    ok( defined( $config ), "SDRS example parsed");
     136
     137    my $tree = [
     138        {
     139            name    => 'Double',
     140            class   => 'scalar',
     141            type    => 'F64',
     142            value   => '1.23456789',
     143            comment => 'This is a comment',
     144        },
     145        {
     146            name    => 'String',
     147            class   => 'scalar',
     148            type    => 'STR',
     149            value   => 'This is the string that forms the value',
     150            comment => 'comment',
     151        },
     152        {
     153            name    => 'boolean',
     154            class   => 'scalar',
     155            type    => 'BOOL',
     156            value   => 1,
     157            comment => q{The value of `boolean' is `true'},
     158        },
     159        {
     160            name    => 'primes',
     161            class   => 'vector',
     162            type    => 'U8',
     163            value   => [qw( 2 3 5 7 11 13 17 )],
     164            comment => 'These are prime numbers',
     165        },
     166        {
     167            name    => 'comment',
     168            class   => 'scalar',
     169            type    => 'STR',
     170            value   => 'This',
     171        },
     172        {
     173            name    => 'comment',
     174            class   => 'scalar',
     175            type    => 'STR',
     176            value   => 'is',
     177        },
     178        {
     179            name    => 'comment',
     180            class   => 'scalar',
     181            type    => 'STR',
     182            value   => 'a',
     183        },
     184        {
     185            name    => 'comment',
     186            class   => 'scalar',
     187            type    => 'STR',
     188            value   => 'non-unique',
     189        },
     190        {
     191            name    => 'comment',
     192            class   => 'scalar',
     193            type    => 'STR',
     194            value   => 'key',
     195        },
    108196        {
    109197            name    => 'Float',
     
    115203    ];
    116204
    117     is_deeply( $config, $tree, "SDRS example structure" );
     205    is_deeply( $config, $tree, "SDRS example structure, with overwrite" );
    118206}
    119207
Note: See TracChangeset for help on using the changeset viewer.