title: Force googletest signed vs unsigned comparison to fail
body: <p>First, I am new to googletest framework so be kind.</p>
  
  <p>I have a function</p>
  
  <pre><code>void setID(const int id)
  {
      ID = id;
  }
  </code></pre>
  
  <p>where ID is a global <code>unsigned int</code>. (Yes, globals are bad, I am just trying to figure what I am doing.)</p>
  
  <p>My unit test looks like this</p>
  
  <pre><code>TEST_F(TempTests, SetId)
  {
      // Arrange
      int id = -99;
  
      // Act
      setId(id);
  
      // Assert
      EXPECT_EQ(id, ID);
  }
  </code></pre>
  
  <p>The problem is my unit test always passes and I need it to fail as ID should have been a signed int not an unsigned int. If I hadn't visually caught the error the unit test would have passed and it could have caused errors later on.</p>
  
  <p>To make sure that this doesn't happen in the future it would be best if the unit test comparison failed in this case.</p>
  
  <p>I have tried static casting <code>id</code> and <code>ID</code> to signed and unsigned ints in various ways.
  I have tried doing <code>EXPECT_TRUE(id == ID)</code> with static casting the variables to signed and unsigned ints in various ways.
  But in all of these cases the result is a passing test.</p>
  
  <p>So how can I get gtest to compare the signed value of <code>id</code> and unsigned value of <code>ID</code> so that the test will fail because <code>id</code> will be -99 and <code>ID</code> will be 4294967197?</p>