Some of the unit tests had the order of asserted arguments mixed up:
XCTAssertEqual(expected, actual)
instead of
XCTAssertEqual(actual, expected)
Even though == is commutative the widely established standard order is assert(actual == expected) (or assert_eq(actual, expected)).
Local bindings
Others passed the value at test as an rvalue directly into the assert.
By introducing local bindings actual/expected where missing it becomes trivial to temporarily add a print(actual) or the like (since Xcode's assert popover is pretty much useless with its unformatted "wall of text" output).
It also improves the uniformity of the test suite, requiring less reading/parsing/thinking to understand the individual tests.
Order of arguments
Some of the unit tests had the order of asserted arguments mixed up:
instead of
Even though
==
is commutative the widely established standard order isassert(actual == expected)
(orassert_eq(actual, expected)
).Local bindings
Others passed the value at test as an rvalue directly into the assert.
By introducing local bindings
actual
/expected
where missing it becomes trivial to temporarily add aprint(actual)
or the like (since Xcode's assert popover is pretty much useless with its unformatted "wall of text" output).It also improves the uniformity of the test suite, requiring less reading/parsing/thinking to understand the individual tests.