#!/usr/bin/perl -w

use Test;
use strict;

BEGIN
  {
  unshift @INC, '../..';
  plan tests => 3;
  }

use CoW::Coord qw/ALIGN_INSIDE/;
use CoW::Thing;

my $coord_y = new CoW::Coord ( rel => 'x', val => 5 );
my $coord_z = new CoW::Coord ( rel => '', val => 12 );
my $coord_x = new CoW::Coord ( rel => 'w,x', val => 1, space => 1, 
  size => 'l', );
my $one = new CoW::Thing ( x => 8, y => $coord_y, z => $coord_z,
  w => 32, l => 2 );

# test absolute coords
ok ( $one->{z}, 12 );
# test simple relative coords
ok ( $one->{y}, 5+8 );

# test confined relative coords
$one->coord_y ($coord_x);
ok ( $one->{y}, 8+15-1 ); # 8 base, +15 half size, -1 space
