8

I'm testing that functions in a service I made are accessible to activities that bind to it and this is what I call to ensure that

Comments
  • 3
    LOL is this the implementation of KISS? I do this so frequently
  • 0
    Not sure what language you're using, however make sure to turn all optimisation off, as most compilers will be able to know, that this function always returns 2 and thus replace the whole function call (including saving registers, setting up and tearing down a stackframe and so on) with a simple contant value...
  • 1
    #[test]
    fn returnsTwo() {
    assert_eq!(return_two(), 2);
    }
  • 0
    @iamavalos I like java, but I don't know enough about the inner workings of it's compiler. Still I think it would at least optimize the stack frame setup and teardown. Also test it there with the java equivalent of -o0
  • 1
    @Wack In Java any method not marked as final is virtual and can be overriden, so he should be fine.
Add Comment