Skip to content
Snippets Groups Projects
  • Nat Goodspeed's avatar
    dcfc2889
    Fix breaking indra/test/llpermissions_tut.cpp tests. · dcfc2889
    Nat Goodspeed authored
    Certain tests of allowModifyBy(), allowCopyBy() and allowMoveBy() were
    computing a bit-shifted S32 value and testing that the method return value
    matched that specific bit. Whoever originally coded the test probably started
    with allowModifyBy() == TRUE, but observed that it didn't work. Instead of
    just testing for nonzero, in the spirit of BOOL, he then determined the
    specific BOOL value (typedef for 'int') returned by each test so he could
    still compare for equality. In other words, the tests were far too
    knowledgeable about the method implementation. At some point these methods
    were changed to return C++ standard 'bool' instead, so the internal
    bit-masking operations got mapped to 'true' and 'false' anyway, making it
    impossible for the original equality comparison to succeed. Fix tests
    accordingly.
    Use ensure_equals("msg", expr1, expr2) instead of ensure("msg", expr1 == expr2).
    On failure, the former will report the actual mismatched values.
    Remove other extraneous Microsoft-style "BOOL" usage (e.g. expr == TRUE).
    dcfc2889
    History
    Fix breaking indra/test/llpermissions_tut.cpp tests.
    Nat Goodspeed authored
    Certain tests of allowModifyBy(), allowCopyBy() and allowMoveBy() were
    computing a bit-shifted S32 value and testing that the method return value
    matched that specific bit. Whoever originally coded the test probably started
    with allowModifyBy() == TRUE, but observed that it didn't work. Instead of
    just testing for nonzero, in the spirit of BOOL, he then determined the
    specific BOOL value (typedef for 'int') returned by each test so he could
    still compare for equality. In other words, the tests were far too
    knowledgeable about the method implementation. At some point these methods
    were changed to return C++ standard 'bool' instead, so the internal
    bit-masking operations got mapped to 'true' and 'false' anyway, making it
    impossible for the original equality comparison to succeed. Fix tests
    accordingly.
    Use ensure_equals("msg", expr1, expr2) instead of ensure("msg", expr1 == expr2).
    On failure, the former will report the actual mismatched values.
    Remove other extraneous Microsoft-style "BOOL" usage (e.g. expr == TRUE).
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
llpermissions_tut.cpp 19.97 KiB