title: STAssertEquals for checking NSArray count - clean way
body: <p>What is the correct way to check the NSArray items count with STAssertEquals for NSArray.</p>
  
  <p>Following was expected to work:</p>
  
  <pre><code>...
  STAssertEquals(1, [myArray count], @"One item should be in array");
  </code></pre>
  
  <p>This code produces "Type mismatch" runtime error when running test.</p>
  
  <p>Instead I have to do an explicit cast to NSUInteger:</p>
  
  <pre><code>STAssertEquals((NSUInteger)1, [myArray count], @"One item should be in array");
  </code></pre>
  
  <p>This works - but looks kind a ugly due to explicit cast.</p>
  
  <p>I also want to avoid using STAssertTrue because STAssertEquals looks more appropriate (we compare two values) and shows the actual and expected values.</p>
  
  <p>What is correct way to check it in Objective-C?</p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>Thanks for the answers suggested to use 1u as unsigned int literal</p>
  
  <pre><code>STAssertEquals(1u, [myArray count], @"One item should be in array");
  </code></pre>
  
  <p>But as @Aaron mentioned it still ugly - I would like to use "1" directly - thinking on using myArray.count == 1 instead now. And the reason for it is that 1u doesn't look very clean. The 1 is 1 for me. You never write 1u in math :-) Any other suggestions?</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>As @H2CO3 mentioned 1u even could not always work and as suggested in some thread we could use more declarative definition for expected value which will solve the problem of casting:</p>
  
  <pre><code>NSUInteger expectedItemsCount = 1;
  STAssertEquals(expectedItemsCount, [myArray count], @"One item should be in array");
  </code></pre>
  
  <p>I prefer it to 1u solution because it looks cleaner. But the cons of this approach is that we have extra line and code is not very compact. So it looks like we have to choose between two approaches: <code>(NSUInteger)1</code> and <code>NSUInteger expectedItemsCount = 1;</code></p>