• Custom User Avatar

    I really struggled at first because of the lack of sample tests. I ended up just guessing based on comments that you could new Node() and passed that into loop_size in a test. Then console.logged it to see what I was actually dealing with. That gave me a look at the Node object. From there, the light bulbs started to go on, and I created this really ugly test. My first CW test! :-P

    describe("Ugly Test", function(){
      it("LinkedList of 7 nodes connected at 3rd should have a loop link of 5", function(){
        var first = new Node()
        var second = new Node()
        var third = new Node()
        var fourth = new Node();
        var fifth = new Node();
        var sixth = new Node();
        var seventh = new Node();
        var size = loop_size(first);
        Test.assertEquals(size, 5, "The size should be 5");
  • Custom User Avatar

    thanks for the explanation. didn't know you could pass a function as the second argument on a string replace. pretty cool.