1 Star 0 Fork 0

besti1923/JAVA

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
calculatorTest.java 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
yifei 提交于 5年前 . the second experiment
package text.java;
public class calculatorTest { //单元测试
public static void main(String[] args) {
a g;
g =new a(8,5,'+');
float result1 = g.test(); //给a,b赋值代入测试,c为运算符号
if(result1==13){
System.out.println("pass+"); //加法测试通过
}
else{
System.out.println("fault+"+result1); //加法测试失败
}
g =new a(8,5,'-');
float result2 = g.test();
if(result2==3){
System.out.println("pass-"); //减法测试通过
}
else{
System.out.println("fault-");
}
g =new a(8,5,'*');
float result3 = g.test();
if(result3==40){
System.out.println("pass*"); //乘法测试通过
}
else{
System.out.println("fault*");
}
g =new a(8,5,'/');
float result4 = g.test();
if(result4==(float)1.6){
System.out.println("pass/"); //除法测试通过
}
else{
System.out.println("fault/");
}
g =new a(8,5,'%');
float result5 = g.test();
if(result5==3){
System.out.println("pass%"); //模测试通过
}
else{
System.out.println("fault%");
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/besti1923/java.git
git@gitee.com:besti1923/java.git
besti1923
java
JAVA
master

搜索帮助