mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
import testsuite
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32187 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
48cc36811f
commit
b179b29898
374 changed files with 20864 additions and 0 deletions
40
Tests/base/NSString/NSString_zero_hash.m
Normal file
40
Tests/base/NSString/NSString_zero_hash.m
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
copyright 2004 Alexander Malmberg <alexander@malmberg.org>
|
||||
*/
|
||||
|
||||
#import "Testing.h"
|
||||
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
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");
|
||||
|
||||
s = [[NSString alloc] initWithString: s];
|
||||
h = [s hash];
|
||||
PASS(h != 0, "[NSString hash] does not return 0");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue