当前位置: 首页>>代码示例>>PHP>>正文


PHP Calculator::count_tens方法代码示例

本文整理汇总了PHP中Calculator::count_tens方法的典型用法代码示例。如果您正苦于以下问题:PHP Calculator::count_tens方法的具体用法?PHP Calculator::count_tens怎么用?PHP Calculator::count_tens使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Calculator的用法示例。


在下文中一共展示了Calculator::count_tens方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test

 
 //test to find an instance of the calculator
 test ($calculator != null, "An instance of the calculator exists");
 
 //test to see if the calculator is set to zero
 test ($calculator->register == 0, "The calculator is set to zero");

  //test to see if the calculator can reject too large a number
 test ($calculator->too_high (41) == "Error: number too large to calculate", "The calculator can reject numbers too high to calculate");
 test ($calculator->too_high (40) == "Error: number too large to calculate", "The calculator can reject numbers too high to calculate");
 
 //test to see if the calculator can return 40
 test ($calculator->equals_fourty (40) == "XL", "The calculator can return the Roman number 40");
 
 //test to see if the calculator can calculate the correct number of Xs
 test ($calculator->count_tens (30) == "XXX", "The calculator counts the correct number of tens 30");
 test ($calculator->count_tens (20) == "XX", "The calculator counts the correct number of tens 20");
 test ($calculator->count_tens (10) == "X", "The calculator counts the correct number of tens 10");
 test ($calculator->count_tens (39) == "XXX", "The calculator counts the correct number of tens 39");
 
 //test to see if calculator can return 9
 test ($calculator->equals_nine (9) == "IX", "The calculator can return the Roman number 9");
 
 //test to see if the calculator can return the correct number of Vs
 test ($calculator->count_fives (5) == "V", "The calculator counts the correct number of fives 5");
 test ($calculator->count_fives (15) == "VVV", "The calculator counts the correct number of fives 15");
 
 //test to see if calculator can return 4
 test ($calculator->equals_four (4) == "IV", "The calculator can return the Roman number 4");
 
 //test to see if the calculator can return the correct number of Is
开发者ID:rmccaffrey,项目名称:dig1108-assignments,代码行数:30,代码来源:Old_Roman_Tests.php


注:本文中的Calculator::count_tens方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。