STAssertNotNil(data, @"-dataUsingEncoding:allowLossyConversion:nulTerminate: should return an object");
STAssertTrue([data isKindOfClass:[NSData class]], @"-dataUsingEncoding:allowLossyConversion:nulTerminate: should return a string");
STAssertTrue([data isKindOfClass:[AIWiredData class]], @"-dataUsingEncoding:allowLossyConversion:nulTerminate: should return a wired string");
"""
failure_assertions="""\
STAssertNil(data, @"-dataUsingEncoding:%(encoding_name)s allowLossyConversion:%(lossy_conversion)s nulTerminate: should not return an object");
"""
same_character_type_equality_assertion="""\
STAssertEquals(memcmp([data bytes], sample%(source_encoding_name)sString, sample%(source_encoding_name)sStringLength), 0, @"-dataUsingEncoding:allowLossyConversion:nulTerminate: returned a data object whose bytes were not equal to the original input");
"""
ascii_to_utf16_equality_assertion="""\
//Every ASCII character is exactly equal to its UTF-16 counterpart; the only difference is that UTF-16 code units are twice as big.
//Hence this loop, to perform an impromptu conversion of ASCII to UTF-16 so that we can verify the contents of the data object.
STAssertEquals(memcmp([data bytes], %(source_encoding_name)sStringAs%(encoding_name)s, sample%(source_encoding_name)sStringLength), 0, @"-dataUsingEncoding:allowLossyConversion:nulTerminate: returned a data object whose bytes were not equal to the original input");
"""
utf16_to_ascii_equality_assertion="""\
//Every ASCII character is exactly equal to its UTF-16 counterpart; the only difference is that UTF-16 code units are twice as big.
//Hence this loop, to perform an impromptu conversion of UTF-16 to ASCII so that we can verify the contents of the data object.
STAssertEquals(memcmp([data bytes], %(source_encoding_name)sStringAs%(encoding_name)s, sample%(source_encoding_name)sStringLength), 0, @"-dataUsingEncoding:allowLossyConversion:nulTerminate: returned a data object whose bytes were not equal to the original input");
"""
nul_termination_assertions="""\
STAssertEquals((unsigned long)([data length] / sizeof(%(character_type)s)), (unsigned long)(sample%(source_encoding_name)sStringLength + 1UL), @"-dataUsingEncoding:allowLossyConversion:nulTerminate:NUL did not add a terminator character (ostensibly NUL) to its output");
STAssertEquals(((%(character_type)s *)[data bytes])[sample%(source_encoding_name)sStringLength], (%(character_type)s)0, @"-dataUsingEncoding:allowLossyConversion:nulTerminate:NUL terminated its output with something other than a NUL");
"""
nul_termination_with_snowman_assertions="""\
//-%(code_units_per_snowman_in_source_encoding)u+%(code_units_per_snowman_in_destination_encoding)u: Subtract the snowman; insert the fallback character (probably '?').
unsigned long correctLength = ((sample%(source_encoding_name)sStringLength - %(code_units_per_snowman_in_source_encoding)uUL) + %(code_units_per_snowman_in_destination_encoding)uUL);
STAssertEquals((unsigned long)([data length] / sizeof(%(character_type)s)), correctLength + 1UL, @"-dataUsingEncoding:allowLossyConversion:nulTerminate:NUL did not add a terminator character (ostensibly NUL) to its output");
STAssertEquals(((%(character_type)s *)[data bytes])[correctLength], (%(character_type)s)0, @"-dataUsingEncoding:allowLossyConversion:nulTerminate:NUL terminated its output with something other than a NUL");
parser.add_option('--interface',dest='prototype_only',help='Print declarations (for @interface), rather than definitions (for @implementation).',action='store_true',default=False)