MCPcopy Create free account
hub / github.com/LFYSec/MScan / check

Method check

src/test/resources/pta/contextsensitivity/LinkedQueue.java:57–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55 }
56
57 private boolean check() {
58 if (n < 0) {
59 return false;
60 } else if (n == 0) {
61 if (first != null) return false;
62 if (last != null) return false;
63 } else if (n == 1) {
64 if (first == null || last == null) return false;
65 if (first != last) return false;
66 if (first.next != null) return false;
67 } else {
68 if (first == null || last == null) return false;
69 if (first == last) return false;
70 if (first.next == null) return false;
71 if (last.next != null) return false;
72
73 // check internal consistency of instance variable n
74 int numberOfNodes = 0;
75 for (Node x = first; x != null && numberOfNodes <= n; x = x.next) {
76 numberOfNodes++;
77 }
78 if (numberOfNodes != n) return false;
79
80 // check internal consistency of instance variable last
81 Node lastNode = first;
82 while (lastNode.next != null) {
83 lastNode = lastNode.next;
84 }
85 if (last != lastNode) return false;
86 }
87
88 return true;
89 }
90
91 public static void main(String[] args) {
92 LinkedQueue q1 = new LinkedQueue();

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected