NAME

Test::BDD::Infrastructure::Utils - class with collection of some utility functions

VERSION

version 1.000

Human readable operators

The Utils package provides human readable comparsion operators.

convert_cmp_operator( $op )

Returns the perl operator for $op as string.

$CMP_OPERATOR_RE

Contains a regex to match all supported operators.

Synopsis

use Test::BDD::Infrastructure::Utils qw(
      convert_cmp_operator $CMP_OPERATOR_RE );

Then qr/the file must contain $CMP_OPERATOR_RE (\d+) lines/, sub {
  my $op = convert_cmp_operator( $1 );
  my $count = $2;
  my $lines = calc_lines();
  cmp_ok( $lines, $op, $count, "the file must contain $op $count lines");
}

Examples

Then the file must contain at least 10 lines

Supported Operators

at least
a maximum of
not more than
more than
bigger than
greater than
less than
smaller than
equal
exactly
newer than
older than

Byte units

The module provides conversion of human readable byte units.

convert_unit( $size, $unit )

Returns the size in bytes.

Supported units

byte, b
kilobyte, kb
megabyte, mb
gigabyte, gb
terrabyte, tb

Intervals

The module provides conversion of human readable intervals.

convert_interval( $count, $unit )

Return the interval in seconds.

Supported intervals

second(s)
day(s)
week(s)
hour(s)
minute(s)
month(s)
year(s)

AUTHOR

Markus Benning <ich@markusbenning.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Markus Benning.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.