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

Function doStringArrayTest

Common/Core/Testing/Cxx/otherStringArray.cxx:31–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29} // End anonymous namespace
30
31int doStringArrayTest(ostream& strm, int size)
32{
33 int errors = 0;
34
35 vtkNew<vtkStringArray> ptr;
36 vtkStdString* strings = new vtkStdString[SIZE];
37 for (int i = 0; i < SIZE; ++i)
38 {
39 strings[i] = "string entry " + vtk::to_string(i);
40 }
41
42 strm << "\tResize(0)...";
43 ptr->Resize(0);
44 strm << "OK" << std::endl;
45
46 strm << "\tResize(10)...";
47 ptr->Resize(10);
48 strm << "OK" << std::endl;
49
50 strm << "\tResize(5)...";
51 ptr->Resize(5);
52 strm << "OK" << std::endl;
53
54 strm << "\tResize(size)...";
55 ptr->Resize(size);
56 strm << "OK" << std::endl;
57
58 strm << "\tSetNumberOfValues...";
59 ptr->SetNumberOfValues(100);
60 if (ptr->GetNumberOfValues() == 100)
61 strm << "OK" << std::endl;
62 else
63 {
64 ++errors;
65 strm << "FAILED" << std::endl;
66 }
67
68 strm << "\tSetVoidArray...";
69 ptr->SetVoidArray(strings, size, 1);
70 strm << "OK" << std::endl;
71
72 strm << "\tGetValue...";
73 vtkStdString value = ptr->GetValue(123);
74 if (value == "string entry 123")
75 {
76 strm << "OK" << std::endl;
77 }
78 else
79 {
80 ++errors;
81 strm << "FAILED. Expected 'string entry 123', got '" << value << "'" << std::endl;
82 bool dump = false;
83#ifdef DUMP_VALUES
84 dump = true;
85#endif
86 if (dump)
87 {
88 ::printStrings(strm, ptr);

Callers 1

otherStringArrayTestFunction · 0.85

Calls 13

SetVoidArrayMethod · 0.80
InsertNextIdMethod · 0.80
to_stringFunction · 0.50
ResizeMethod · 0.45
SetNumberOfValuesMethod · 0.45
GetNumberOfValuesMethod · 0.45
GetValueMethod · 0.45
SetValueMethod · 0.45
InsertValueMethod · 0.45
InsertNextValueMethod · 0.45
GetTuplesMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected