@@ -8,10 +8,13 @@ * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #include "config.h" + +#include +#include #import "OFString.h" #import "OFArray.h" #import "OFAutoreleasePool.h" #import "OFExceptions.h" @@ -21,10 +24,11 @@ static OFString *module = @"OFString"; static OFString* whitespace[] = { @" \r \t\n\t \tasd \t \t\t\r\n", @" \t\t \t\t \t \t" }; +static of_unichar_t ucstr[] = { 'f', 0xF6, 0xF6, 'b', 0xE4, 'r', 0 }; @interface EntityHandler: OFObject @end @implementation EntityHandler @@ -43,10 +47,11 @@ { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFMutableString *s[3]; OFArray *a; int i; + of_unichar_t *ua; EntityHandler *h; s[0] = [OFMutableString stringWithString: @"täs€"]; s[1] = [OFMutableString string]; s[2] = [[s[0] copy] autorelease]; @@ -250,10 +255,13 @@ EXPECT_EXCEPTION(@"Detect out of range in -[hexadecilamValueAsInteger", OFOutOfRangeException, [@"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" @"0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF" hexadecimalValueAsInteger]) + + TEST(@"-[unicodeString]", (ua = [@"fööbär" unicodeString]) && + !memcmp(ua, ucstr, 7 * sizeof(of_unichar_t)) && R(free(ua))) TEST(@"-[md5Hash]", [[@"asdfoobar" md5Hash] isEqual: @"184dce2ec49b5422c7cfd8728864db4c"]) TEST(@"-[sha1Hash]", [[@"asdfoobar" sha1Hash]