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 #include <stdio.h>
6
main(int argc,char ** argv)7 int main(int argc, char **argv) {
8 Ceed ceed, ceed_2;
9
10 CeedInit(argv[1], &ceed);
11 CeedInit("/cpu/self/ref/serial", &ceed_2);
12
13 CeedReferenceCopy(ceed, &ceed_2); // This destroys the previous ceed_2
14 if (ceed != ceed_2) printf("Error copying Ceed reference\n");
15
16 CeedDestroy(&ceed);
17
18 CeedMemType type;
19 CeedGetPreferredMemType(ceed_2, &type); // Second reference still valid
20
21 CeedDestroy(&ceed_2); // Both references should be destroyed
22 return 0;
23 }
24