t002-ceed.c (c360dbdf7be710089f1c988eae047df8591af9a4) t002-ceed.c (9647a07ed4cccf5520ee61cfc49faed91542e405)
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 <string.h>
5#include <ceed.h>
6
7int main(int argc, char **argv) {
8 Ceed ceed;
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 <string.h>
5#include <ceed.h>
6
7int main(int argc, char **argv) {
8 Ceed ceed;
9 const char *backend = argv[1];
9 const char *resource;
10
10 const char *resource;
11
11 CeedInit(argv[1], &ceed);
12 CeedInit(backend, &ceed);
12
13 CeedGetResource(ceed, &resource);
13
14 CeedGetResource(ceed, &resource);
14 if (strcmp(resource, argv[1]))
15
16 const size_t resourceLength = strlen(resource);
17 const bool isExactMatch = strcmp(resource, backend) == 0;
18 const bool isMatchWithQueryArguments = (
19 !isExactMatch
20 && memcmp(resource, backend, resourceLength) == 0
21 && backend[resourceLength] == ':'
22 );
23
24 if (!isExactMatch && !isMatchWithQueryArguments) {
15 // LCOV_EXCL_START
16 return CeedError(ceed, 1, "Incorrect full resource name: %s != %s",
25 // LCOV_EXCL_START
26 return CeedError(ceed, 1, "Incorrect full resource name: %s != %s",
17 resource, argv[1]);
18 // LCOV_EXCL_STOP
27 resource, backend);
28 // LCOV_EXCL_STOP
29 }
19
20 CeedDestroy(&ceed);
21 return 0;
22}
30
31 CeedDestroy(&ceed);
32 return 0;
33}