diff options
Diffstat (limited to 'src/unit/array.cpp')
-rw-r--r-- | src/unit/array.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/unit/array.cpp b/src/unit/array.cpp index db29882..57d6c03 100644 --- a/src/unit/array.cpp +++ b/src/unit/array.cpp | |||
@@ -15,7 +15,8 @@ public: | |||
15 | { | 15 | { |
16 | setName("Array"); | 16 | setName("Array"); |
17 | addTest( Unit::general ); | 17 | addTest( Unit::general ); |
18 | addTest( Unit::iterate ); | 18 | addTest( Unit::iterate1 ); |
19 | addTest( Unit::iterate2 ); | ||
19 | } | 20 | } |
20 | 21 | ||
21 | virtual ~Unit() | 22 | virtual ~Unit() |
@@ -34,7 +35,7 @@ public: | |||
34 | unitTest( ai[1] == 10 ); | 35 | unitTest( ai[1] == 10 ); |
35 | } | 36 | } |
36 | 37 | ||
37 | void iterate() | 38 | void iterate1() |
38 | { | 39 | { |
39 | Bu::Array<int> ai; | 40 | Bu::Array<int> ai; |
40 | for( int j = 0; j < 10; j++ ) | 41 | for( int j = 0; j < 10; j++ ) |
@@ -49,7 +50,13 @@ public: | |||
49 | for( Bu::Array<int>::const_iterator i = ci.begin(); i != ci.end(); i++ ) | 50 | for( Bu::Array<int>::const_iterator i = ci.begin(); i != ci.end(); i++ ) |
50 | unitTest( (*i) == j++ ); | 51 | unitTest( (*i) == j++ ); |
51 | } | 52 | } |
52 | 53 | ||
54 | void iterate2() | ||
55 | { | ||
56 | Bu::Array<int> ai; | ||
57 | for( Bu::Array<int>::iterator i = ai.begin(); i != ai.end(); i++ ) | ||
58 | unitFailed("Empty lists shouldn't be iterated through."); | ||
59 | } | ||
53 | }; | 60 | }; |
54 | 61 | ||
55 | int main( int argc, char *argv[] ) | 62 | int main( int argc, char *argv[] ) |