The preliminary cognition of UNIT4 test

Source: Internet
Author: User

This test is for the simple use of UNIT4 testing, heavy learning.
The test code is a for () function.
The operating mechanism is to first generate a random number of shaping, and then for the For loop generation I is equal to the random number, I returns the value result.
The test is to compare whether the generated random number is equal to result.
Learning difficulties:
GitHub is particularly difficult to use as a new tool, especially in English.
Project GitHub Address: Https://github.com/lgspath/unit4_test
Package Unit4_test1;public class Unit_test {private static int result;private static int rrandom;public int number () {int random = (int) math.random (); rrandom = Random;return rrandom;} public void for () {for (int i = 0; i < rrandom; i++) {result = i;}} public int GetResult () {return result;}}

  

Package Unit4_test1;import static Org.junit.assert.*;import Org.junit.before;import Org.junit.test;public class Unit_ testtest {private static unit_test unit4_test = new Unit_test (); @Beforepublic void SetUp () throws Exception {} @Testpublic void Testfor () {unit4_test. for (); Assertequals (unit4_test. Number (), Unit4_test.getresult ());}}

  

The preliminary cognition of UNIT4 test

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.