aboutsummaryrefslogtreecommitdiff
path: root/src/unit
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2014-02-03 15:22:25 +0000
committerMike Buland <eichlan@xagasoft.com>2014-02-03 15:22:25 +0000
commit952cafc3b7225f2cef68b3945bfa94a2d7ea8466 (patch)
tree56bf528dee12b612ec4261edc19ad58e50bd0bb0 /src/unit
parent19c82804fbce4c977f283164c2d25cf3c2711b42 (diff)
downloadlibbu++-952cafc3b7225f2cef68b3945bfa94a2d7ea8466.tar.gz
libbu++-952cafc3b7225f2cef68b3945bfa94a2d7ea8466.tar.bz2
libbu++-952cafc3b7225f2cef68b3945bfa94a2d7ea8466.tar.xz
libbu++-952cafc3b7225f2cef68b3945bfa94a2d7ea8466.zip
Corrected Myriad unit test on 64 bit platforms.
I assumed a long would be 4 bytes, that was silly!
Diffstat (limited to '')
-rw-r--r--src/unit/myriad.unit14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/unit/myriad.unit b/src/unit/myriad.unit
index 3a6376e..1f900f4 100644
--- a/src/unit/myriad.unit
+++ b/src/unit/myriad.unit
@@ -50,8 +50,8 @@ Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const VerifyObject &vo )
50{ 50{
51 Md5 sum; 51 Md5 sum;
52 ar << vo.iUnits; 52 ar << vo.iUnits;
53 vo.iBytesWritten = 4; 53 vo.iBytesWritten = sizeof(int);
54 sum.addData( &vo.iUnits, 4 ); 54 sum.addData( &vo.iUnits, sizeof(int) );
55 for( int j = 0; j < vo.iUnits; j++ ) 55 for( int j = 0; j < vo.iUnits; j++ )
56 { 56 {
57 int iRand = random()%128; 57 int iRand = random()%128;
@@ -60,13 +60,13 @@ Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const VerifyObject &vo )
60 for( int j = 0; j < iRand; j++ ) 60 for( int j = 0; j < iRand; j++ )
61 sDat[j] = (char)((uint8_t)(random()%256)); 61 sDat[j] = (char)((uint8_t)(random()%256));
62 ar << sDat; 62 ar << sDat;
63 sum.addData( &iRand, 4 ); 63 sum.addData( &iRand, sizeof(int) );
64 sum.addData( sDat.getStr(), iRand ); 64 sum.addData( sDat.getStr(), iRand );
65 vo.iBytesWritten += 4 + iRand; 65 vo.iBytesWritten += sizeof(long) + iRand;
66 } 66 }
67 Bu::String sRes = sum.getResult(); 67 Bu::String sRes = sum.getResult();
68 ar << sRes; 68 ar << sRes;
69 vo.iBytesWritten += 4 + sRes.getSize(); 69 vo.iBytesWritten += sizeof(long) + sRes.getSize();
70 return ar; 70 return ar;
71} 71}
72 72
@@ -74,7 +74,7 @@ Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, VerifyObject &vo )
74{ 74{
75 Md5 sum; 75 Md5 sum;
76 ar >> vo.iUnits; 76 ar >> vo.iUnits;
77 sum.addData( &vo.iUnits, 4 ); 77 sum.addData( &vo.iUnits, sizeof(int) );
78 for( int j = 0; j < vo.iUnits; j++ ) 78 for( int j = 0; j < vo.iUnits; j++ )
79 { 79 {
80 int iRand; 80 int iRand;
@@ -82,7 +82,7 @@ Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, VerifyObject &vo )
82 Bu::String sStr; 82 Bu::String sStr;
83 ar >> sStr; 83 ar >> sStr;
84 iRand = sStr.getSize(); 84 iRand = sStr.getSize();
85 sum.addData( &iRand, 4 ); 85 sum.addData( &iRand, sizeof(int) );
86 sum.addData( sStr.getStr(), iRand ); 86 sum.addData( sStr.getStr(), iRand );
87 } 87 }
88 Bu::String sSum; 88 Bu::String sSum;