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 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 = 19 // LCOV_EXCL_START 20 !is_exact_match 21 && memcmp(resource, backend, resource_length) == 0 22 && backend[resource_length] == ':'; 23 // LCOV_EXCL_STOP 24 25 if (!is_exact_match && !is_match_with_query_arguments) { 26 // LCOV_EXCL_START 27 return CeedError(ceed, 1, "Incorrect full resource name: %s != %s", 28 resource, backend); 29 // LCOV_EXCL_STOP 30 } 31 32 CeedDestroy(&ceed); 33 return 0; 34 } 35