File: AtomIterator_test.C

package info (click to toggle)
ball 1.5.0%2Bgit20180813.37fc53c-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 239,848 kB
  • sloc: cpp: 326,149; ansic: 4,208; python: 2,303; yacc: 1,778; lex: 1,099; xml: 958; sh: 322; makefile: 93
file content (57 lines) | stat: -rw-r--r-- 1,324 bytes parent folder | download | duplicates (8)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#include <BALL/CONCEPT/classTest.h>

///////////////////////////

#include <BALL/KERNEL/atomContainer.h>
#include <algorithm>

///////////////////////////

START_TEST(AtomIterator)

/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////

using namespace BALL;

CHECK(typedefs)
	AtomContainer ac;
	ac.append(*new Atom);
	ac.beginAtom()->setName("A1");
	AtomIterator ai = ac.beginAtom();
	AtomIterator::value_type value = *ai;
	TEST_EQUAL(value.getName(), ai->getName())
	AtomIterator::reference ref = *ai;
	TEST_EQUAL(ref.getName(), ai->getName())
	AtomIterator::pointer ptr = &*ai;
	TEST_EQUAL(ptr, &*ai)
RESULT

CHECK(use in copy algorithm)
	AtomContainer ac;
	Atom a1;
	a1.setName("A1");
	Atom a2;
	a2.setName("A2");
	Atom a3;
	a3.setName("A3");
	
	ac.append(a1);
	ac.append(a2);
	ac.append(a3);
		
	std::vector<Atom> atom_vec(10);
	std::copy(ac.beginAtom(), ac.endAtom(), atom_vec.begin());
	
	TEST_EQUAL(atom_vec[0].getName(), "A1")
	TEST_EQUAL(atom_vec[1].getName(), "A2")
	TEST_EQUAL(atom_vec[2].getName(), "A3")
	TEST_EQUAL(atom_vec[3].getName(), "")
RESULT

/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
END_TEST