Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-25698

ASSERT_NOT alias for ASSERT_FALSE

    • Server Tooling & Methods
    • Fully Compatible

      In unittest/unittest.h, ASSERT_TRUE has ASSERT as an alias for readability.

      In a similar vein, some tests would benefit (in terms of readability) from having an ASSERT_NOT macro, which is an alias for ASSERT_FALSE.

      For example, I think this:

      ASSERT_NOT(::mongo::serverGlobalParams.cwd.empty());
      

      is more readable (ie. more clearly expresses the concept that "cwd is not empty") than either of the alternatives:

      // Slightly brain bending
      ASSERT_FALSE(::mongo::serverGlobalParams.cwd.empty());
      
      // The ! is easily missed (visually)
      ASSERT(!::mongo::serverGlobalParams.cwd.empty());
      

            Assignee:
            backlog-server-stm Backlog - Server Tooling and Methods (STM) (Inactive)
            Reporter:
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: