public void KataTests() { LDNode n; n = LoopDetector.createChain(1, 3); _pobj.getLoopSize(n).ShouldBe(3); n = LoopDetector.createChain(3, 30); _pobj.getLoopSize(n).ShouldBe(30); n = LoopDetector.createChain(3904, 1087); _pobj.getLoopSize(n).ShouldBe(1087); }
private void TestSingleChain(int taillength, int looplength) { LDNode n, n2; n = LoopDetector.createChain(taillength, looplength); for (int i = 0; i < taillength; i++) { //Console.WriteLine($"tail {i}: {n.ID}"); n = n.next; } n2 = n; for (int i = 0; i < looplength - 1; i++) { //Console.WriteLine($"loop {i}: {n2.next.ID}"); n2 = n2.next; } //n2.next.ID.ShouldBe(n.ID); n2.ShouldBe(n); }
public void RandomLongChainNodesWithLoopSize103387() { var n1 = LoopDetector.createChain(3903004, 2103387); Assert.AreEqual(2103387, Kata.getLoopSize(n1)); }
public void RandomChainNodesWithLoopSize30() { var n1 = LoopDetector.createChain(3, 30); Assert.AreEqual(30, Kata.getLoopSize(n1)); }