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

File Contents

# User Rev Content
1 tim 136 #include "brains/SnapshotTestCase.hpp"
2     // Registers the fixture into the 'registry'
3     CPPUNIT_TEST_SUITE_REGISTRATION( SnapshotTestCase );
4    
5     void SnapshotTestCase::setUp() {
6 tim 146
7 tim 136 }
8    
9     void SnapshotTestCase::tearDown() {
10 tim 146
11 tim 136 }
12 tim 146
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 tim 136 void SnapshotTestCase::testConstructors(){
40     Snapshot s;
41    
42 tim 146 s.atomData.zAngle.push_back(1.0);
43 tim 136
44 tim 146 double *p = Snapshot::getArrayPointer( s.atomData.zAngle);
45 tim 136
46 tim 146 }

Properties

Name Value
svn:executable *