Acme-FSM

 view release on metacpan or  search on metacpan

t/state/start.t  view on Meta::CPAN

# $Id: start.t 484 2013-05-09 20:56:46Z whynot $
# Copyright 2012, 2013 Eric Pozharski <whynot@pozharski.name>
# GNU GPLv3
# AS-IS, NO-WARRANTY, HOPE-TO-BE-USEFUL

use strict;
use warnings;

package main;
use version 0.77; our $VERSION = version->declare( v2.3.3 );

use t::TestSuite qw| :switches :run :diag |;
use Test::More;

use Acme::FSM;

our( %st, $bb, $stderr, @input );
our @inbase = q|detritus|;
our %opts   = ( source => \&AFSMTS_shift, diag_level => -t STDOUT ? 10 : 1 );

sub toggle_now ( ) {
    @inbase = $inbase[0] ? ( undef ) x 5 :
  qw| twoflower pseudopolis magrat_garlick offler granny_weatherwax |;
    @input = ( )    }

my @data =
([ q|empty state table|, [qw| void |], { }, qr.\Q{switch} !isa defined . ],
 [       q|empty (START) record|,
  [qw|                   void |],
  { START => {                }},
    qr.\Q{switch} !isa defined .                                         ],
 [                                            q|no (START) state|,
  [qw|                                                    void |],
  { exit => { eturn => [qw| exit DONE |], switch => \&AFSMTS_D }},
                                     qr.\Q{switch} !isa defined .        ],
 [                              q|[D]|,
  [qw|                         void |],
  { START => { switch => \&AFSMTS_D }},
                       qr.^die switch.                                   ],
 [                              q|[T]|,
  [qw|                         void |],
  { START => { switch => \&AFSMTS_T }},
     qr.\Q(tturn): turn !isa defined .                                   ],
 [                              q|[F]|,
  [qw|                 void eignore |],
  { START => { switch => \&AFSMTS_F }},
     qr.\Q(fturn): turn !isa defined .                                   ],
 [                              q|[U]|,
  [qw|                 void eignore |],
  { START => { switch => \&AFSMTS_U }},
     qr.\Q(uturn): turn !isa defined .                                   ],
 [                          q|[T], tturn !isa defined|,
  [qw|                                         void |],
  { START => { switch => \&AFSMTS_T, tturn => undef }},
                     qr.\Q(tturn): turn !isa defined .                   ],
 [                          q|[F], fturn !isa defined|,
  [qw|                                 void eignore |],
  { START => { switch => \&AFSMTS_F, fturn => undef }},
                     qr.\Q(fturn): turn !isa defined .                   ],
 [                          q|[U], uturn !isa defined|,
  [qw|                                 void eignore |],



( run in 2.134 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )