software_testing_work3_question2
package com.Phantom; import java.rmi.server.Operation;
import java.util.Scanner; public class Work3_2 { /**
* @param args
*/
float x;
float y;
String step1;
String step2;
String step3; public void setX(float x) {
this.x = x;
} public void setY(float y) {
this.y = y;
} public Work3_2() {
} public int operation(){
step1="a";
if(x<4||y>0){
step2="b";
if(y>1){
step3="c";
y=y+1;
}
else{
step3="d";
}
}
else{
step2="e";
if(x>=5){
step3="f";
x=x-y;
}
else{
step3="g";
x=x+y;
}
}
System.out.println("输出X >>>"+x);
System.out.println("输出Y >>>"+y);
System.out.println("路径:");
System.out.println(step1+"——>"+step2+"——>"+step3);
return 0;
} }
测试类
package com.Phantom; import static org.junit.Assert.*; import org.junit.After;
import org.junit.Before;
import org.junit.Test; public class Work3_2_teting {
private Work3_2 w1;
@Before
public void setUp() throws Exception {
w1=new Work3_2();
} @After
public void tearDown() throws Exception {
} @Test
public void test() {
/*
* a-e-g
* */
w1.setX(4);
w1.setY(0);
w1.operation();
System.out.println("-----------------");
/*
* a-e-f
* */
w1.setX(5);
w1.setY(0);
w1.operation();
System.out.println("-----------------");
/*
* a-b-d_(1)
* */
w1.setX(4);
w1.setY((float) 0.1);
w1.operation();
System.out.println("-----------------");
/*
* a-b-d_(2)
* */
w1.setX(3);
w1.setY(-1);
w1.operation();
System.out.println("-----------------");
/*
* a-b-c
* */
w1.setX(4);
w1.setY(2);
w1.operation();
System.out.println("-----------------"); } }
运行junit测试



software_testing_work3_question2的更多相关文章
随机推荐
- C++中的const和指针组合
在C++里,const修饰指针有以下三种情况 (1)指针常量:即指向常量的指针 const int *p或者int const *p const在*前,,可以这样理解它的功能,因为const在*前, ...
- CSS3支持box-flex弹性布局
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title> ...
- C# 技巧(3) C# 操作 JSON
RestAPI中, 经常需要操作json字符串, 需要把json字符串"反序列化"成一个对象, 也需要把一个对象"序列化"成一字符串. C# 操作json, ...
- RP4412开发板烧写Ubuntu12.04失败原因分析解决
Ubuntu烧写失败可能是卡的问题 问:用RP4412开发板,卡烧了光盘中的fastboot失败,现在如何补救呢? 答:INAND格式化,利用usb来升级啊. 也有文档,看升级文档. 问:这个是怎么回 ...
- 深度剖析Linux与Windows系统的区别
当我们每个人接触Linux之前,应该先接触的都是windows吧?但我们一般接触Linux后,习惯linux的管理和使用方法后,我们再回过头再来使用windows的时候,内心其实是拒绝的.我们会觉得图 ...
- IOS Core Animation Advanced Techniques的学习笔记(五)
第六章:Specialized Layers 类别 用途 CAEmitterLayer 用于实现基于Core Animation粒子发射系统.发射器层对象控制粒子的生成和起源 CAGradient ...
- IOS Core Animation Advanced Techniques的学习笔记(四)
第五章:Transforms Affine Transforms CGAffineTransform是二维的 Creating a CGAffineTransform 主要有三种变 ...
- 20140701立项 移植WatermarkLabelSys
开始移植WatermarkLabelSys,从一个版本中抽离出最原始的内核,不求完善,只求能运行.时间半个月. 顺利的话针对不同的后缀.进程开始添加规则细节,时间1个月. 在顺利的话,兼容性测试,完善 ...
- Codeforces Round #383 (Div. 1)
A: 题目大意:给出一个有向图(n<=100),每个点的出度都为1,求最小的t,使得任意两点x,y,如果x走t步后能到y,那么y走t步后到x. 题解: 首先每个点应该都在一个环上,否则无解. 对 ...
- 5.String
一.古罗马皇帝凯撒在打仗时曾经使用过一种方法加密军事情报.请编写一个程序,使用上述算法加密或解密用户输入的英文字串. 设计思想:先提示用户进行的操作是加密还是解密,用户输入一个字符串,加密时将前23个 ...