1 /// @file 2 /// Test creation, copying, and destruction of a CEED object 3 /// \test Test creation, copying, and destruction of a CEED object 4 #include <ceed.h> 5 6 int main(int argc, char **argv) { 7 Ceed ceed, ceed_2; 8 9 CeedInit(argv[1], &ceed); 10 CeedInit("/cpu/self/ref/serial", &ceed_2); 11 12 CeedReferenceCopy(ceed, &ceed_2); // This destroys the previous ceed_2 13 if (ceed != ceed_2) printf("Error copying Ceed reference\n"); 14 15 CeedDestroy(&ceed); 16 17 CeedMemType type; 18 CeedGetPreferredMemType(ceed_2, &type); // Second reference still valid 19 20 CeedDestroy(&ceed_2); // Both references should be destroyed 21 return 0; 22 } 23