1 /* oid.c */
2 
3 #include "test.h"
4 #include "mongo.h"
5 #include <stdio.h>
6 #include <string.h>
7 #include <stdlib.h>
8 #include <time.h>
9 
increment()10 int increment() {
11     static int i = 1000;
12     i++;
13     return i;
14 }
15 
fuzz()16 int fuzz() {
17     return 50000;
18 }
19 
20 /* Test custom increment and fuzz functions. */
main()21 int main() {
22 
23     bson_oid_t o;
24     int res;
25 
26     bson_set_oid_inc( increment );
27     bson_set_oid_fuzz( fuzz );
28 
29     bson_oid_gen( &o );
30     bson_big_endian32( &res, &( o.ints[2] ) );
31 
32     ASSERT( o.ints[1] == 50000 );
33     ASSERT( res == 1001 );
34 
35     return 0;
36 }
37