aboutsummaryrefslogtreecommitdiff
path: root/src/unstable
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2023-08-04 13:23:44 -0700
committerMike Buland <eichlan@xagasoft.com>2023-08-04 13:23:44 -0700
commit99095773aa31bf8eb283d6f6319a29c71e51ca9c (patch)
tree9727523e7d3a035cb4e8e6c1d9eacbe49c766397 /src/unstable
parent311d146e2d921bed4ae9d3b19203e935358b30ba (diff)
downloadlibbu++-99095773aa31bf8eb283d6f6319a29c71e51ca9c.tar.gz
libbu++-99095773aa31bf8eb283d6f6319a29c71e51ca9c.tar.bz2
libbu++-99095773aa31bf8eb283d6f6319a29c71e51ca9c.tar.xz
libbu++-99095773aa31bf8eb283d6f6319a29c71e51ca9c.zip
Woo! Unit Tests! Found some bugs!
Diffstat (limited to 'src/unstable')
-rw-r--r--src/unstable/blob.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/unstable/blob.cpp b/src/unstable/blob.cpp
index 13209e0..a9cb99d 100644
--- a/src/unstable/blob.cpp
+++ b/src/unstable/blob.cpp
@@ -236,16 +236,21 @@ bool Bu::Blob::operator!=( const char *pRhs ) const
236 if( pData == pRhs ) 236 if( pData == pRhs )
237 return false; 237 return false;
238 238
239 for( int32_t j = 0; j < iSize && pRhs[j]; j++ ) 239 int32_t j;
240 for( j = 0; j < iSize && pRhs[j]; j++ )
240 { 241 {
241 if( pData[j] != pRhs[j] ) 242 if( pData[j] != pRhs[j] )
243 {
242 return true; 244 return true;
245 }
243 } 246 }
244 247
245 if( pRhs[iSize] == '\0' ) 248 if( !(iSize == j && pRhs[j] == '\0') )
246 return false; 249 {
250 return true;
251 }
247 252
248 return true; 253 return false;
249} 254}
250 255
251bool Bu::Blob::operator<( const Bu::Blob &rRhs ) const 256bool Bu::Blob::operator<( const Bu::Blob &rRhs ) const
@@ -342,7 +347,7 @@ bool Bu::Blob::operator>( const char *pRhs ) const
342 return pData[j] > pRhs[j]; 347 return pData[j] > pRhs[j];
343 } 348 }
344 349
345 if( pRhs[iSize] == '\0' && iSize-1 > j ) 350 if( pRhs[j] == '\0' && iSize-1 > j )
346 return true; 351 return true;
347 352
348 return false; 353 return false;
@@ -367,13 +372,14 @@ bool Bu::Blob::operator>=( const char *pRhs ) const
367 if( pData == pRhs ) 372 if( pData == pRhs )
368 return true; 373 return true;
369 374
370 for( int32_t j = 0; j < iSize && pRhs[j]; j++ ) 375 int32_t j;
376 for( j = 0; j < iSize && pRhs[j]; j++ )
371 { 377 {
372 if( pData[j] != pRhs[j] ) 378 if( pData[j] != pRhs[j] )
373 return pData[j] > pRhs[j]; 379 return pData[j] > pRhs[j];
374 } 380 }
375 381
376 if( pRhs[iSize] == '\0' ) 382 if( pRhs[j] == '\0' )
377 return true; 383 return true;
378 384
379 return true; 385 return true;