1 //===-- main.m ------------------------------------------------*- ObjC -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #import <Foundation/Foundation.h>
11 #if defined(__APPLE__)
12 #if defined(__arm__) || defined(__arm64__) || defined(__aarch64__)
18 #import <Foundation/NSGeometry.h>
20 #import <Carbon/Carbon.h>
23 @interface MyClass : NSObject
30 - (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z;
31 - (int)doIncrementByInt: (int)x;
35 @interface MyOtherClass : MyClass
40 - (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z andOtherInt:(int)q;
44 @implementation MyClass
46 - (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z
57 - (int)doIncrementByInt: (int)x
65 @implementation MyOtherClass
67 - (id)initWithInt: (int)x andFloat:(float)y andChar:(char)z andOtherInt:(int)q
69 self = [super initWithInt:x andFloat:y andChar:z];
72 self->backup = [[MyClass alloc] initWithInt:x andFloat:y andChar:z];
79 @interface Atom : NSObject {
82 -(void)setMass:(float)newMass;
86 @interface Molecule : NSObject {
89 -(void)setAtoms:(NSArray *)newAtoms;
95 -(void)setMass:(float)newMass
106 @implementation Molecule
108 -(void)setAtoms:(NSArray *)newAtoms
118 @interface My_KVO_Observer : NSObject
119 -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change
120 context:(void *)context;
125 @implementation My_KVO_Observer
126 -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change
127 context:(void *)context {
128 // we do not really care about KVO'ing - do nothing
143 int main (int argc, const char * argv[])
146 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
148 MyClass *object = [[MyClass alloc] initWithInt:1 andFloat:3.14 andChar: 'E'];
150 [object doIncrementByInt:3];
152 MyOtherClass *object2 = [[MyOtherClass alloc] initWithInt:2 andFloat:6.28 andChar: 'G' andOtherInt:-1];
154 [object2 doIncrementByInt:3];
156 NSNumber* num1 = [NSNumber numberWithInt:5];
157 NSNumber* num2 = [NSNumber numberWithFloat:3.14];
158 NSNumber* num3 = [NSNumber numberWithDouble:3.14];
159 NSNumber* num4 = [NSNumber numberWithUnsignedLongLong:0xFFFFFFFFFFFFFFFE];
160 NSNumber* num5 = [NSNumber numberWithChar:'A'];
161 NSNumber* num6 = [NSNumber numberWithUnsignedLongLong:0xFF];
162 NSNumber* num7 = [NSNumber numberWithLong:0x1E8480];
163 NSNumber* num8_Y = [NSNumber numberWithBool:YES];
164 NSNumber* num8_N = [NSNumber numberWithBool:NO];
165 NSNumber* num9 = [NSNumber numberWithShort:0x1E8480];
166 NSNumber* num_at1 = @12;
167 NSNumber* num_at2 = @-12;
168 NSNumber* num_at3 = @12.5;
169 NSNumber* num_at4 = @-12.5;
171 NSDecimalNumber* decimal_number = [NSDecimalNumber decimalNumberWithMantissa:123456 exponent:-10 isNegative:NO];
172 NSDecimalNumber* decimal_number_neg = [NSDecimalNumber decimalNumberWithMantissa:123456 exponent:10 isNegative:YES];
173 NSDecimalNumber* decimal_one = [NSDecimalNumber one];
174 NSDecimalNumber* decimal_zero = [NSDecimalNumber zero];
175 NSDecimalNumber* decimal_nan = [NSDecimalNumber notANumber];
177 NSString *str0 = [num6 stringValue];
179 NSString *str1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding];
181 NSString *str2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"];
183 NSString *str3 = @"A string made with the at sign is here";
185 NSString *str4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4];
187 NSRect ns_rect_4str = {{1,1},{5,5}};
189 NSString* str5 = NSStringFromRect(ns_rect_4str);
191 NSString* str6 = [@"/usr/doc/README.1ST" pathExtension];
193 const unichar myCharacters[] = {0x03C3,'x','x'};
194 NSString *str7 = [NSString stringWithCharacters: myCharacters
195 length: sizeof myCharacters / sizeof *myCharacters];
197 NSString* str8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension];
199 const unichar myOtherCharacters[] = {'a',' ', 'v','e','r','y',' ',
200 'm','u','c','h',' ','b','o','r','i','n','g',' ','t','a','s','k',
201 ' ','t','o',' ','w','r','i','t','e', ' ', 'a', ' ', 's', 't', 'r', 'i', 'n', 'g', ' ',
202 't','h','i','s',' ','w','a','y','!','!',0x03C3, 0};
203 NSString *str9 = [NSString stringWithCharacters: myOtherCharacters
204 length: sizeof myOtherCharacters / sizeof *myOtherCharacters];
206 const unichar myNextCharacters[] = {0x03C3, 0x0000};
208 NSString *str10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4];
210 NSString *str11 = NSStringFromClass([str10 class]);
212 NSString *label1 = @"Process Name: ";
213 NSString *label2 = @"Process Id: ";
214 NSString *processName = [[NSProcessInfo processInfo] processName];
215 NSString *processID = [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]];
216 NSString *str12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
218 NSString *strA1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding];
220 NSString *strA2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"];
222 NSString *strA3 = @"A string made with the at sign is here";
224 NSString *strA4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4];
226 NSString* strA5 = NSStringFromRect(ns_rect_4str);
228 NSString* strA6 = [@"/usr/doc/README.1ST" pathExtension];
230 NSString *strA7 = [NSString stringWithCharacters: myCharacters
231 length: sizeof myCharacters / sizeof *myCharacters];
233 NSString* strA8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension];
235 NSString *strA9 = [NSString stringWithCharacters: myOtherCharacters
236 length: sizeof myOtherCharacters / sizeof *myOtherCharacters];
238 NSString *strA10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4];
240 NSString *strA11 = NSStringFromClass([str10 class]);
242 NSString *strA12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
244 NSString *strB1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding];
246 NSString *strB2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"];
248 NSString *strB3 = @"A string made with the at sign is here";
250 NSString *strB4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4];
252 NSString* strB5 = NSStringFromRect(ns_rect_4str);
254 NSString* strB6 = [@"/usr/doc/README.1ST" pathExtension];
256 NSString *strB7 = [NSString stringWithCharacters: myCharacters
257 length: sizeof myCharacters / sizeof *myCharacters];
259 NSString* strB8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension];
261 NSString *strB9 = [NSString stringWithCharacters: myOtherCharacters
262 length: sizeof myOtherCharacters / sizeof *myOtherCharacters];
264 NSString *strB10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4];
266 NSString *strB11 = NSStringFromClass([str10 class]);
268 NSString *strB12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
270 NSString *strC11 = NSStringFromClass([str10 class]);
272 NSString *strC12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
274 NSString *strC1 = [NSString stringWithCString:"A rather short ASCII NSString object is here" encoding:NSASCIIStringEncoding];
276 NSString *strC2 = [NSString stringWithUTF8String:"A rather short UTF8 NSString object is here"];
278 NSString *strC3 = @"A string made with the at sign is here";
280 NSString *strC4 = [NSString stringWithFormat:@"This is string number %ld right here", (long)4];
282 NSString* strC5 = NSStringFromRect(ns_rect_4str);
284 NSString* strC6 = [@"/usr/doc/README.1ST" pathExtension];
286 NSString *strC7 = [NSString stringWithCharacters: myCharacters
287 length: sizeof myCharacters / sizeof *myCharacters];
289 NSString* strC8 = [@"/usr/doc/file.hasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTimehasVeryLongExtensionThisTime" pathExtension];
291 NSString *strC9 = [NSString stringWithCharacters: myOtherCharacters
292 length: sizeof myOtherCharacters / sizeof *myOtherCharacters];
294 NSString *strC10 = [NSString stringWithFormat:@"This is a Unicode string %S number %ld right here", myNextCharacters, (long)4];
296 NSString *strD11 = NSStringFromClass([str10 class]);
298 NSString *strD12 = [NSString stringWithFormat:@"%@ %@ %@ %@", label1, processName, label2, processID];
300 NSString *eAcute = [NSString stringWithFormat: @"%C", 0x00E9];
301 NSString *randomHaziChar = [NSString stringWithFormat: @"%C", 0x9DC5];
302 NSString *japanese = @"色は匂へど散りぬるを";
303 NSString *italian = @"L'Italia è una Repubblica democratica, fondata sul lavoro. La sovranità appartiene al popolo, che la esercita nelle forme e nei limiti della Costituzione.";
304 NSString* french = @"Que veut cette horde d'esclaves, De traîtres, de rois conjurés?";
305 NSString* german = @"Über-Ich und aus den Ansprüchen der sozialen Umwelt";
307 void* data_set[3] = {str1,str2,str3};
309 NSString *hebrew = [NSString stringWithString:@"לילה טוב"];
311 NSArray* newArray = [[NSMutableArray alloc] init];
312 [newArray addObject:str1];
313 [newArray addObject:str2];
314 [newArray addObject:str3];
315 [newArray addObject:str4];
316 [newArray addObject:str5];
317 [newArray addObject:str6];
318 [newArray addObject:str7];
319 [newArray addObject:str8];
320 [newArray addObject:str9];
321 [newArray addObject:str10];
322 [newArray addObject:str11];
323 [newArray addObject:str12];
324 [newArray addObject:strA1];
325 [newArray addObject:strA2];
326 [newArray addObject:strA3];
327 [newArray addObject:strA4];
328 [newArray addObject:strA5];
329 [newArray addObject:strA6];
330 [newArray addObject:strA7];
331 [newArray addObject:strA8];
332 [newArray addObject:strA9];
333 [newArray addObject:strA10];
334 [newArray addObject:strA11];
335 [newArray addObject:strA12];
336 [newArray addObject:strB1];
337 [newArray addObject:strB2];
338 [newArray addObject:strB3];
339 [newArray addObject:strB4];
340 [newArray addObject:strB5];
341 [newArray addObject:strB6];
342 [newArray addObject:strB7];
343 [newArray addObject:strB8];
344 [newArray addObject:strB9];
345 [newArray addObject:strB10];
346 [newArray addObject:strB11];
347 [newArray addObject:strB12];
348 [newArray addObject:strC1];
349 [newArray addObject:strC2];
350 [newArray addObject:strC3];
351 [newArray addObject:strC4];
352 [newArray addObject:strC5];
353 [newArray addObject:strC6];
354 [newArray addObject:strC7];
355 [newArray addObject:strC8];
356 [newArray addObject:strC9];
357 [newArray addObject:strC10];
358 [newArray addObject:strC11];
359 [newArray addObject:strC12];
360 [newArray addObject:strD11];
361 [newArray addObject:strD12];
363 NSDictionary* newDictionary = [[NSDictionary alloc] initWithObjects:newArray forKeys:newArray];
364 NSDictionary *newMutableDictionary = [[NSMutableDictionary alloc] init];
365 [newMutableDictionary setObject:@"foo" forKey:@"bar0"];
366 [newMutableDictionary setObject:@"foo" forKey:@"bar1"];
367 [newMutableDictionary setObject:@"foo" forKey:@"bar2"];
368 [newMutableDictionary setObject:@"foo" forKey:@"bar3"];
369 [newMutableDictionary setObject:@"foo" forKey:@"bar4"];
370 [newMutableDictionary setObject:@"foo" forKey:@"bar5"];
371 [newMutableDictionary setObject:@"foo" forKey:@"bar6"];
372 [newMutableDictionary setObject:@"foo" forKey:@"bar7"];
373 [newMutableDictionary setObject:@"foo" forKey:@"bar8"];
374 [newMutableDictionary setObject:@"foo" forKey:@"bar9"];
375 [newMutableDictionary setObject:@"foo" forKey:@"bar10"];
376 [newMutableDictionary setObject:@"foo" forKey:@"bar11"];
377 [newMutableDictionary setObject:@"foo" forKey:@"bar12"];
378 [newMutableDictionary setObject:@"foo" forKey:@"bar13"];
379 [newMutableDictionary setObject:@"foo" forKey:@"bar14"];
380 [newMutableDictionary setObject:@"foo" forKey:@"bar15"];
381 [newMutableDictionary setObject:@"foo" forKey:@"bar16"];
382 [newMutableDictionary setObject:@"foo" forKey:@"bar17"];
383 [newMutableDictionary setObject:@"foo" forKey:@"bar18"];
384 [newMutableDictionary setObject:@"foo" forKey:@"bar19"];
385 [newMutableDictionary setObject:@"foo" forKey:@"bar20"];
387 id cfKeys[2] = { @"foo", @"bar", @"baz", @"quux" };
388 id cfValues[2] = { @"foo", @"bar", @"baz", @"quux" };
389 NSDictionary *nsDictionary = CFBridgingRelease(CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 2, nil, nil));
390 CFDictionaryRef cfDictionaryRef = CFDictionaryCreate(nil, (void *)cfKeys, (void *)cfValues, 3, nil, nil);
392 NSAttributedString* attrString = [[NSAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary];
393 [attrString isEqual:nil];
394 NSAttributedString* mutableAttrString = [[NSMutableAttributedString alloc] initWithString:@"hello world from foo" attributes:newDictionary];
395 [mutableAttrString isEqual:nil];
397 NSString* mutableString = [[NSMutableString alloc] initWithString:@"foo"];
398 [mutableString insertString:@"foo said this string needs to be very long so much longer than whatever other string has been seen ever before by anyone of the mankind that of course this is still not long enough given what foo our friend foo our lovely dearly friend foo desired of us so i am adding more stuff here for the sake of it and for the joy of our friend who is named guess what just foo. hence, dear friend foo, stay safe, your string is now long enough to accommodate your testing need and I will make sure that if not we extend it with even more fuzzy random meaningless words pasted one after the other from a long tiresome friday evening spent working in my office. my office mate went home but I am still randomly typing just for the fun of seeing what happens of the length of a Mutable String in Cocoa if it goes beyond one byte.. so be it, dear " atIndex:0];
400 NSString* mutableGetConst = [NSString stringWithCString:[mutableString cString]];
402 [mutableGetConst length];
404 NSData *immutableData = [[NSData alloc] initWithBytes:"HELLO" length:4];
405 NSData *mutableData = [[NSMutableData alloc] initWithBytes:"NODATA" length:6];
407 // No-copy versions of NSData initializers use NSConcreteData if over 2^16 elements are specified.
408 unsigned concreteLength = 100000;
409 void *zeroes1 = calloc(1, concreteLength);
410 // initWithBytesNoCopy takes ownership of the buffer.
411 NSData *concreteData = [[NSData alloc] initWithBytesNoCopy:zeroes1 length:concreteLength];
412 void *zeroes2 = calloc(1, concreteLength);
413 NSMutableData *concreteMutableData = [[NSMutableData alloc] initWithBytesNoCopy:zeroes2 length:concreteLength];
415 [mutableData appendBytes:"MOREDATA" length:8];
417 [immutableData length];
418 [mutableData length];
420 NSSet* nsset = [[NSSet alloc] initWithObjects:str1,str2,str3,nil];
421 NSSet *nsmutableset = [[NSMutableSet alloc] initWithObjects:str1,str2,str3,nil];
422 [nsmutableset addObject:str4];
424 CFDataRef data_ref = CFDataCreate(kCFAllocatorDefault, [immutableData bytes], 5);
426 CFMutableDataRef mutable_data_ref = CFDataCreateMutable(kCFAllocatorDefault, 8);
427 CFDataAppendBytes(mutable_data_ref, [mutableData bytes], 5);
429 CFMutableStringRef mutable_string_ref = CFStringCreateMutable(NULL,100);
430 CFStringAppend(mutable_string_ref, CFSTR("Wish ya knew"));
432 CFStringRef cfstring_ref = CFSTR("HELLO WORLD");
434 CFArrayRef cfarray_ref = CFArrayCreate(NULL, data_set, 3, NULL);
435 CFMutableArrayRef mutable_array_ref = CFArrayCreateMutable(NULL, 16, NULL);
437 CFArraySetValueAtIndex(mutable_array_ref, 0, str1);
438 CFArraySetValueAtIndex(mutable_array_ref, 1, str2);
439 CFArraySetValueAtIndex(mutable_array_ref, 2, str3);
440 CFArraySetValueAtIndex(mutable_array_ref, 3, str4);
441 CFArraySetValueAtIndex(mutable_array_ref, 0, str5); // replacing value at 0!!
442 CFArraySetValueAtIndex(mutable_array_ref, 4, str6);
443 CFArraySetValueAtIndex(mutable_array_ref, 5, str7);
444 CFArraySetValueAtIndex(mutable_array_ref, 6, str8);
445 CFArraySetValueAtIndex(mutable_array_ref, 7, str9);
446 CFArraySetValueAtIndex(mutable_array_ref, 8, str10);
447 CFArraySetValueAtIndex(mutable_array_ref, 9, str11);
448 CFArraySetValueAtIndex(mutable_array_ref, 10, str12);
450 CFBinaryHeapRef binheap_ref = CFBinaryHeapCreate(NULL, 15, &kCFStringBinaryHeapCallBacks, NULL);
451 CFBinaryHeapAddValue(binheap_ref, str1);
452 CFBinaryHeapAddValue(binheap_ref, str2);
453 CFBinaryHeapAddValue(binheap_ref, str3);
454 CFBinaryHeapAddValue(binheap_ref, str4);
455 CFBinaryHeapAddValue(binheap_ref, str5);
456 CFBinaryHeapAddValue(binheap_ref, str6);
457 CFBinaryHeapAddValue(binheap_ref, str7);
458 CFBinaryHeapAddValue(binheap_ref, str8);
459 CFBinaryHeapAddValue(binheap_ref, str9);
460 CFBinaryHeapAddValue(binheap_ref, str10);
461 CFBinaryHeapAddValue(binheap_ref, str11);
462 CFBinaryHeapAddValue(binheap_ref, str12);
463 CFBinaryHeapAddValue(binheap_ref, strA1);
464 CFBinaryHeapAddValue(binheap_ref, strB1);
465 CFBinaryHeapAddValue(binheap_ref, strC1);
466 CFBinaryHeapAddValue(binheap_ref, strA11);
467 CFBinaryHeapAddValue(binheap_ref, strB11);
468 CFBinaryHeapAddValue(binheap_ref, strC11);
469 CFBinaryHeapAddValue(binheap_ref, strB12);
470 CFBinaryHeapAddValue(binheap_ref, strC12);
471 CFBinaryHeapAddValue(binheap_ref, strA12);
473 CFURLRef cfurl_ref = CFURLCreateWithString(NULL, CFSTR("http://www.foo.bar/"), NULL);
474 CFURLRef cfchildurl_ref = CFURLCreateWithString(NULL, CFSTR("page.html"), cfurl_ref);
475 CFURLRef cfgchildurl_ref = CFURLCreateWithString(NULL, CFSTR("?whatever"), cfchildurl_ref);
477 NSDictionary *error_userInfo = @{@"a": @1, @"b" : @2};
478 NSError *nserror = [[NSError alloc] initWithDomain:@"Foobar" code:12 userInfo:error_userInfo];
479 NSError **nserrorptr = &nserror;
481 NSBundle* bundle_string = [[NSBundle alloc] initWithPath:@"/System/Library/Frameworks/Accelerate.framework"];
482 NSBundle* bundle_url = [[NSBundle alloc] initWithURL:[[NSURL alloc] initWithString:@"file://localhost/System/Library/Frameworks/Foundation.framework"]];
484 NSBundle* main_bundle = [NSBundle mainBundle];
486 NSArray* bundles = [NSBundle allBundles];
490 for (NSBundle* bundle in bundles)
492 nsurl0 = [bundle bundleURL];
495 NSException* except0 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName" reason:@"First" userInfo:nil];
496 NSException* except1 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName~1" reason:@"Second" userInfo:nil];
497 NSException* except2 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName`2" reason:@"Third" userInfo:nil];
498 NSException* except3 = [[NSException alloc] initWithName:@"TheGuyWhoHasNoName/3" reason:@"Fourth" userInfo:nil];
500 NSURL *nsurl = [[NSURL alloc] initWithString:@"http://www.foo.bar"];
501 NSURL *nsurl2 = [NSURL URLWithString:@"page.html" relativeToURL:nsurl];
502 NSURL *nsurl3 = [NSURL URLWithString:@"?whatever" relativeToURL:nsurl2];
504 NSDate *date1 = [NSDate dateWithNaturalLanguageString:@"6pm April 10, 1985"];
505 NSDate *date2 = [NSDate dateWithNaturalLanguageString:@"12am January 1, 2011"];
506 NSDate *date3 = [NSDate date];
507 NSDate *date4 = [NSDate dateWithTimeIntervalSince1970:24*60*60];
508 NSDate *date5 = [NSDate dateWithTimeIntervalSinceReferenceDate: floor([[NSDate date] timeIntervalSinceReferenceDate])];
510 CFAbsoluteTime date1_abs = CFDateGetAbsoluteTime(date1);
511 CFAbsoluteTime date2_abs = CFDateGetAbsoluteTime(date2);
512 CFAbsoluteTime date3_abs = CFDateGetAbsoluteTime(date3);
513 CFAbsoluteTime date4_abs = CFDateGetAbsoluteTime(date4);
514 CFAbsoluteTime date5_abs = CFDateGetAbsoluteTime(date5);
516 NSIndexSet *iset1 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 4)];
517 NSIndexSet *iset2 = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(1, 512)];
519 NSMutableIndexSet *imset = [[NSMutableIndexSet alloc] init];
520 [imset addIndex:1936];
531 CFTimeZoneRef cupertino = CFTimeZoneCreateWithName (
535 CFTimeZoneRef home = CFTimeZoneCreateWithName (
537 CFSTR("Europe/Rome"),
539 CFTimeZoneRef europe = CFTimeZoneCreateWithName (
544 NSTimeZone *cupertino_ns = [NSTimeZone timeZoneWithAbbreviation:@"PST"];
545 NSTimeZone *home_ns = [NSTimeZone timeZoneWithName:@"Europe/Rome"];
546 NSTimeZone *europe_ns = [NSTimeZone timeZoneWithAbbreviation:@"CET"];
548 CFGregorianUnits cf_greg_units = {1,3,5,12,5,7};
549 CFGregorianDate cf_greg_date = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime(date1), NULL);
550 CFRange cf_range = {4,4};
551 NSPoint ns_point = {4,4};
552 NSRange ns_range = {4,4};
554 NSRect ns_rect = {{1,1},{5,5}};
555 NSRect* ns_rect_ptr = &ns_rect;
556 NSRectArray ns_rect_arr = &ns_rect;
557 NSSize ns_size = {5,7};
558 NSSize* ns_size_ptr = &ns_size;
560 CGSize cg_size = {1,6};
561 CGPoint cg_point = {2,7};
562 CGRect cg_rect = {{1,2}, {7,7}};
565 RGBColor rgb_color = {3,56,35};
566 RGBColor* rgb_color_ptr = &rgb_color;
569 Rect rect = {4,8,4,7};
570 Rect* rect_ptr = ▭
572 Point point = {7,12};
573 Point* point_ptr = &point;
576 HIPoint hi_point = {7,12};
577 HIRect hi_rect = {{3,5},{4,6}};
580 SEL foo_selector = @selector(foo_selector_impl);
582 CFMutableBitVectorRef mut_bv = CFBitVectorCreateMutable(NULL, 64);
583 CFBitVectorSetCount(mut_bv, 50);
584 CFBitVectorSetBitAtIndex(mut_bv, 0, 1);
585 CFBitVectorSetBitAtIndex(mut_bv, 1, 1);
586 CFBitVectorSetBitAtIndex(mut_bv, 2, 1);
587 CFBitVectorSetBitAtIndex(mut_bv, 5, 1);
588 CFBitVectorSetBitAtIndex(mut_bv, 6, 1);
589 CFBitVectorSetBitAtIndex(mut_bv, 8, 1);
590 CFBitVectorSetBitAtIndex(mut_bv, 10, 1);
591 CFBitVectorSetBitAtIndex(mut_bv, 11, 1);
592 CFBitVectorSetBitAtIndex(mut_bv, 16, 1);
593 CFBitVectorSetBitAtIndex(mut_bv, 17, 1);
594 CFBitVectorSetBitAtIndex(mut_bv, 19, 1);
595 CFBitVectorSetBitAtIndex(mut_bv, 20, 1);
596 CFBitVectorSetBitAtIndex(mut_bv, 22, 1);
597 CFBitVectorSetBitAtIndex(mut_bv, 24, 1);
598 CFBitVectorSetBitAtIndex(mut_bv, 28, 1);
599 CFBitVectorSetBitAtIndex(mut_bv, 29, 1);
600 CFBitVectorSetBitAtIndex(mut_bv, 30, 1);
601 CFBitVectorSetBitAtIndex(mut_bv, 30, 1);
602 CFBitVectorSetBitAtIndex(mut_bv, 31, 1);
603 CFBitVectorSetBitAtIndex(mut_bv, 34, 1);
604 CFBitVectorSetBitAtIndex(mut_bv, 35, 1);
605 CFBitVectorSetBitAtIndex(mut_bv, 37, 1);
606 CFBitVectorSetBitAtIndex(mut_bv, 39, 1);
607 CFBitVectorSetBitAtIndex(mut_bv, 40, 1);
608 CFBitVectorSetBitAtIndex(mut_bv, 41, 1);
609 CFBitVectorSetBitAtIndex(mut_bv, 43, 1);
610 CFBitVectorSetBitAtIndex(mut_bv, 47, 1);
612 Molecule *molecule = [Molecule new];
614 Class myclass = NSClassFromString(@"NSValue");
615 Class myclass2 = [str0 class];
616 Class myclass3 = [molecule class];
617 Class myclass4 = NSClassFromString(@"NSMutableArray");
618 Class myclass5 = [nil class];
620 NSArray *components = @[@"usr", @"blah", @"stuff"];
621 NSString *path = [NSString pathWithComponents: components];
623 [molecule addObserver:[My_KVO_Observer new] forKeyPath:@"atoms" options:0 context:NULL]; // Set break point at this line.
624 [newMutableDictionary addObserver:[My_KVO_Observer new] forKeyPath:@"weirdKeyToKVO" options:NSKeyValueObservingOptionNew context:NULL];
626 [molecule setAtoms:nil];
627 [molecule setAtoms:[NSMutableArray new]];