// vim: syntax=cpp /* * Copyright (C) 2007-2010 Xagasoft, All rights reserved. * * This file is part of the libbu++ library and is released under the * terms of the license contained in the file LICENSE. */ #include #include #include "bu/queuebuf.h" #include "bu/md5.h" #define RNDCHR ((char)(((double)random()/(double)RAND_MAX)*256.0)) suite QueueBuf { test testBasic01 { Bu::QueueBuf qb; unitTest( qb.write("ab", 2 ) == 2 ); unitTest( qb.write("cde", 3 ) == 3 ); unitTest( qb.write("FG", 2 ) == 2 ); char buf[8]; buf[7] = '\0'; unitTest( qb.read( buf, 7 ) == 7 ); unitTest( !strncmp( buf, "abcdeFG", 7 ) ); unitTest( qb.read( buf, 7 ) == 0 ); } void QBUF_RANDSTR( Bu::String &fill, unsigned int iSize ) { char c; for( unsigned int i=0; i