1 /// @file
2 /// Test return of a CEED object full resource name
3 /// \test Test return of a CEED object full resource name
4 #include <ceed.h>
5 #include <string.h>
6
main(int argc,char ** argv)7 int main(int argc, char **argv) {
8 Ceed ceed;
9 const char *backend = argv[1];
10 const char *resource;
11
12 CeedInit(backend, &ceed);
13
14 CeedGetResource(ceed, &resource);
15
16 const size_t resource_length = strlen(resource);
17 const bool is_exact_match = strcmp(resource, backend) == 0;
18 const bool is_match_with_query_arguments = !is_exact_match && memcmp(resource, backend, resource_length) == 0 && backend[resource_length] == ':';
19
20 if (!is_exact_match && !is_match_with_query_arguments) return CeedError(ceed, 1, "Incorrect full resource name: %s != %s\n", resource, backend);
21
22 CeedDestroy(&ceed);
23 return 0;
24 }
25