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的更多相关文章
随机推荐
- Redis一个异常的解决办法,异常描述:Could not get a resource from the pool
异常描述: redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the poo ...
- JS学习笔记--轮播图效果
希望通过自己的学习收获哪怕收获一点点,进步一点点都是值得的,加油吧!!! 本章知识点:index this for if else 下边我分享下通过老师教的方式写的轮播图,基础知识实现: 1.css代 ...
- 对git的认识
对git这个词我听过但不了解,更谈不了认识.只能咨询百度了. Git是一个开源的分布式版本控制系统,用以有效.高速的处理从很小到非常大的项目版本管理. Git 是 Linus Torvalds 为了帮 ...
- onscroll
var COUNT = 0, demo = document.getElementById('demo'); function testFn() {demo.innerHTML += 'testFN ...
- WireShark网络性能分析
最近生产上出现一个性能问题,表现为:行情延时5s左右.从log一路追查下去,发现是我们自己写的一个行情网关(部署在xx.xx.xx.132)<->第三方的中转网关(部署在xx.xx.xx. ...
- 面试复习(C++)之快速排序
#include <iostream> using namespace std; void Quicksort(int *a,int low,int high) { if(low>h ...
- AnyCAD.NET C#开发CAD软件实践(一)
免费的AnyCAD.NET发布了!俺喜欢的C#有了大展前途的机会了. 打算用这个框架搭建一套实用的CAD系统,目标是能买出去10套以上. 先看看AnyCAD.NET的自我介绍. http://www. ...
- Java JDK 环境变量配置
1:环境 JDK1.7.0 WIN7 2:安装JDK 选择安装目录 安装过程中会出现两次 安装提示 .第一次是安装 jdk ,第二次是安装 jre .建议两个都安装在同一个java文件夹中的不同文件夹 ...
- iOS程序启动过程
First, the function creates the main application object (step 3 in the flowchart). If you specify ni ...
- C3P0连接池在hibernate和spring中的配置
首先为什么要使用连接池及为什么要选择C3P0连接池,这里就不多说了,目前C3P0连接池还是比较方便.比较稳定的连接池,能与spring.hibernate等开源框架进行整合. 一.hibernate中 ...