Algorithm-DependencySolver

 view release on metacpan or  search on metacpan

t/01-operation.t  view on Meta::CPAN

{
    ## operation with...
    ##  no resources it depends on
    ##  no resources it affects
    ##  no prerequesites
    my $operation = Algorithm::DependencySolver::Operation->new(
        id            => 1,
        depends       => [ ],
        affects       => [ ],
        prerequisites => [ ],
        obj           => bless({}, "Object"),
    );

    ok $operation, 'operation with... no depends, no affects, no prerequesites';
}

{
    ## operation with...
    ##  one resource it depends on
    ##  no resources it affects
    ##  no prerequesites
    my $operation = Algorithm::DependencySolver::Operation->new(
        id            => 1,
        depends       => [ 'a' ],
        affects       => [ ],
        prerequisites => [ ],
        obj           => bless({}, "Object"),
    );

    ok $operation, 'operation with... 1 depend, no affects, no prerequesites';
}

{
    ## operation with...
    ##  two resources it depends on
    ##  no resources it affects
    ##  no prerequesites
    my $operation = Algorithm::DependencySolver::Operation->new(
        id            => 1,
        depends       => [ 'a', 'b' ],
        affects       => [ ],
        prerequisites => [ ],
        obj           => bless({}, "Object"),
    );

    ok $operation, 'operation with... 2 depends, no affects, no prerequesites';
}

{
    ## operation with...
    ##  no resources it depends on
    ##  one resource it affects
    ##  no prerequesites
    my $operation = Algorithm::DependencySolver::Operation->new(
        id            => 1,
        depends       => [ ],
        affects       => [ 'a' ],
        prerequisites => [ ],
        obj           => bless({}, "Object"),
    );

    ok $operation, 'operation with... no depends, 1 affects, no prerequesites';
}

{
    ## operation with...
    ##  no resources it depends on
    ##  two resources it affects
    ##  no prerequesites
    my $operation = Algorithm::DependencySolver::Operation->new(
        id            => 1,
        depends       => [ ],
        affects       => [ 'a', 'b' ],
        prerequisites => [ ],
        obj           => bless({}, "Object"),
    );

    ok $operation, 'operation with... no depends, 2 affects, no prerequesites';
}

{
    ## operation with...
    ##  no resources it depends on
    ##  no resources it affects
    ##  one prerequesite
    my $operation = Algorithm::DependencySolver::Operation->new(
        id            => 1,
        depends       => [ ],
        affects       => [ ],
        prerequisites => [ 'a' ],
        obj           => bless({}, "Object"),
    );

    ok $operation, 'operation with... no depends, no affects, 1 prerequesite';
}

{
    ## operation with...
    ##  no resources it depends on
    ##  no resources it affects
    ##  two prerequesites
    my $operation = Algorithm::DependencySolver::Operation->new(
        id            => 1,
        depends       => [ ],
        affects       => [ ],
        prerequisites => [ 'a', 'b' ],
        obj           => bless({}, "Object"),
    );

    ok $operation, 'operation with... no depends, no affects, 2 prerequesites';
}

{
    ## operation with...
    ##  one resource it depends on
    ##  two resources it affects
    ##  three prerequesites
    my $operation = Algorithm::DependencySolver::Operation->new(
        id            => 1,
        depends       => [ 'a' ],
        affects       => [ 'b', 'c' ],
        prerequisites => [ 'd', 'e', 'f' ],
        obj           => bless({}, "Object"),
    );

    ok $operation, 'operation with... 1 depend, 2 affects, 3 prerequesites';
}



( run in 0.831 second using v1.01-cache-2.11-cpan-de7293f3b23 )