aboutsummaryrefslogtreecommitdiff
path: root/UnitTesting/GTMIPhoneUnitTestDelegate.m
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2012-02-21 19:00:23 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2012-02-21 19:00:23 +0000
commitb48bf7920e14a848a7307f96b6980257b94f4369 (patch)
treed5abca20e4886331dcfcf14e648f462e6cd56a33 /UnitTesting/GTMIPhoneUnitTestDelegate.m
parent1c2dd3f0c4d07b137b7888c89b0d6285d3de4ae4 (diff)
[Author: thomasvl]
The iOS 5.0 runtime doesn't seem to sort the class list any more, but it used to or we used to just get lucking in some of our testing. SenTest sorts the classes, so follow that lead also. R=dmaclach DELTA=13 (13 added, 0 deleted, 0 changed)
Diffstat (limited to 'UnitTesting/GTMIPhoneUnitTestDelegate.m')
-rw-r--r--UnitTesting/GTMIPhoneUnitTestDelegate.m13
1 files changed, 13 insertions, 0 deletions
diff --git a/UnitTesting/GTMIPhoneUnitTestDelegate.m b/UnitTesting/GTMIPhoneUnitTestDelegate.m
index 2017113..60baa0e 100644
--- a/UnitTesting/GTMIPhoneUnitTestDelegate.m
+++ b/UnitTesting/GTMIPhoneUnitTestDelegate.m
@@ -113,6 +113,14 @@
[self setRetainer:nil];
}
+static int ClassSort(const void *a, const void *b) {
+ Class *classA = (Class *)a;
+ Class *classB = (Class *)b;
+ const char *nameA = class_getName(*classA);
+ const char *nameB = class_getName(*classB);
+ return strcmp(nameA, nameB);
+}
+
// Run through all the registered classes and run test methods on any
// that are subclasses of SenTestCase. Print results and run time to
// the default output.
@@ -123,6 +131,11 @@
Class *classes = (Class*)[classData mutableBytes];
_GTMDevAssert(classes, @"Couldn't allocate class list");
objc_getClassList(classes, count);
+
+ // Follow SenTest's lead and sort the classes. (This may only be a change
+ // in the iOS 5 runtime, but make sure it is always sorted just incase)
+ mergesort(classes, count, sizeof(Class), ClassSort);
+
totalFailures_ = 0;
totalSuccesses_ = 0;
NSString *suiteName = [[NSBundle mainBundle] bundlePath];