MCPcopy Create free account
hub / github.com/Kitware/VTK / TestArrayVariants

Function TestArrayVariants

Common/Core/Testing/Cxx/TestArrayVariants.cxx:23–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21 } while (false)
22
23int TestArrayVariants(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
24{
25 try
26 {
27 // Exercise the API that gets/sets variants ...
28 vtkSmartPointer<vtkDenseArray<double>> concrete = vtkSmartPointer<vtkDenseArray<double>>::New();
29 concrete->Resize(3, 2);
30 vtkTypedArray<double>* const typed = concrete;
31 vtkArray* const abstract = concrete;
32
33 abstract->SetVariantValue(0, 0, 1.0);
34 abstract->SetVariantValue(vtkArrayCoordinates(0, 1), 2.0);
35 typed->SetVariantValue(1, 0, 3.0);
36 typed->SetVariantValue(vtkArrayCoordinates(1, 1), 4.0);
37 concrete->SetVariantValue(2, 0, 5.0);
38 concrete->SetVariantValue(vtkArrayCoordinates(2, 1), 6.0);
39
40 test_expression(abstract->GetVariantValue(0, 0) == 1.0);
41 test_expression(abstract->GetVariantValue(vtkArrayCoordinates(0, 1)) == 2.0);
42 test_expression(typed->GetVariantValue(1, 0) == 3.0);
43 test_expression(typed->GetVariantValue(vtkArrayCoordinates(1, 1)) == 4.0);
44 test_expression(concrete->GetVariantValue(2, 0) == 5.0);
45 test_expression(concrete->GetVariantValue(vtkArrayCoordinates(2, 1)) == 6.0);
46
47 abstract->SetVariantValueN(0, 7.0);
48 test_expression(abstract->GetVariantValueN(0) == 7.0);
49 typed->SetVariantValueN(0, 8.0);
50 test_expression(typed->GetVariantValueN(0) == 8.0);
51 concrete->SetVariantValueN(0, 9.0);
52 test_expression(concrete->GetVariantValueN(0) == 9.0);
53
54 return 0;
55 }
56 catch (std::exception& e)
57 {
58 std::cerr << e.what() << std::endl;
59 return 1;
60 }
61}

Callers

nothing calls this directly

Calls 6

test_expressionFunction · 0.85
NewFunction · 0.70
ResizeMethod · 0.45
SetVariantValueMethod · 0.45
GetVariantValueMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected