aboutsummaryrefslogtreecommitdiff
path: root/src/unit
diff options
context:
space:
mode:
authorMike Buland <mbuland@penny-arcade.com>2022-04-20 11:14:47 -0700
committerMike Buland <mbuland@penny-arcade.com>2022-04-20 11:14:47 -0700
commitd10e6a5ca0905f0ef2836cd98aebfb48e7f1e8a3 (patch)
tree0235e978cc5ffa94d790a4e26b5cf1e5492cab2b /src/unit
parent819ff3d27012b4ec4a0a21c150c112a4dd28b14d (diff)
downloadlibbu++-d10e6a5ca0905f0ef2836cd98aebfb48e7f1e8a3.tar.gz
libbu++-d10e6a5ca0905f0ef2836cd98aebfb48e7f1e8a3.tar.bz2
libbu++-d10e6a5ca0905f0ef2836cd98aebfb48e7f1e8a3.tar.xz
libbu++-d10e6a5ca0905f0ef2836cd98aebfb48e7f1e8a3.zip
ArchiveBase/Archive renamed. More to come.
Diffstat (limited to 'src/unit')
-rw-r--r--src/unit/archive.unit20
-rw-r--r--src/unit/myriad.unit16
2 files changed, 18 insertions, 18 deletions
diff --git a/src/unit/archive.unit b/src/unit/archive.unit
index 58f7d2b..6b975ac 100644
--- a/src/unit/archive.unit
+++ b/src/unit/archive.unit
@@ -8,17 +8,17 @@
8 8
9#include "bu/membuf.h" 9#include "bu/membuf.h"
10#include "bu/array.h" 10#include "bu/array.h"
11#include "bu/archive.h" 11#include "bu/archivebinary.h"
12 12
13using namespace Bu; 13using namespace Bu;
14 14
15suite Archive 15suite ArchiveBinary
16{ 16{
17 test primitives 17 test primitives
18 { 18 {
19 MemBuf mb; 19 MemBuf mb;
20 { 20 {
21 Archive ar( mb, Archive::save ); 21 ArchiveBinary ar( mb, ArchiveBinary::save );
22 ar << (int8_t)1; 22 ar << (int8_t)1;
23 ar << (uint8_t)2; 23 ar << (uint8_t)2;
24 ar << (int16_t)3; 24 ar << (int16_t)3;
@@ -41,7 +41,7 @@ suite Archive
41 } 41 }
42 mb.setPos( 0 ); 42 mb.setPos( 0 );
43 { 43 {
44 Archive ar( mb, Archive::load ); 44 ArchiveBinary ar( mb, ArchiveBinary::load );
45 int8_t p1; 45 int8_t p1;
46 uint8_t p2; 46 uint8_t p2;
47 int16_t p3; 47 int16_t p3;
@@ -104,7 +104,7 @@ suite Archive
104 { 104 {
105 MemBuf mb; 105 MemBuf mb;
106 { 106 {
107 Archive ar( mb, Archive::save ); 107 ArchiveBinary ar( mb, ArchiveBinary::save );
108 String sStr("This is a test string."); 108 String sStr("This is a test string.");
109 List<int> lList; 109 List<int> lList;
110 lList.append( 10 ); 110 lList.append( 10 );
@@ -117,7 +117,7 @@ suite Archive
117 } 117 }
118 mb.setPos( 0 ); 118 mb.setPos( 0 );
119 { 119 {
120 Archive ar( mb, Archive::load ); 120 ArchiveBinary ar( mb, ArchiveBinary::load );
121 String sStr; 121 String sStr;
122 List<int> lList; 122 List<int> lList;
123 ar >> sStr; 123 ar >> sStr;
@@ -137,7 +137,7 @@ suite Archive
137 { 137 {
138 MemBuf mb; 138 MemBuf mb;
139 { 139 {
140 Archive ar( mb, Archive::save ); 140 ArchiveBinary ar( mb, ArchiveBinary::save );
141 String sStr("This is a test string."); 141 String sStr("This is a test string.");
142 Array<int> lArray; 142 Array<int> lArray;
143 lArray.append( 10 ); 143 lArray.append( 10 );
@@ -150,7 +150,7 @@ suite Archive
150 } 150 }
151 mb.setPos( 0 ); 151 mb.setPos( 0 );
152 { 152 {
153 Archive ar( mb, Archive::load ); 153 ArchiveBinary ar( mb, ArchiveBinary::load );
154 String sStr; 154 String sStr;
155 Array<int> lArray; 155 Array<int> lArray;
156 ar >> sStr; 156 ar >> sStr;
@@ -170,7 +170,7 @@ suite Archive
170 { 170 {
171 MemBuf mb; 171 MemBuf mb;
172 { 172 {
173 Archive ar( mb, Archive::save ); 173 ArchiveBinary ar( mb, ArchiveBinary::save );
174 Array<String> lArray; 174 Array<String> lArray;
175 lArray.append( "10" ); 175 lArray.append( "10" );
176 lArray.append( "20" ); 176 lArray.append( "20" );
@@ -181,7 +181,7 @@ suite Archive
181 } 181 }
182 mb.setPos( 0 ); 182 mb.setPos( 0 );
183 { 183 {
184 Archive ar( mb, Archive::load ); 184 ArchiveBinary ar( mb, ArchiveBinary::load );
185 Array<String> lArray; 185 Array<String> lArray;
186 ar >> lArray; 186 ar >> lArray;
187 unitTest( lArray.getSize() == 4 ); 187 unitTest( lArray.getSize() == 4 );
diff --git a/src/unit/myriad.unit b/src/unit/myriad.unit
index 91a89c9..09d92a3 100644
--- a/src/unit/myriad.unit
+++ b/src/unit/myriad.unit
@@ -13,7 +13,7 @@
13#include "bu/array.h" 13#include "bu/array.h"
14 14
15#include "bu/sio.h" 15#include "bu/sio.h"
16#include "bu/archive.h" 16#include "bu/archivebinary.h"
17#include "bu/md5.h" 17#include "bu/md5.h"
18#include "bu/unitsuite.h" 18#include "bu/unitsuite.h"
19 19
@@ -23,8 +23,8 @@ using namespace Bu;
23 23
24class VerifyObject 24class VerifyObject
25{ 25{
26friend Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const VerifyObject &vo ); 26friend Bu::Archive &operator<<( Bu::Archive &ar, const VerifyObject &vo );
27friend Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, VerifyObject &vo ); 27friend Bu::Archive &operator>>( Bu::Archive &ar, VerifyObject &vo );
28public: 28public:
29 VerifyObject( int iUnits ) : 29 VerifyObject( int iUnits ) :
30 iUnits( iUnits ), 30 iUnits( iUnits ),
@@ -46,7 +46,7 @@ private:
46 mutable int iBytesWritten; 46 mutable int iBytesWritten;
47}; 47};
48 48
49Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const VerifyObject &vo ) 49Bu::Archive &operator<<( Bu::Archive &ar, const VerifyObject &vo )
50{ 50{
51 Md5 sum; 51 Md5 sum;
52 ar << vo.iUnits; 52 ar << vo.iUnits;
@@ -70,7 +70,7 @@ Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const VerifyObject &vo )
70 return ar; 70 return ar;
71} 71}
72 72
73Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, VerifyObject &vo ) 73Bu::Archive &operator>>( Bu::Archive &ar, VerifyObject &vo )
74{ 74{
75 Md5 sum; 75 Md5 sum;
76 ar >> vo.iUnits; 76 ar >> vo.iUnits;
@@ -347,7 +347,7 @@ suite Myriad
347 VerifyObject vo( random()%1024 ); 347 VerifyObject vo( random()%1024 );
348 { 348 {
349 MyriadStream ms = m.openStream( iStream ); 349 MyriadStream ms = m.openStream( iStream );
350 Archive ar( ms, Archive::save ); 350 ArchiveBinary ar( ms, ArchiveBinary::save );
351 ar << vo; 351 ar << vo;
352 unitTest( ms.tell() == vo.getBytesWritten() ); 352 unitTest( ms.tell() == vo.getBytesWritten() );
353 ms.setSize( ms.tell() ); 353 ms.setSize( ms.tell() );
@@ -366,12 +366,12 @@ suite Myriad
366 VerifyObject vo( random()%1024 ); 366 VerifyObject vo( random()%1024 );
367 { 367 {
368 MyriadStream ms = m.openStream( *i ); 368 MyriadStream ms = m.openStream( *i );
369 Archive ar( ms, Archive::load ); 369 ArchiveBinary ar( ms, ArchiveBinary::load );
370 ar >> vo; 370 ar >> vo;
371 } 371 }
372 { 372 {
373 MyriadStream ms = m.openStream( *i ); 373 MyriadStream ms = m.openStream( *i );
374 Archive ar( ms, Archive::save ); 374 ArchiveBinary ar( ms, ArchiveBinary::save );
375 ar << vo; 375 ar << vo;
376 unitTest( ms.tell() == vo.getBytesWritten() ); 376 unitTest( ms.tell() == vo.getBytesWritten() );
377 ms.setSize( ms.tell() ); 377 ms.setSize( ms.tell() );