]> git.saurik.com Git - apple/libc.git/blob - tests/os_simple_hash.c
Libc-1272.200.26.tar.gz
[apple/libc.git] / tests / os_simple_hash.c
1 #include <darwintest.h>
2 #include <stdlib.h>
3 #include <os/stdlib.h>
4
5 T_DECL(os_simple_hash, "sanity check of os_simple_hash",
6 T_META_ALL_VALID_ARCHS(true))
7 {
8 const char * string =
9 "We made the buttons on the screen look so good you'll want to lick them.";
10 uint64_t hashval = os_simple_hash_string(string);
11 T_EXPECT_NE(hashval, 0ULL, "usually should get a non-0 hash value");
12
13 char buf[1024];
14 arc4random_buf(buf, sizeof(buf));
15 hashval = os_simple_hash(buf, sizeof(buf));
16 T_EXPECT_NE(hashval, 0ULL, "usually should get a non-0 hash value");
17 }