Ad
  • Custom User Avatar

    Will fail in case nodes addreess are not monotonically increase/decrease:

    Test(SampleTests, TwoNodesTileFourNodesLoopRandomOrder) {
      Node n[6];
    
      // 4 -> 1 -> 3 -> 0 -> 5 -> 2
      //           ^              |
      //           +--------------+
    
      n[4].next = &n[1];
      n[1].next = &n[3];
      n[3].next = &n[0];
      n[0].next = &n[5];
      n[5].next = &n[2];
      n[2].next = &n[3];
      
      Node* startNode = &n[4];
      int actual = loop_size(startNode);
      cr_assert_eq(actual, 4,
        "Incorrect answer for TwoNodesTileFourNodesLoopRandomOrder");
    }
    
  • Default User Avatar

    Hi, maybe my answer came too late. I had the same problem. In toAscii85, if the input string contains only zeros and less than 4 bytes, you should return <!!> if it only contains one zero, <!!!> for two zeros and <!!!!> for 3 zeros. On the other hand, if n = 0 (string length=0) you must return <~~>.