ObjFW  Diff

Differences From Artifact [63f1a92dda]:

  • File tests/OFSet.m — part of check-in [e1e7ffa903] at 2011-09-22 23:25:42 on branch trunk — Exceptions are now autoreleased.

    This is safe as an "exception loop" can't happen, since if allocating
    an exception fails, it throws an OFAllocFailedException which is
    preallocated and can always be thrown.

    So, the worst case would be that an autorelease of an exception fails,
    triggering an OFOutOfMemoryException for which there is no memory,
    resulting in an OFAllocFailedException to be thrown. (user: js, size: 3511) [annotate] [blame] [check-ins using]

To Artifact [809b5f5056]:


47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

	TEST(@"-[isEqual:]", [set1 isEqual: set2])

	TEST(@"-[hash]", [set1 hash] == [set2 hash])

	TEST(@"-[description]",
	    [[set1 description]
	    isEqual: @"{(\n\tbar,\n\tbaz,\n\tfoo,\n\tx\n)}"] &&
	    [[set1 description] isEqual: [set2 description]])

	TEST(@"-[copy]", [set1 isEqual: [[set1 copy] autorelease]])

	TEST(@"-[mutableCopy]",
	    (mutableSet = [[set1 mutableCopy] autorelease]));








|







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

	TEST(@"-[isEqual:]", [set1 isEqual: set2])

	TEST(@"-[hash]", [set1 hash] == [set2 hash])

	TEST(@"-[description]",
	    [[set1 description]
	    isEqual: @"{(\n\tbaz,\n\tbar,\n\tx,\n\tfoo\n)}"] &&
	    [[set1 description] isEqual: [set2 description]])

	TEST(@"-[copy]", [set1 isEqual: [[set1 copy] autorelease]])

	TEST(@"-[mutableCopy]",
	    (mutableSet = [[set1 mutableCopy] autorelease]));

94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifdef OF_HAVE_FAST_ENUMERATION
	ok = YES;
	i = 0;

	for (OFString *s in set1) {
		switch (i) {
		case 0:
			if (![s isEqual: @"bar"])
				ok = NO;
			break;
		case 1:
			if (![s isEqual: @"baz"])
				ok = NO;
			break;
		case 2:
			if (![s isEqual: @"foo"])
				ok = NO;
			break;
		case 3:
			if (![s isEqual: @"x"])
				ok = NO;
			break;
		}

		i++;
	}








|



|



|



|







94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifdef OF_HAVE_FAST_ENUMERATION
	ok = YES;
	i = 0;

	for (OFString *s in set1) {
		switch (i) {
		case 0:
			if (![s isEqual: @"baz"])
				ok = NO;
			break;
		case 1:
			if (![s isEqual: @"bar"])
				ok = NO;
			break;
		case 2:
			if (![s isEqual: @"x"])
				ok = NO;
			break;
		case 3:
			if (![s isEqual: @"foo"])
				ok = NO;
			break;
		}

		i++;
	}