diff options
author | Mike Buland <eichlan@xagasoft.com> | 2010-10-06 07:01:28 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2010-10-06 07:01:28 +0000 |
commit | 313e28df2a8776c82f5493aef6fe44ad40f1935a (patch) | |
tree | 219d5ff889b85773a6670fdff28c2043b14a1f09 /src/tests | |
parent | 0bb8c5962e93fae4a2542d57efe8e87d30d8f0fb (diff) | |
download | libbu++-313e28df2a8776c82f5493aef6fe44ad40f1935a.tar.gz libbu++-313e28df2a8776c82f5493aef6fe44ad40f1935a.tar.bz2 libbu++-313e28df2a8776c82f5493aef6fe44ad40f1935a.tar.xz libbu++-313e28df2a8776c82f5493aef6fe44ad40f1935a.zip |
Changed the Bu::Heap to allow iteration, and added lots of cool features to
Bu::MiniCron.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/heap.cpp | 11 | ||||
-rw-r--r-- | src/tests/minicron.cpp | 13 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/tests/heap.cpp b/src/tests/heap.cpp index 6f68598..7538936 100644 --- a/src/tests/heap.cpp +++ b/src/tests/heap.cpp | |||
@@ -38,14 +38,19 @@ typedef struct num | |||
38 | } | 38 | } |
39 | } num; | 39 | } num; |
40 | 40 | ||
41 | void printHeap( Bu::Heap<Bu::FString> &/*h*/, int j ) | 41 | void printHeap( Bu::Heap<Bu::FString> &h, int j ) |
42 | { | 42 | { |
43 | return; | 43 | // return; |
44 | Bu::FString sFName; | 44 | Bu::FString sFName; |
45 | sFName.format("graph-step-%02d.dot", j ); | 45 | sFName.format("graph-step-%02d.dot", j ); |
46 | Bu::File fOut( sFName, Bu::File::WriteNew ); | 46 | Bu::File fOut( sFName, Bu::File::WriteNew ); |
47 | Bu::Formatter f( fOut ); | 47 | Bu::Formatter f( fOut ); |
48 | // h.print( f ); | 48 | f << "Graph step: " << j << ", total size: " << h.getSize() << f.nl; |
49 | for( Bu::Heap<Bu::FString>::iterator i = h.begin(); i; i++ ) | ||
50 | { | ||
51 | f << *i << f.nl; | ||
52 | } | ||
53 | f << f.nl; | ||
49 | } | 54 | } |
50 | 55 | ||
51 | int main() | 56 | int main() |
diff --git a/src/tests/minicron.cpp b/src/tests/minicron.cpp index 8abf8ad..0749f90 100644 --- a/src/tests/minicron.cpp +++ b/src/tests/minicron.cpp | |||
@@ -41,11 +41,14 @@ void job3( Bu::MiniCron::Job &job ) | |||
41 | 41 | ||
42 | int main() | 42 | int main() |
43 | { | 43 | { |
44 | 44 | mCron.addJob( | |
45 | mCron.addJob( slot( &job0 ), MiniCron::TimerInterval( time(NULL)+3, 5 ) ); | 45 | "job0", slot( &job0 ), MiniCron::TimerInterval( time(NULL)+3, 5 ) ); |
46 | mCron.addJob( slot( &job1 ), MiniCron::TimerInterval( time(NULL)+10, 8 ) ); | 46 | mCron.addJob( |
47 | mCron.addJob( slot( &job2 ), MiniCron::TimerBasic("weekly wed 17") ); | 47 | "job1", slot( &job1 ), MiniCron::TimerInterval( time(NULL)+10, 8 ) ); |
48 | mCron.addJob( slot( &job3 ), MiniCron::TimerInterval( time(NULL)+1, 2 ) ); | 48 | mCron.addJob( |
49 | "job2", slot( &job2 ), MiniCron::TimerBasic("weekly wed 17") ); | ||
50 | mCron.addJob( | ||
51 | "job3", slot( &job3 ), MiniCron::TimerInterval( time(NULL)+1, 2 ) ); | ||
49 | 52 | ||
50 | sio << time( NULL ) << ": Program started." << sio.nl; | 53 | sio << time( NULL ) << ": Program started." << sio.nl; |
51 | 54 | ||