From 4b9289cfb260f4bcecaf23a810584ef6ef8e8501 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 30 Mar 2011 22:33:41 +0000 Subject: Ok, string stuff is working much, much better, a load of new unit tests have been added, and I deleted a whole slew of stupid old tests that I don't need. --- src/tests/speed.cpp | 58 ----------------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 src/tests/speed.cpp (limited to 'src/tests/speed.cpp') diff --git a/src/tests/speed.cpp b/src/tests/speed.cpp deleted file mode 100644 index 2fa29aa..0000000 --- a/src/tests/speed.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2007-2011 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 "bu/string.h" -#include - -template -struct tstCopy -{ - tstCopy( const a &src ) : - src( src ) - { - } - - void operator()() - { - a tmp = src; - } - - a src; -}; - -template -double runTest( f fnc ) -{ - struct timeval tStart, tEnd; - int j = 0; - gettimeofday( &tStart, NULL ); - for(; j < 500000; j++ ) - fnc(); - gettimeofday( &tEnd, NULL ); - - return (double)(tEnd.tv_sec-tStart.tv_sec)+ - (double)(tEnd.tv_usec-tStart.tv_usec)/1000000.0; -} - -template -void fullTest( tst t ) -{ - double dTotal; - int iCount = 10; - for( int j = 0; j < iCount; j++ ) - dTotal += runTest( t ); - printf("Average time: %f\n", dTotal/iCount ); -} - -int main() -{ - Bu::String str; - for( int j = 0; j < 500; j++ ) - str.append("Hey, this is a test string. It will be reapeated many, many times. How's that?"); - fullTest( tstCopy( str ) ); -} - -- cgit v1.2.3