#!/usr/bin/perl # # Tests sur les modules de nombres romains # use strict; use warnings; use Convert::Number::Roman; use charnames ':full'; for my $av (1, 5, 7, 8, 12, 13, 40, 84, 1024, 8192, 65536, 1048576, 2130706433, ) { my $cnr = Convert::Number::Roman->new($av); my $ap = $cnr->convert; my $cnr1 = Convert::Number::Roman->new($ap); my $av1 = $cnr1->convert; print "$av -> $ap -> $av1\n"; foreach (split '', $ap) { printf " U+%04X %s\n", ord($_), charnames::viacode(ord($_)); } } 1 -> Ⅰ -> 1 U+2160 ROMAN NUMERAL ONE 5 -> Ⅴ -> 5 U+2164 ROMAN NUMERAL FIVE 7 -> Ⅶ -> 7 U+2166 ROMAN NUMERAL SEVEN 8 -> Ⅷ -> 8 U+2167 ROMAN NUMERAL EIGHT 12 -> Ⅻ -> 12 U+216B ROMAN NUMERAL TWELVE 13 -> ⅩⅢ -> 13 U+2169 ROMAN NUMERAL TEN U+2162 ROMAN NUMERAL THREE 40 -> ⅩⅬ -> 40 U+2169 ROMAN NUMERAL TEN U+216C ROMAN NUMERAL FIFTY 84 -> ⅬⅩⅩⅩⅣ -> 84 U+216C ROMAN NUMERAL FIFTY U+2169 ROMAN NUMERAL TEN U+2169 ROMAN NUMERAL TEN U+2169 ROMAN NUMERAL TEN U+2163 ROMAN NUMERAL FOUR 1024 -> ⅯⅩⅩⅣ -> 1024 U+216F ROMAN NUMERAL ONE THOUSAND U+2169 ROMAN NUMERAL TEN U+2169 ROMAN NUMERAL TEN U+2163 ROMAN NUMERAL FOUR 8192 -> ↁⅯⅯⅯⅭⅩⅭⅡ -> 8192 U+2181 ROMAN NUMERAL FIVE THOUSAND U+216F ROMAN NUMERAL ONE THOUSAND U+216F ROMAN NUMERAL ONE THOUSAND U+216F ROMAN NUMERAL ONE THOUSAND U+216D ROMAN NUMERAL ONE HUNDRED U+2169 ROMAN NUMERAL TEN U+216D ROMAN NUMERAL ONE HUNDRED U+2161 ROMAN NUMERAL TWO 65536 -> Ⅼ̄Ⅹ̄Ⅴ̄ⅮⅩⅩⅩⅥ -> 65536 U+216C ROMAN NUMERAL FIFTY U+0304 COMBINING MACRON U+2169 ROMAN NUMERAL TEN U+0304 COMBINING MACRON U+2164 ROMAN NUMERAL FIVE U+0304 COMBINING MACRON U+216E ROMAN NUMERAL FIVE HUNDRED U+2169 ROMAN NUMERAL TEN U+2169 ROMAN NUMERAL TEN U+2169 ROMAN NUMERAL TEN U+2165 ROMAN NUMERAL SIX 1048576 -> Ⅰ̿Ⅹ̄Ⅼ̄Ⅷ̄ⅮⅬⅩⅩⅥ -> 1048576 U+2160 ROMAN NUMERAL ONE U+033F COMBINING DOUBLE OVERLINE U+2169 ROMAN NUMERAL TEN U+0304 COMBINING MACRON U+216C ROMAN NUMERAL FIFTY U+0304 COMBINING MACRON U+2167 ROMAN NUMERAL EIGHT U+0304 COMBINING MACRON U+216E ROMAN NUMERAL FIVE HUNDRED U+216C ROMAN NUMERAL FIFTY U+2169 ROMAN NUMERAL TEN U+2169 ROMAN NUMERAL TEN U+2165 ROMAN NUMERAL SIX 2130706433 -> Ⅱ̿̄Ⅽ̿Ⅹ̿Ⅹ̿Ⅹ̿Ⅾ̄Ⅽ̄Ⅽ̄Ⅵ̄ⅭⅮⅩⅩⅩⅢ -> 2130706433 U+2161 ROMAN NUMERAL TWO U+033F COMBINING DOUBLE OVERLINE U+0304 COMBINING MACRON U+216D ROMAN NUMERAL ONE HUNDRED U+033F COMBINING DOUBLE OVERLINE U+2169 ROMAN NUMERAL TEN U+033F COMBINING DOUBLE OVERLINE U+2169 ROMAN NUMERAL TEN U+033F COMBINING DOUBLE OVERLINE U+2169 ROMAN NUMERAL TEN U+033F COMBINING DOUBLE OVERLINE U+216E ROMAN NUMERAL FIVE HUNDRED U+0304 COMBINING MACRON U+216D ROMAN NUMERAL ONE HUNDRED U+0304 COMBINING MACRON U+216D ROMAN NUMERAL ONE HUNDRED U+0304 COMBINING MACRON U+2165 ROMAN NUMERAL SIX U+0304 COMBINING MACRON U+216D ROMAN NUMERAL ONE HUNDRED U+216E ROMAN NUMERAL FIVE HUNDRED U+2169 ROMAN NUMERAL TEN U+2169 ROMAN NUMERAL TEN U+2169 ROMAN NUMERAL TEN U+2162 ROMAN NUMERAL THREE
© 2011 Jean Forget et Les Mongueurs de Perl. Ce code est du logiciel libre. Vous pouvez le redistribuer ou le modifier sous les mêmes termes que Perl 5.10.0.