ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/test/brains/SnapshotTestCase.cpp
Revision: 1639
Committed: Fri Oct 22 23:09:57 2004 UTC (19 years, 8 months ago) by tim
File size: 1186 byte(s)
Log Message:
more work in Snapshot

File Contents

# Content
1 #include "brains/SnapshotTestCase.hpp"
2 // Registers the fixture into the 'registry'
3 CPPUNIT_TEST_SUITE_REGISTRATION( SnapshotTestCase );
4
5 void SnapshotTestCase::setUp() {
6
7 }
8
9 void SnapshotTestCase::tearDown() {
10
11 }
12
13 void SnapshotTestCase::testMemoryLayout(){
14 //test memory layout
15 vector<Vector3d> v;
16 const int num = 10000000;
17 v.insert(v.end(), num, Vector3d(2.3, 0.84, 0.18));
18
19 double* sbegin = v[0].getArrayPointer();
20 double* send = v[num-1].getArrayPointer() + 3;
21
22 CPPUNIT_ASSERT_EQUAL(sizeof(Vector3d), sizeof(double) *3);
23 CPPUNIT_ASSERT_EQUAL((unsigned int) sbegin,(unsigned int) &v[0]);
24 CPPUNIT_ASSERT_EQUAL((unsigned int) send , (unsigned int)&v[num]);
25
26 //test memory access
27 sbegin[12] = 32.01243;
28 sbegin[13] = 1.023343;
29 sbegin[14] = 82.025568;
30
31 CPPUNIT_ASSERT_DOUBLES_EQUAL(v[4][0], 32.01243, 0.00001);
32 CPPUNIT_ASSERT_DOUBLES_EQUAL(v[4][1], 1.023343, 0.00001);
33 CPPUNIT_ASSERT_DOUBLES_EQUAL(v[4][2], 82.025568, 0.00001);
34
35
36
37 }
38
39 void SnapshotTestCase::testConstructors(){
40 Snapshot s;
41
42 s.atomData.zAngle.push_back(1.0);
43
44 double *p = Snapshot::getArrayPointer( s.atomData.zAngle);
45
46 }

Properties

Name Value
svn:executable *