<?php
setlocale (LC_ALL, 'de_DE@UTF-8');
ini_set('default_charset','utf-8');
error_reporting(-1);

require 'romanNumbers.php';

$rn = new romanNumbers;

#/* Typentest:

$zahlen=array(
    1,
    4,
    6,
    9,
    10,
    11,
    14,
    16,
    20,
    30,
    40,
    50,
    90,
    111,
    140,
    149,
    1444,
    1661,
    14444,
    16661,
    144444,
    166666
);

foreach ( $zahlen  as $zahl ) {
    $e = $rn -> getRoman  ( $zahl,true, true);           echo $e, "\t( $zahl , true, true  )\t(" . $rn -> getDec  ($e). ") \n";
    $e = $rn -> getRoman  ( $zahl ,true, false);         echo $e, "\t( $zahl ,true, false  )\t(" . $rn -> getDec  ($e). ") \n";
    $e = $rn -> getRoman  ( $zahl ,false, true);         echo $e, "\t( $zahl ,false, true  )\t(" . $rn -> getDec  ($e). ") \n";
    $e = $rn -> getRoman  ( $zahl ,false, false);        echo $e, "\t( $zahl ,false, false )\t(" . $rn -> getDec  ($e). ") \n";
}

$strings = array (
    'I',
    'IIII',
    'IV',
    'VIIII',
    'IX',
    'XI',
    'XIIII',
    'XIV',
    'LXXXX',
    'XC',
    'MCCCCXXXXIIII',
    'MCDXLIV',
    '&#8584;&#8578;&#8578;&#8578;&#8578;MMMMCCCCXXXXIIII',
    '&#8584;&#8578;&#8583;M&#8577;CDXLIV',
    'ↈↂↂↂↂMMMMCCCCXXXXIIII',
    'ↈↂↇMↁCDXLIV',
    '(((I)))((I))((I))((I))((I))MMMMCCCCXXXXIIII'
);

foreach ( $strings  as $string ) {
    echo $rn -> getDec  ($string)               , "\t( $string )\n";
}

#*/

/* Geschwindigkeit:
ob_start();
$startTime=microtime(1);
for ( $i = 1; $i < 100001; $i++ ) {
    $s = $rn -> getRoman( $i, false );
    $l = $rn -> getRoman( $i, false );
    $d = $rn -> getDec( $s );
    if ($d != $i) {
        echo "ERROR ( $i != $d\t$s\t$l )\n";
    } else {
        echo "FINE  ( $i != $d\t$s\t$l )\n";
    }
}
echo "TIME: ", (microtime(1) - $startTime)/60*1000 , " Microsekunden pro Berechnung. \n";
#*/