File: ContainerTest.cpp

package info (click to toggle)
vecgeom 1.2.8%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 24,016 kB
  • sloc: cpp: 88,803; ansic: 6,888; python: 1,035; sh: 582; sql: 538; makefile: 23
file content (31 lines) | stat: -rw-r--r-- 785 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "VecGeom/base/SOA3D.h"
#include "VecGeom/base/AOS3D.h"

using namespace vecgeom;

template <typename T, template <typename> class ContainerType>
void SizeTest()
{
  ContainerType<T> container(0);
  assert(container.size() == 0);
  assert(container.capacity() == 0);
  container.reserve(8);
  assert(container.size() == 0);
  assert(container.capacity() == 8);
  container.resize(6);
  assert(container.size() == 6);
  assert(container.capacity() == 8);
  container.set(3, Vector3D<T>(1, 2, 3));
  container.set(2, 3, 2, 1);
  assert(container[3] == Vector3D<T>(1, 2, 3));
  assert(container[2] == Vector3D<T>(3, 2, 1));
  assert(container.z(3) == 3);
  assert(container.x(2) == 3);
}

int main()
{
  SizeTest<Precision, AOS3D>();
  SizeTest<Precision, SOA3D>();
  return 0;
}