aboutsummaryrefslogtreecommitdiff
path: root/src/unit
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-05-24 15:10:19 +0000
committerMike Buland <eichlan@xagasoft.com>2010-05-24 15:10:19 +0000
commitecc191f590f76584a14c9c51727412b0b7b3086e (patch)
treeb27ee434ed541ba3a386ff6a3238f66b9451ef22 /src/unit
parent71191e311d949b1b7bdd74fc36a14306f492c181 (diff)
downloadlibbu++-ecc191f590f76584a14c9c51727412b0b7b3086e.tar.gz
libbu++-ecc191f590f76584a14c9c51727412b0b7b3086e.tar.bz2
libbu++-ecc191f590f76584a14c9c51727412b0b7b3086e.tar.xz
libbu++-ecc191f590f76584a14c9c51727412b0b7b3086e.zip
Changed the Bu::Stream API, setSize is now standard. There may be a few more
things that should be added. A few of them still need to be implemented. I know that truncate for Bu::File is possible on windows, I've used it before, but hell if I can find it. Myriad also needs the setSize function completed.
Diffstat (limited to '')
-rw-r--r--src/unit/myriad.unit2
-rw-r--r--src/unitsuite.cpp14
-rw-r--r--src/unitsuite.h5
3 files changed, 20 insertions, 1 deletions
diff --git a/src/unit/myriad.unit b/src/unit/myriad.unit
index bc05bf7..cf861a3 100644
--- a/src/unit/myriad.unit
+++ b/src/unit/myriad.unit
@@ -76,7 +76,7 @@ suite Myriad
76 { 76 {
77 FString sFileName("myriad-XXXXXXX"); 77 FString sFileName("myriad-XXXXXXX");
78 78
79 File::tempFile( sFileName ); 79 tempFile( sFileName );
80 File fMyriad( sFileName, File::WriteNew|File::Read ); 80 File fMyriad( sFileName, File::WriteNew|File::Read );
81 Myriad m( fMyriad ); 81 Myriad m( fMyriad );
82 m.initialize( 64 ); 82 m.initialize( 64 );
diff --git a/src/unitsuite.cpp b/src/unitsuite.cpp
index a66160e..51cca10 100644
--- a/src/unitsuite.cpp
+++ b/src/unitsuite.cpp
@@ -6,6 +6,9 @@
6 */ 6 */
7 7
8#include "bu/unitsuite.h" 8#include "bu/unitsuite.h"
9#include "bu/file.h"
10
11#include <unistd.h>
9 12
10Bu::UnitSuite::UnitSuite() : 13Bu::UnitSuite::UnitSuite() :
11 iOptions( 0 ) 14 iOptions( 0 )
@@ -102,9 +105,20 @@ int Bu::UnitSuite::run( int /*argc*/, char * /*argv */ [] )
102 if( iUPass == 0 && iUFail == 0 ) 105 if( iUPass == 0 && iUFail == 0 )
103 printf("\tNothing unexpected.\n\n"); 106 printf("\tNothing unexpected.\n\n");
104 107
108 for( StrList::iterator i = lFileCleanup.begin(); i; i++ )
109 {
110 unlink( (*i).getStr() );
111 }
112
105 return 0; 113 return 0;
106} 114}
107 115
116void Bu::UnitSuite::tempFile( Bu::FString &sFileName )
117{
118 Bu::File::tempFile( sFileName );
119 lFileCleanup.append( sFileName );
120}
121
108void Bu::UnitSuite::add( Test fTest, const Bu::FString &sName, Expect e ) 122void Bu::UnitSuite::add( Test fTest, const Bu::FString &sName, Expect e )
109{ 123{
110 TestInfo ti; 124 TestInfo ti;
diff --git a/src/unitsuite.h b/src/unitsuite.h
index ad6bedb..7d026c2 100644
--- a/src/unitsuite.h
+++ b/src/unitsuite.h
@@ -61,6 +61,8 @@ namespace Bu
61 61
62 int run( int argc=0, char *argv[]=NULL ); 62 int run( int argc=0, char *argv[]=NULL );
63 63
64 void tempFile( Bu::FString &sFileName );
65
64 typedef void (UnitSuite::*Test)(); 66 typedef void (UnitSuite::*Test)();
65 67
66 class Failed 68 class Failed
@@ -105,6 +107,9 @@ namespace Bu
105 FString sSuiteName; 107 FString sSuiteName;
106 108
107 int iOptions; 109 int iOptions;
110
111 typedef Bu::List<Bu::FString> StrList;
112 StrList lFileCleanup;
108 }; 113 };
109} 114}
110 115