#!/usr/bin/perl # # Tests on Roman numeral modules # use strict; use warnings; use Convert::Number::Roman; use charnames ':full'; for my $arab (1, 5, 7, 8, 12, 13, 40, 84, 1024, 8192, 65536, 1048576, 2130706433, ) { my $cnr = Convert::Number::Roman->new($arab); my $roman = $cnr->convert; my $cnr1 = Convert::Number::Roman->new($roman); my $arab1 = $cnr1->convert; print "$arab -> $roman -> $arab1\n"; foreach (split '', $roman) { 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 and Les Mongueurs de Perl. This code is free software; you can redistribute it or modify it under the same terms as Perl 5.10.0.