Unit Test 5.2 Insights

Source: Internet
Author: User

Huang -201306114432 http://www.cnblogs.com/zzhuzi/

Fan Mingxiang -201306114431 http://www.cnblogs.com/vip-fan1234xiang/

It was TDD, and it took more than half an hour of video to do it.

Add TDD tools to the original program, make a class into TDD, and use it to generate operators;

class yy{private int max=4;private int min=1;private double w2,m2;private String ff Random random = new random ();//system.out.println (s); Public yy () {int s = random.nextint (max)% (max-min+1) + min;double x=random.nextint (max-2)% (max-2-min+1) + min;double y= Random.nextint (max-1)% (max-1-min+1) + min;int y1up= (int) Math.pow (10,x); int y1dn= (int) Math.pow (10,x-1); int y2up= (int ) Math.pow (10,y), int y2dn= (int) Math.pow (10,y-1), int x_y1=random.nextint (Y1UP)% (y1up-y1dn+1) + Y1dn;int x_y2= Random.nextint (y2up)% (y2up-y2dn+1) + y2dn;double w= (double) x_y1;double m= (double) x_y2;this.w2=w;this.m2=m; Switch (s) {case 1:{this.ff= "+"; System.out.println (w+ "+" +m+ "="); Case 2:{this.ff= "-"; System.out.println (w+ "-" +m+ "="); Case 3:{this.ff= "*"; SYSTEM.OUT.PRINTLN (w+ "*" +m+ "="); Case 4:{this.ff= "/"; System.out.println (w+ "/" +m+ "="); Public double Ret1 () {return w2;} Public double Ret2 () {return m2;} Public String Ret3 () {return ff;}} 

  

Summary: You will learn something only if you do it yourself;

Unit Test 5.2 Insights

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.