Ad
  • Custom User Avatar
    Can solve {"op":"~","inner":{"op":"*","left":40,"right":{"op":"~","inner":{"op":"~","inner":{"op":"~","inner":{"op":"~","inner":4}}}}}} without throwing
    
    Returns a list of instructions which contains the minimum viable items
    
    expected [Function] to not throw an error but 'AssertionError: Result is too short: expected 1 to be at least 6' was thrown
    

    Result is too short is clearly not what minimum viable items, as stated by the test block, means, so it's just plain confusing. It's also a very roundabout and kinda unreliable way of testing the actual requirement of not folding constants.

    If you want to check constants are not folded, you'd at least need to reconstruct the AST and check if they're structurally equal. That's the only way.

  • Custom User Avatar

    should correctly split negative numbers
    expected [ -1, -0 ] to deeply equal [ -1, 0 ]

    -1 + -0 == -1 too.

  • Custom User Avatar

    Dividing an integer is not a novel idea.