package ATR::DataSessionTest;

use strict;
use warnings;
use base qw(McaTestCase);

# $Source: /nfs/disk54/badger/cvs/AniTrack/testlib/ATR/DataSessionTest.pm,v $
# $Revision: 1.4 $ $Date: 2005/08/18 15:54:37 $

use ATR::DataSession;

# Currently, we need the locally modified GTx - comes from same place as ATR
__PACKAGE__->libscheck_group(qw[ ATR GTx ]);

sub test_writing {
    my $self = shift;

    my @S = map { ATR::DataSession->new() } (0, 1);

    $self->assert_str_equals(0, $S[0]->writing);
    $self->assert_str_equals(0, $S[1]->writing);

    $S[0]->writing(1);
    $self->assert_str_equals(1, $S[0]->writing);

    # XXX: test the write-exclusion mechanism when it's made
    #  $self->assert_dies(qr/simultaneous write attempted/,
    #                     sub { $S[1]->writing(1) });

    $S[0]->writing(0);
    $self->assert_str_equals(0, $S[0]->writing);

    $S[1]->writing('yes');
    $self->assert_str_equals(0, $S[0]->writing);
    $self->assert_str_equals(1, $S[1]->writing);
    $S[1]->writing(undef);
    $self->assert_str_equals(0, $S[1]->writing);
}

# XXX: Test the holding and naming of MicePEs...  best integrated with MicePE tests

1;
