123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <?php
- namespace fphammerle\helpers\tests;
- use \fphammerle\helpers\NumberHelper;
- class NumberHelperTest extends \PHPUnit_Framework_TestCase
- {
- public function setBasenameProvider()
- {
- return [
- [1, 'I'],
- [2, 'II'],
- [3, 'III'],
- [4, 'IV'],
- [5, 'V'],
- [6, 'VI'],
- [7, 'VII'],
- [8, 'VIII'],
- [9, 'IX'],
- [10, 'X'],
- [11, 'XI'],
- [12, 'XII'],
- [13, 'XIII'],
- [14, 'XIV'],
- [15, 'XV'],
- [16, 'XVI'],
- [17, 'XVII'],
- [18, 'XVIII'],
- [19, 'XIX'],
- [20, 'XX'],
- [21, 'XXI'],
- [22, 'XXII'],
- [23, 'XXIII'],
- [24, 'XXIV'],
- [25, 'XXV'],
- [26, 'XXVI'],
- [27, 'XXVII'],
- [28, 'XXVIII'],
- [29, 'XXIX'],
- [30, 'XXX'],
- [31, 'XXXI'],
- [32, 'XXXII'],
- [33, 'XXXIII'],
- [34, 'XXXIV'],
- [35, 'XXXV'],
- [36, 'XXXVI'],
- [37, 'XXXVII'],
- [38, 'XXXVIII'],
- [39, 'XXXIX'],
- [40, 'XL'],
- [41, 'XLI'],
- [42, 'XLII'],
- [43, 'XLIII'],
- [44, 'XLIV'],
- [45, 'XLV'],
- [46, 'XLVI'],
- [47, 'XLVII'],
- [48, 'XLVIII'],
- [49, 'XLIX'],
- [50, 'L'],
- [51, 'LI'],
- [52, 'LII'],
- [53, 'LIII'],
- [54, 'LIV'],
- [55, 'LV'],
- [56, 'LVI'],
- [57, 'LVII'],
- [58, 'LVIII'],
- [59, 'LIX'],
- [60, 'LX'],
- [61, 'LXI'],
- [62, 'LXII'],
- [63, 'LXIII'],
- [64, 'LXIV'],
- [65, 'LXV'],
- [66, 'LXVI'],
- [67, 'LXVII'],
- [68, 'LXVIII'],
- [69, 'LXIX'],
- [70, 'LXX'],
- [71, 'LXXI'],
- [72, 'LXXII'],
- [73, 'LXXIII'],
- [74, 'LXXIV'],
- [75, 'LXXV'],
- [76, 'LXXVI'],
- [77, 'LXXVII'],
- [78, 'LXXVIII'],
- [79, 'LXXIX'],
- [80, 'LXXX'],
- [81, 'LXXXI'],
- [82, 'LXXXII'],
- [83, 'LXXXIII'],
- [84, 'LXXXIV'],
- [85, 'LXXXV'],
- [86, 'LXXXVI'],
- [87, 'LXXXVII'],
- [88, 'LXXXVIII'],
- [89, 'LXXXIX'],
- [90, 'XC'],
- [91, 'XCI'],
- [92, 'XCII'],
- [93, 'XCIII'],
- [94, 'XCIV'],
- [95, 'XCV'],
- [96, 'XCVI'],
- [97, 'XCVII'],
- [98, 'XCVIII'],
- [99, 'XCIX'],
- [100, 'C'],
- [101, 'CI'],
- [104, 'CIV'],
- [109, 'CIX'],
- [149, 'CXLIX'],
- [161, 'CLXI'],
- [177, 'CLXXVII'],
- [189, 'CLXXXIX'],
- [199, 'CXCIX'],
- [200, 'CC'],
- [201, 'CCI'],
- [204, 'CCIV'],
- [209, 'CCIX'],
- [249, 'CCXLIX'],
- [261, 'CCLXI'],
- [277, 'CCLXXVII'],
- [289, 'CCLXXXIX'],
- [299, 'CCXCIX'],
- [300, 'CCC'],
- [400, 'CD'],
- [401, 'CDI'],
- [404, 'CDIV'],
- [409, 'CDIX'],
- [449, 'CDXLIX'],
- [461, 'CDLXI'],
- [477, 'CDLXXVII'],
- [489, 'CDLXXXIX'],
- [499, 'CDXCIX'],
- [500, 'D'],
- [600, 'DC'],
- [700, 'DCC'],
- [800, 'DCCC'],
- [900, 'CM'],
- [1000, 'M'],
- [1100, 'MC'],
- [1200, 'MCC'],
- [1300, 'MCCC'],
- [1400, 'MCD'],
- [1500, 'MD'],
- [1600, 'MDC'],
- [1700, 'MDCC'],
- [1800, 'MDCCC'],
- [1900, 'MCM'],
- [1990, 'MCMXC'],
- [1991, 'MCMXCI'],
- [1992, 'MCMXCII'],
- [1993, 'MCMXCIII'],
- [1994, 'MCMXCIV'],
- [1995, 'MCMXCV'],
- [1996, 'MCMXCVI'],
- [1997, 'MCMXCVII'],
- [1998, 'MCMXCVIII'],
- [1999, 'MCMXCIX'],
- [2000, 'MM'],
- [2001, 'MMI'],
- [2002, 'MMII'],
- [2003, 'MMIII'],
- [2004, 'MMIV'],
- [2005, 'MMV'],
- [2006, 'MMVI'],
- [2007, 'MMVII'],
- [2008, 'MMVIII'],
- [2009, 'MMIX'],
- [2010, 'MMX'],
- [2011, 'MMXI'],
- [2012, 'MMXII'],
- [2013, 'MMXIII'],
- [2014, 'MMXIV'],
- [2015, 'MMXV'],
- [2016, 'MMXVI'],
- [2017, 'MMXVII'],
- [2018, 'MMXVIII'],
- [2019, 'MMXIX'],
- [2020, 'MMXX'],
- ];
- }
- /**
- * @dataProvider setBasenameProvider
- */
- public function testFormatRoman($number, $expected_roman)
- {
- $this->assertSame($expected_roman, NumberHelper::formatRoman($number));
- }
- }
|