i want to check if a collection is sorted in my UnitTest using XCTest, does swift iOS provide any such framework or method.
let countrieds = ["Alabama","Benin","Alaska","Togo"]
XCTAssertTrue(countrieds.sorted())
The above is just a sample and ofcourse i get the error below
Cannot convert value of type ‘[String]’ to expected argument type ‘Bool’
i will be glad to be educated on how to use XCTest to determine if a collection is sorted.
2
Answers
Use
or
A simple way to test that is to do an assertEqual with your array.
For exemple:
(In this exemple the test will return false obviously)