-
Notifications
You must be signed in to change notification settings - Fork 31
/
AtomIterator_test.C
57 lines (45 loc) · 1.29 KB
/
AtomIterator_test.C
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