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