forked from newrelic/newrelic-php-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_guid.c
38 lines (27 loc) · 846 Bytes
/
test_guid.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* Copyright 2020 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#include "nr_axiom.h"
#include "nr_guid.h"
#include "util_memory.h"
#include "tlib_main.h"
static void test_create(void) {
char* guid;
nr_random_t* rnd = nr_random_create();
nr_random_seed(rnd, 345345);
guid = nr_guid_create(NULL);
tlib_pass_if_str_equal("NULL random", guid, "0000000000000000");
nr_free(guid);
guid = nr_guid_create(rnd);
tlib_pass_if_str_equal("guid creation", guid, "078ad44c1960eab7");
nr_free(guid);
guid = nr_guid_create(rnd);
tlib_pass_if_str_equal("repeat guid creation", guid, "11da3087c4400533");
nr_free(guid);
nr_random_destroy(&rnd);
}
tlib_parallel_info_t parallel_info = {.suggested_nthreads = 2, .state_size = 0};
void test_main(void* p NRUNUSED) {
test_create();
}