Remove CHECK_OPTIONAL_ARGUMENT_WITHOUT_EQUALITY() macro, define equality/inequality operators where needed

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • 3.2.0-rc0
    • Affects Version/s: None
    • Component/s: API, Testing
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The CHECK_OPTIONAL_ARGUMENT_WITHOUT_EQUALITY() macro doesn't check the return value of the getters it tests. For better test coverage, we should define equality operators and inequality operators for the mongocxx types we are currently testing using this macro, and then remove the macro entirely.

      Specifically, we will define the following:

          friend MONGOCXX_API bool MONGOCXX_CALL operator==(const write_concern&, const write_concern&);
          friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const write_concern&, const write_concern&);
          friend MONGOCXX_API bool MONGOCXX_CALL operator==(const read_concern&, const read_concern&);
          friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const read_concern&, const read_concern&);
          friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const read_preference&,
                                                            const read_preference&);
      

      Original description:

      Currently, CHECK_OPTIONAL_ARGUMENT_WITHOUT_EQUALITY() is used for verifying the existence of getters that return objects which don't provide operator==(). However, in all of our existing uses of this macro, we have no other test coverage that examines the return value of these getters being tested.

      To improve our test coverage of these getter methods, we should remove CHECK_OPTIONAL_ARGUMENT_WITHOUT_EQUALITY() and extend CHECK_OPTIONAL_ARGUMENT() to support custom equality checks for non-comparable types.

            Assignee:
            J Rassi (Inactive)
            Reporter:
            J Rassi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: