2011-02-16 08:21:17 +00:00
|
|
|
/*
|
|
|
|
copyright 2004 Alexander Malmberg <alexander@malmberg.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import "Testing.h"
|
|
|
|
|
|
|
|
#import <Foundation/NSString.h>
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2024-11-30 19:06:40 +00:00
|
|
|
START_SET("zero hash")
|
2011-02-16 08:21:17 +00:00
|
|
|
NSString *s = @"!)9\" ;";
|
|
|
|
unsigned int h;
|
|
|
|
|
|
|
|
/*
|
|
|
|
Generate a (hopefully ASCII printable) string with a given hash.
|
|
|
|
|
|
|
|
h = 0x50000000;
|
|
|
|
while (h > 0)
|
|
|
|
{
|
|
|
|
int a,b;
|
|
|
|
|
|
|
|
a = h/33;
|
|
|
|
b = h%33;
|
|
|
|
if (a)
|
|
|
|
while (b < 32)
|
|
|
|
a--, b += 33;
|
|
|
|
printf("%10i = %10i * 33 + %3i '%c'\n",h,a,b,b);
|
|
|
|
h = a;
|
|
|
|
}*/
|
|
|
|
|
|
|
|
h = [s hash];
|
|
|
|
PASS(h != 0, "[NSConstantString hash] does not return 0");
|
|
|
|
|
2024-11-15 21:21:41 +00:00
|
|
|
s = [NSString stringWithString: s];
|
2011-02-16 08:21:17 +00:00
|
|
|
h = [s hash];
|
|
|
|
PASS(h != 0, "[NSString hash] does not return 0");
|
2024-11-30 19:06:40 +00:00
|
|
|
END_SET("zero hash")
|
2011-02-16 08:21:17 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|