代码测试
Posted zecdllg
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了代码测试相关的知识,希望对你有一定的参考价值。
public class Test { Node headnode1 = new Node(); Node headnode2 = new Node(); // static Node headnode2=new Node(); @Before public void beforeTest1() { headnode1.data = 5; Node node2 = new Node(); node2.data = 6; Node node3 = new Node(); node3.data = 12; Node node4 = new Node(); node4.data = 14; headnode1.next = node2; node2.next = node3; node3.next = node4; // node4.next=node2; //有环无环 } @Before public void beforeTest2() { headnode2.data = 2; Node node2 = new Node(); node2.data = 8; Node node3 = new Node(); node3.data = 13; headnode2.next = node2; node2.next = node3; } @org.junit.Test public void testReverse() { ListReverse listReverse = new ListReverse(); System.out.println("----------" + headnode1.data); Node node = listReverse.reverse(headnode1); System.out.println("----------" + node.data); } @org.junit.Test public void testCheckCircle() { CheckCircle checkCircle = new CheckCircle(); HashMap map = checkCircle.isCircle(headnode1); boolean flag = map.containsKey(true); int len = checkCircle.length(headnode1); System.out.println(flag + "-----" + len); } @org.junit.Test public void testInsert() { InsertList insertList=new InsertList(); Node node=insertList.Insert(headnode1,headnode2); while(headnode1!=null){ System.out.print(headnode1.data+"--"); headnode1=headnode1.next; } System.out.println(); while(headnode2!=null){ System.out.print(headnode2.data+"--"); headnode2=headnode2.next; } System.out.println(); while(node!=null){ System.out.print(node.data+"--"); node=node.next; } } }
public class Node { public int data; public Node next = null; public Node(Node node) { this.data = node.data; this.next = node.next; } public Node(int data) { this.data = data; this.next = null; } public Node() { this.data = 0; this.next = null; } }
以上是关于代码测试的主要内容,如果未能解决你的问题,请参考以下文章
typescript Angular 2测试片段。代码库https://developers.livechatinc.com/blog/category/programming/angular-2/
typescript Angular最终版本的Angular 2测试片段。代码库https://developers.livechatinc.com/blog/category/programming
typescript Angular最终版本的Angular 2测试片段。代码库https://developers.livechatinc.com/blog/category/programming
typescript Angular最终版本的Angular 2测试片段。代码库https://developers.livechatinc.com/blog/category/programming