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