1 /// @file 2 /// Test creation, reference copying, and destroying of a vector 3 /// \test Test creation, reference copying, and destroying of a vector 4 #include <ceed.h> 5 #include <stdio.h> 6 7 int main(int argc, char **argv) { 8 Ceed ceed; 9 CeedVector x, x_2; 10 CeedInt len = 10; 11 12 CeedInit(argv[1], &ceed); 13 14 CeedVectorCreate(ceed, len, &x); 15 CeedVectorCreate(ceed, len + 1, &x_2); 16 17 CeedVectorReferenceCopy(x, &x_2); // This destroys the previous x_2 18 CeedVectorDestroy(&x); 19 20 { 21 CeedSize len_2; 22 23 CeedVectorGetLength(x_2, &len_2); // Second reference still valid 24 if (len_2 != len) printf("Error copying CeedVector reference\n"); 25 } 26 27 CeedVectorDestroy(&x_2); 28 CeedDestroy(&ceed); 29 return 0; 30 } 31